Monitor APC UPS with Monit

2017-09-15

Monitor your UPS with monit and apcupsd, using an sh one-liner.

Example monit config:

check program ups with path "/usr/bin/sh -c 'STATUS=`/opt/local/sbin/apcaccess -p STATUS`; OK='ONLINE'; if [ $STATUS != $OK ]; then echo $STATUS; exit 1; fi;'"
  if status != 0 then alert

Explanation: