multiple ups devices
https://wiki.debian.org/apcupsd
root@a6:/etc/apcupsd# lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 046d:c31c Logitech, Inc. Keyboard K120
Bus 001 Device 005: ID 051d:0002 American Power Conversion Uninterruptible Power Supply
Bus 001 Device 004: ID 051d:0002 American Power Conversion Uninterruptible Power Supply
Bus 001 Device 003: ID 046d:c077 Logitech, Inc. M105 Optical Mouse
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
root@a6:/etc/apcupsd# udevadm info –attribute-walk –name=/dev/usb/hiddev0 | egrep ‘manufacturer|product|serial’
ATTRS{manufacturer}==”American Power Conversion”
ATTRS{product}==”Back-UPS ES 600M1 FW:928.a8 .D USB FW:a8 ”
ATTRS{serial}==”4B1903P08928 ”
ATTRS{serial}==”0000:00:14.0″
ATTRS{product}==”xHCI Host Controller”
ATTRS{manufacturer}==”Linux 4.19.0-12-amd64 xhci-hcd”
root@a6:/etc/apcupsd# udevadm info –attribute-walk –name=/dev/usb/hiddev1 | egrep ‘manufacturer|product|serial’
ATTRS{manufacturer}==”American Power Conversion”
ATTRS{product}==”Back-UPS 350 FW: 5.4.D USB FW: c1 ”
ATTRS{serial}==”BB0236018154″
ATTRS{serial}==”0000:00:14.0″
ATTRS{manufacturer}==”Linux 4.19.0-12-amd64 xhci-hcd”
ATTRS{product}==”xHCI Host Controller”
root@a6:/etc/apcupsd# ls -l /dev/usb
total 0
crw——- 1 root root 180, 0 Jan 12 05:50 hiddev0
crw——- 1 root root 180, 1 Jan 12 05:50 hiddev1
lrwxrwxrwx 1 root root 7 Jan 12 05:50 ups-server -> hiddev1
lrwxrwxrwx 1 root root 7 Jan 12 05:50 ups-spare -> hiddev1
apcupsd and zabbix
this does not work to stop/start/restart
/etc/init.d/zabbix-agent status
solution:
manually kill and restart
su – zabbix -c “/usr/local/sbin/zabbix_agentd”
zabbix
the slaves only allow queries from a0, so do this on a0:
zabbix_get -s k0 -p10050 -k system.uptime
zabbix_get -s k0 -p10050 -k apcupsd.status
setup on slave:
scp -P 2222 a0:/usr/local/etc/zabbix_agentd.conf.d/userparameter_apcupsd.conf .
sudo cp userparameter_apcupsd.conf /usr/local/etc/zabbix_agentd.conf.d/
sudo vi /usr/local/etc/zabbix_agentd.conf
add Include=/usr/local/etc/zabbix_agentd.conf.d/
*** sometimes this works (like on a2), sometimes not (like on k0)! sudo /etc/init.d/zabbix-agent start
kill /usr/local/sbin/zabbix_agentd
sudo /etc/init.d/zabbix-agent start
test on a0:
zabbix_get -s a2 -p10050 -k apcupsd.status
problems:
zabbix_get -s k0 -p10050 -k apcupsd.status
ZBX_NOTSUPPORTED: Unsupported item key.
edit
/usr/local/etc/zabbix_agentd.conf
add
Include=/usr/local/etc/zabbix_agentd.conf.d/