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

56 lines
1.8 KiB
Plaintext
Raw Normal View History

2014-10-04 22:05:54 +02:00
#!/bin/sh
#
# (c) Andreas Kreisl extended by Tobias Schramm
2014-10-04 22:05:54 +02:00
#
# Link name will be used as title: apc_{$title}
#
# env.keys LOADPCT BCHARGE LINEV BATTV TIMELEFT
#
if [ -z "$keys" ]; then
keys="LINEV LOADPCT BCHARGE NUMXFERS TIMELEFT"
2014-10-04 22:05:54 +02:00
fi
apcinfo=`/sbin/apcaccess`
2014-10-04 22:05:54 +02:00
if [ "$1" = "config" ]; then
title=`basename $0 | sed 's/^apc_//g' | awk '{ sub(/^./,toupper(substr($0,1,1))); print; }'`
echo 'multigraph apc_status'
echo "graph_title UPS Status - $title"
echo 'graph_args --base 1000'
echo 'graph_category sensors'
2014-10-04 22:05:54 +02:00
title=`/sbin/apcaccess | egrep "^MODEL" | awk '{print $3" "$4" "$5" "$6" "$7" "$8" "$9;}'`
echo "graph_info $title"
for key in $keys; do
echo "$key.label $key"
echo "$key.info Value of $key"
echo "$key.draw LINE1"
done
for key in $keys; do
key_lower=`echo "$key" | awk '{print tolower($0);}'`
unit=`echo "$apcinfo" | egrep "^$key" | awk '{print $4;}'`
echo "multigraph apc_status.$key_lower"
echo "graph_title $key"
echo 'graph_args --base 1000'
if [ -n "$unit" ]; then
echo "graph_vlabel $unit"
fi
echo 'graph_category sensors'
echo "$key.label $key"
echo "$key.info $key."
echo "$key.draw LINE1"
2014-10-04 22:05:54 +02:00
done
exit 0
fi
echo 'multigraph apc_status'
for key in $keys; do
echo "$apcinfo" | egrep "^$key" | awk '{print $1".value "$3;}'
done
for key in $keys; do
key_lower=`echo "$key" | awk '{print tolower($0)}'`
echo "multigraph apc_status.$key_lower"
echo "$apcinfo" | egrep "^$key" | awk '{print $1".value "$3;}'
done