2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00
contrib-munin/plugins/other/alertme_power

51 lines
1.4 KiB
Plaintext
Raw Normal View History

2011-01-19 14:33:50 +01:00
#!/bin/sh
2011-01-20 14:10:10 +01:00
# http://exchange.munin-monitoring.org/plugins/alertme_power/details
#
2011-01-19 14:33:50 +01:00
# alertme_power relies on http://code.google.com/p/alertmepi/
# to have been installed and working
#
2011-01-20 14:10:10 +01:00
# 20110120 - update to use correct mixed case for AlertMe and remove cruft
# left over from creating this plugin from another script
#
2011-01-19 14:33:50 +01:00
# 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
2011-01-20 14:10:10 +01:00
echo "graph_title AlertMe Power"
2011-01-19 14:33:50 +01:00
echo "graph_category environmental"
2011-01-20 14:10:10 +01:00
echo -n "graph_info this graph shows AlertMe power measurements for "
2011-01-19 14:33:50 +01:00
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
)
2011-01-20 14:10:10 +01:00
# end alertme_power munin_plugin