I have an APC UPS which I like to monitor, and graph, this is the code I use to do so.
So I created a bash script to monitor and graph the state of my UPS.
Firstly run this script with the “create” parameter
ups.sh create then create a cron job to regularly update:
* * * * * root /usr/local/bin/ups.sh update > /dev/null && /usr/local/bin/ups.sh graph > /dev/null
This script requires rrdtool to be installed.
The resulting graph looks like this: