tilesAtHome mit Munin überwachen

Hier ist ein quick&dirty Script mit dem man tilesAtHome mit Munin überwachen kann. Einfach eine Datei in /usr/share/munin/plugins anlegen und im /etc/munin/plugins Ordner verlinken.

#!/bin/sh
#check if count file exists
if !(test -f /var/lib/munin/plugin-state/tahmu_count)
then
#if not create one
new=`grep -c "upload stop" /var/www/tilesAtHome/tah-process.txt`
echo $new > /var/lib/munin/plugin-state/tahmu_count
fi
new=`grep -c "upload stop" /var/www/tilesAtHome/tah-process.txt`
old=`cat /var/lib/munin/plugin-state/tahmu_count`

let count=$new-$old

case $1 in
   config)
        cat <<'EOM'
graph_category OpenStreetMap
graph_title Uploaded Tilesets
graph_vlabel number of uploaded tilesets
uploadedtilesets.label uploadedtilesets
EOM
        exit 0;;
esac
echo "uploadedtilesets.value $count"
echo $new > /var/lib/munin/plugin-state/tahmu_count