#!/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 # # 0.0.1 - 071220 # minor textbugs fixed # # 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 if [ -x ${CLIENT} ]; then echo "yes" exit 0 else echo "no ${CLIENT} is not executable" exit 1 fi 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=" ${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}'