Skip to content

Instantly share code, notes, and snippets.

@yegle
Created May 20, 2021 07:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yegle/5aa8fbb1bd1ad868ba654d91a96ceb83 to your computer and use it in GitHub Desktop.
Save yegle/5aa8fbb1bd1ad868ba654d91a96ceb83 to your computer and use it in GitHub Desktop.
Blackbox Exporter scraping Transmission BitTorrent Server RPC Example
# Caveat:
# 1. query_response support regex capture group, but you have to write expect/send in the same YAML item.
# 2. When send the "send" line, Blackbox Exporter will automatically add a \n.
transmission_rpc:
prober: tcp
timeout: 30s
tcp:
query_response:
- send: "GET /transmission/rpc/ HTTP/1.1\r\nAuthorization: Basic YOUR_BASIC_AUTH_HEADER\r\n\r"
- expect: "X-Transmission-Session-Id: ([A-Za-z0-9]+)$"
send: "POST /transmission/rpc HTTP/1.1\r\nX-Transmission-Session-Id: ${1}\r\nAuthorization: Basic YOUR_BASIC_AUTH_HEADER\r\nContent-Length: 55\r\nContent-Type: application/x-www-form-urlencoded\r\n\r\n{\"method\":\"torrent-get\",\"arguments\":{\"fields\":[\"id\"]}}"
- expect: '.*"result":"success".*'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment