UPS
Munin plugins to support APC(TM) UPS devices and report battery status and consumed power / running costs.
All of these plugins are dependant upon the successful installation of apcupsd prior to their use.
apcups_battery
This plugin reports the APC UPS battery statistics. The plugin should be saved with a filename 'apcups_battery' and a link can then be generated in the munin plugins directory:
ln -s /path/apcups_battery /etc/munin/plugins/apcups_battery
#!/bin/sh # # Plugin to report APC Battery statistics. Relies on apcupsd package being installed. # # Contributed by Tim Chappell # # Magic markers - optional - used by installation scripts and # munin-config: # #%# family=manual #%# capabilities=autoconf SRCFILE=/var/log/apcupsd.status if [ "$1" = "config" ]; then echo 'graph_category power' echo 'graph_title UPS Battery Stats' echo 'graph_vlabel Battery condition' echo 'apc_ups_battery_volts.label Battery (V)' echo 'apc_ups_battery_volts.draw LINE1' echo 'apc_ups_battery_charge.label Battery Charge (%)' echo 'apc_ups_battery_charge.draw LINE1' echo 'apc_ups_battery_temp.label Battery Temp (degC)' echo 'apc_ups_battery_temp.draw LINE1' echo 'apc_ups_battery_rtr.label Battery Runtime (mins)' echo 'apc_ups_battery_rtr.draw LINE1' exit 0 fi /bin/cat $SRCFILE | /usr/bin/awk '{if ($1=="BATTV") {printf "apc_ups_battery_volts.value %s\n",$3}}' /bin/cat $SRCFILE | /usr/bin/awk '{if ($1=="BCHARGE") {printf "apc_ups_battery_charge.value %s\n",$3}}' /bin/cat $SRCFILE | /usr/bin/awk '{if ($1=="ITEMP") {printf "apc_ups_battery_temp.value %s\n",$3}}' /bin/cat $SRCFILE | /usr/bin/awk '{if ($1=="TIMELEFT") {printf "apc_ups_battery_rtr.value %s\n",$3}}'
apcups_power
This plugin reports the APC UPS power consumption and running costs. The plugin should be saved with a filename 'apcups_power' and a link can then be generated in the munin plugins directory:
ln -s /path/apcups_power /etc/munin/plugins/apcups_power
Edit the COST variable as appropriate - it determines the cost of each kWh (set to pence or cents as required).
#!/bin/sh # # Plugin to report APC UPS power and monthly running cost. # # Contributed by Tim Chappell # # Magic markers - optional - used by installation scripts and # munin-config: # #%# family=manual #%# capabilities=autoconf # Cost (pence) per kWh COST=11 SRCFILE=/var/log/apcupsd.status if [ "$1" = "config" ]; then echo 'graph_category power' echo 'graph_title UPS Power Consumption' echo 'graph_vlabel Watts' echo 'apc_ups_power.label Consumed Power' echo 'apc_ups_power.draw LINE1' echo 'running_cost.label Monthly running cost' echo 'running_cost.draw LINE1' exit 0 fi NOMPOWER=`awk '{if($1=="NOMPOWER"){print $3}}' $SRCFILE` awk -vc=$COST -vp=$NOMPOWER '{if($1=="LOADPCT"){printf"apc_ups_power.value %d\n",($3/100*p)}}' $SRCFILE awk -vc=$COST -vp=$NOMPOWER '{if($1=="LOADPCT"){printf"running_cost.value %.2f\n",((($3/100*p)/1000)*24*30*c/100)}}' $SRCFILE
This website publishes a Privacy Policy (link at the bottom of every page). Continued use of this website implies your consent to the use of data outlined in the policy.