root / plugins / sensors / alertme_power @ 8589c6df
Historique | Voir | Annoter | Télécharger (1,37 ko)
| 1 | 5ceb5dd2 | Paul M | #!/bin/sh |
|---|---|---|---|
| 2 | 5c46d3fc | Paul M | # http://exchange.munin-monitoring.org/plugins/alertme_power/details |
| 3 | # |
||
| 4 | 5ceb5dd2 | Paul M | # alertme_power relies on http://code.google.com/p/alertmepi/ |
| 5 | # to have been installed and working |
||
| 6 | # |
||
| 7 | 5c46d3fc | Paul M | # 20110120 - update to use correct mixed case for AlertMe and remove cruft |
| 8 | # left over from creating this plugin from another script |
||
| 9 | # |
||
| 10 | 5ceb5dd2 | Paul M | # add to the plugins-conf.d/munin so that it can read the /etc/alertme files |
| 11 | # [alertme_*] |
||
| 12 | # user root |
||
| 13 | |||
| 14 | |||
| 15 | TMPFILE=/var/run/munin/alertme_power.dat |
||
| 16 | |||
| 17 | if [ "$1" = "config" ] ; then |
||
| 18 | if [ ! -f $TMPFILE ] ; then |
||
| 19 | # cache hub name and list of devices during config phase to speed up normal run time |
||
| 20 | /usr/local/bin/alertmepi.pl -a > $TMPFILE |
||
| 21 | /usr/local/bin/alertmepi.pl -d | egrep "is the power controller named|is the powerclamp named" >> $TMPFILE |
||
| 22 | fi |
||
| 23 | |||
| 24 | 5c46d3fc | Paul M | echo "graph_title AlertMe Power" |
| 25 | e3899a30 | Gabriele Pohl | echo "graph_category sensors" |
| 26 | 5c46d3fc | Paul M | echo -n "graph_info this graph shows AlertMe power measurements for " |
| 27 | 5ceb5dd2 | Paul M | head -1 $TMPFILE |
| 28 | echo "graph_vlabel power (W)" |
||
| 29 | |||
| 30 | tail +2 $TMPFILE | ( |
||
| 31 | while read DEVICE OTHER |
||
| 32 | do |
||
| 33 | NAME=`echo $OTHER | awk -F\' '{print $2}' | sed -e 's/ /_/g' -e 's/-/_/g'`
|
||
| 34 | echo "${NAME}_power.label $NAME "
|
||
| 35 | done |
||
| 36 | ) |
||
| 37 | |||
| 38 | exit |
||
| 39 | fi |
||
| 40 | |||
| 41 | tail +2 $TMPFILE | ( |
||
| 42 | while read DEVICE OTHER |
||
| 43 | do |
||
| 44 | NAME=`echo $OTHER | awk -F\' '{print $2}' | sed -e 's/ /_/g' -e 's/-/_/g'`
|
||
| 45 | echo -n "${NAME}_power.value "
|
||
| 46 | /usr/local/bin/alertmepi.pl -e $DEVICE | sed -e 's/.* //' -e 's/W.//' |
||
| 47 | done |
||
| 48 | ) |
||
| 49 | |||
| 50 | 5c46d3fc | Paul M | # end alertme_power munin_plugin |
