User Tools

Site Tools


notes:zabbix-apcupsd-without-snmp

Zabbix: Monitor an APC UPS with apcupsd (no SNMP required)

Monitoring an APC UPS without snmp is not so difficult. If you are already using the apcupsd daemon, feeding this data to Zabbix as UserParameter is all about putting the data into a file that Zabbix can read.

This is my configuration of apcupsd for a SmartUPS 5000 connected to the Local Network (1.2.3.4 is the IP address of my UPS – change your /etc/apcupsd/apcupsd.conf file to match your network setup).

## apcupsd.conf v1.1 ##
UPSNAME SmartUPS5000
UPSCABLE ether
UPSTYPE pcnet 1.2.3.4:apc
DEVICE
LOCKFILE /var/lock
UPSCLASS standalone
UPSMODE disable

POLLTIME 60
ONBATTERYDELAY 15

# BATTERYLEVEL, MINUTES, and TIMEOUT work in conjunction, so
# the first that occurs will cause the initation of a shutdown.
BATTERYLEVEL 10
MINUTES 5
TIMEOUT 0 #set it to 0 for SmartUPS devices

STATTIME 50
STATFILE /var/log/apcupsd.status
LOGSTATS off
DATATIME 0

As you can see in the config file, the UPS status is dumped every 50 seconds within the /var/log/apcupsd.status file. The status of the UPS can be seen with the apcaccess command

APC      : 001,050,1290
DATE     : 2014-04-23 10:14:44 +0200  
HOSTNAME : faxserver
VERSION  : 3.14.8 (16 January 2010) debian
UPSNAME  : SmartUPS5000
CABLE    : Ethernet Link
MODEL    : PCNET UPS Driver
UPSMODE  : Stand Alone
STARTTIME: 2014-04-23 10:14:44 +0200  
STATUS   : ONLINE 
LINEV    : 229.3 Volts
LOADPCT  :  27.2 Percent Load Capacity
BCHARGE  : 100.0 Percent
TIMELEFT :  37.0 Minutes
MBATTCHG : 10 Percent
MINTIMEL : 5 Minutes
MAXTIME  : 0 Seconds
MAXLINEV : 229.3 Volts
MINLINEV : 229.3 Volts
OUTPUTV  : 229.2 Volts
DWAKE    : 010 Seconds
DSHUTD   : 020 Seconds
DLOWBATT : 02 Minutes
LOTRANS  : 160.0 Volts
HITRANS  : 255.0 Volts
RETPCT   : 000.0 Percent
ITEMP    : 23.0 C Internal
ALARMDEL : Always
BATTV    : 218.4 Volts
LINEFREQ : 50.0 Hz
LASTXFER : Automatic or explicit self test
NUMXFERS : 30
XONBATT  : 2014-08-23 15:11:35 +0200  
TONBATT  : 0 seconds
CUMONBATT: 174 seconds
XOFFBATT : 2014-08-23 15:11:43 +0200  
LASTSTEST: 2014-08-23 15:11:35 +0200  
SELFTEST : OK
STESTI   : 336
STATFLAG : 0x07000008 Status Flag
REG1     : 0x00 Register 1
REG2     : 0x00 Register 2
REG3     : 0x00 Register 3
MANDATE  : 02/21/2012
SERIALNO : IS1209001282
BATTDATE : 02/21/2012
NOMOUTV  : 230 Volts
EXTBATTS : 0
FIRMWARE : 5.1 (ID5)
APCMODEL : Smart-UPS RT-5000 XL-1
END APC  : 2014-08-29 13:49:30 +0200  

We are interested in line/battery voltages, UPS load and battery charge. With awk we can easily get these values and provide them to Zabbix Server as User Parameter. On the host that runs zabbix_agentd, edit the /etc/zabbix/zabbix_agentd.conf and insert the following lines:

UserParameter=apcupsd.linev,awk < /var/log/apcupsd.status '/^(LINEV).*:/ { print $3 }'
UserParameter=apcupsd.loadpct,awk < /var/log/apcupsd.status '/^(LOADPCT).*:/ { print $3 }'
UserParameter=apcupsd.battcharge,awk < /var/log/apcupsd.status '/^(BCHARGE).*:/ { print $3 }'
UserParameter=apcupsd.timeleft,awk < /var/log/apcupsd.status '/^(TIMELEFT).*:/ { print $3 }'
UserParameter=apcupsd.battv,awk < /var/log/apcupsd.status '/^(BATTV).*:/ { print $3 }'

and restart the zabbix_agent.

In the Zabbix web interface

  1. Install the zbx_apcupsd_template.xml (it has 5 items and 2 triggers for generating Power Down and Low Battery alerts) (zbx_apcupsd_template.xml)
  2. Add the “apcupsd Template” to the monitoring host
notes/zabbix-apcupsd-without-snmp.txt · Last modified: 2014/09/06 17:37 by admin