Add transmission dashboard to grafana #5

Merged
eblume merged 7 commits from feature/transmission-dashboard into main 2026-01-14 14:19:12 -08:00
Showing only changes of commit 0afd34590d - Show all commits

Fix transmission-metrics session ID parsing

Transmission doesn't support HEAD requests, so use -i flag with sed to
parse only the HTTP headers (stopping at the blank line before body).
Also anchor grep pattern to line start to avoid matching HTML content.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Erich Blume 2026-01-14 13:56:08 -08:00

View file

@ -9,8 +9,10 @@ OUTPUT_FILE="{{ transmission_metrics_dir }}/transmission.prom"
TEMP_FILE="${OUTPUT_FILE}.tmp"
# Get session ID (required for transmission RPC)
# Note: transmission doesn't support HEAD requests, so we make a request and parse
# the 409 response headers. We use sed to stop at the blank line (which has \r) before body.
get_session_id() {
curl -s -I "$RPC_URL" 2>/dev/null | grep -i 'X-Transmission-Session-Id' | awk '{print $2}' | tr -d '\r'
curl -s -i "$RPC_URL" 2>/dev/null | sed '/^\r$/q' | grep -i '^X-Transmission-Session-Id:' | awk '{print $2}' | tr -d '\r'
}
# Make RPC request