diff --git a/plugins/other/alertme_power b/plugins/other/alertme_power new file mode 100755 index 00000000..9600abb1 --- /dev/null +++ b/plugins/other/alertme_power @@ -0,0 +1,47 @@ +#!/bin/sh +# alertme_power relies on http://code.google.com/p/alertmepi/ +# to have been installed and working +# +# add to the plugins-conf.d/munin so that it can read the /etc/alertme files +# [alertme_*] +# user root + + +TMPFILE=/var/run/munin/alertme_power.dat + +if [ "$1" = "config" ] ; then + if [ ! -f $TMPFILE ] ; then + # cache hub name and list of devices during config phase to speed up normal run time + /usr/local/bin/alertmepi.pl -a > $TMPFILE + /usr/local/bin/alertmepi.pl -d | egrep "is the power controller named|is the powerclamp named" >> $TMPFILE + fi + + echo "graph_title Alertme Power" + echo "graph_category environmental" + echo -n "graph_info this graph shows alertme power measurements for " + head -1 $TMPFILE + echo "graph_vlabel power (W)" + + tail +2 $TMPFILE | ( + while read DEVICE OTHER + do + NAME=`echo $OTHER | awk -F\' '{print $2}' | sed -e 's/ /_/g' -e 's/-/_/g'` + echo "${NAME}_power.label $NAME " + done + ) + + exit +fi + +tail +2 $TMPFILE | ( +while read DEVICE OTHER +do + NAME=`echo $OTHER | awk -F\' '{print $2}' | sed -e 's/ /_/g' -e 's/-/_/g'` + echo -n "${NAME}_power.value " + /usr/local/bin/alertmepi.pl -e $DEVICE | sed -e 's/.* //' -e 's/W.//' +done +) + +#echo "ping_rtt.value $RTTAVG" +#echo "ping_loss.value $PKTLOSS" +