I'm using rsync.net's networked storage for my duplicity backups (operated with backupninja). rsync.net uses quotas to limit each user's storage space. As I'm using munin to monitor my local machines, including their disks capacity, I wanted to include a similar graphing for the rsync.net quota too.

Here's a very basic munin plugin to be installed as /etc/munin/plugins/rsyncnetquota to be able to graph the output of the quota command :

#!/bin/bash

user=12345
host=whatever.rsync.net

quota=`ssh $user@$host quota | grep -e '^ */' | sed 's/^ *//g'`
current=`echo $quota | cut -d ' ' -f 2 | sed 's/\*$//'`
quota=`echo $quota | cut -d ' ' -f 3`
warning=$((quota*80/100*1024))
critical=$((quota*95/100*1024))

case $1 in
   config)
	echo "graph_title Rsync.net quota for $user (quota : $quota)"
	cat <<"EOM"
graph_vlabel quota
quota.label quota
EOM
echo "quota.warning $warning"
echo "quota.critical $critical"
#graph_args --base 1000

        exit 0;;
esac

echo -n "quota.value "
let current=$current*1024
echo $current

In my case, I want to have a warning alert at 80% and a critical message at 95%. Note that you may prefer adding constants here instead of issueing 2 ssh connections, one for the execution with parameter 'config' and one for the real value collection.

The script should be run as a user (here, root) which is allowed to execute password-less ssh onto the remote rsync.net account (ssh public keys, etc.), so a corresponding configuration should be added to /etc/munin/plugin-conf.d/munin-node in the form of :

[rsyncnetquota]
user root