#!/bin/sh # # xmlrpc based munin plugin for monitoring rtorrent's upload/download speed # prerequisites: # - rtorrent 0.7.5 or newer compiled with --with-xmlrpc-c # - a webserver set up to route xmlrpc calls to rtorrent's scgi port # check http://libtorrent.rakshasa.no/wiki/RTorrentXMLRPCGuide for further informations # # written by Gabor Hudiczius # web: http://projects.cyla.homeip.net/rtwi/wiki/rTorrentOMeter # email: ghudiczius@gmail.com # # 0.0.0 - 071218 # initial release # # path to the xmlrpc client CLIENT=/usr/local/bin/xmlrpc # the webserver's route to the rtorrent's scgi port ADDRESS=127.0.0.1/RPC2 if [ "$1" = "autoconf" ]; then echo yes exit 0 fi if [ "$1" = "config" ]; then echo "graph_order down up" echo "graph_title rTorrent speeds" echo "graph_args --base 1024" echo "graph_vlabel bytes in (-) / out (+) per ${graph_period}" echo "graph_category network" echo "down.label Download B/s" echo "down.type GAUGE" echo "down.draw AREA" # echo "down.cdef up,8,*" echo "up.label Upload B/s" echo "up.type GAUGE" echo "up.draw LINE2" # echo "up.cdef up,8,*" exit 0 fi cmd="${CLIENT} ${ADDRESS} d.multicall default d.get_up_rate= d.get_down_rate=" up=0 down=0 ${cmd} | awk ' BEGIN {up = 0; down = 0} /Index 0 (32|64)-bit integer: [0-9]+$/ {up = up + $5} /Index 1 (32|64)-bit integer: [0-9]+$/ {down = down + $5} END {print "up.value " up; print "down.value " down}'