So in my rack I have a Cyberpower OL2200 UPS with a RMCARD205. I am monitoring this with zabbix using SNMP. what I want to do is setup my TrueNAS Core server so that if that UPS goes on battery for 5 minutes the TrueNAS server will shutdown. I do not want the TrueNAS server to shut down the UPS as I have other servers in the rack also. I did a considerable amount of reading on this and looked over the settings in the UPS service and well, it’s pretty confusing. If someone has set this up before and could give me some guidance that would be greatly appreciated!!
Rob
pmh
May 21, 2024, 10:53am
2
It won’t work with NUT 2.8.0 - which has this bug:
opened 01:27AM - 14 May 22 UTC
closed 04:25PM - 24 May 22 UTC
* FreeBSD 13.0-release
* NUT 2.8.0 (installed via ports)
* UPS: Cyberpower PR1… 500LCD + RMCARD205
* Previously used the same network card with another UPS without issue.
* Was on firmware version 1.1.2, tried updating to 1.3.4. No apparent change. Not going to update to 1.3.5 as I still have a Linux client on 2.7.4.
With 2.7.4 I had no connectivity problems, but with 2.8.0 as soon as I start nut_upsmon it begins broadcasting `Communications with UPS cyberpower@localhost lost` and `UPS cyberpower@localhost is unavailable`. It never seems to establish a connection. All other tools seem to work just fine over snmp v1. My ups.conf is extremely basic, only specifying driver, community, and port. I did try specifying `synchronous = no` but it made no difference.
<details>
<summary>upsc output (2.8.0)</summary>
```
battery.charge: 100
battery.current: 3.20
battery.runtime: 3960
battery.runtime.elapsed: 0
battery.temperature: 34
battery.voltage: 27.60
battery.voltage.nominal: 24
device.contact: Administrator
device.description: UPS SNMP Card
device.location: Server Room
device.mfr: CYBERPOWER
device.model: PR1500LCD
device.serial: PYTLZ2000045
device.type: ups
driver.name: snmp-ups
driver.parameter.pollinterval: 2
driver.parameter.port: 192.168.42.127
driver.parameter.synchronous: auto
driver.version: 2.8.0
driver.version.data: cyberpower MIB 0.51
driver.version.internal: 1.21
input.frequency: 60
input.voltage: 118.90
output.current: 3.20
output.frequency: 60
output.voltage: 118.90
ups.delay.reboot: 0
ups.delay.shutdown: 180
ups.delay.start: 0
ups.firmware: CR01203J9O1
ups.load: 26
ups.mfr: CYBERPOWER
ups.model: PR1500LCD
ups.serial: PYTLZ2000045
ups.status:
```
</details>
Notably ups.status is blank, and querying the IDs from https://github.com/networkupstools/nut/blob/master/drivers/cyberpower-mib.c for `ups.status` I get these values, which should show up as `OL` if I understand the code correctly. That is what I see on 2.7.4.
```
SNMPv2-SMI::enterprises.3808.1.1.1.4.1.1.0 = INTEGER: 2
SNMPv2-SMI::enterprises.3808.1.1.1.2.1.1.0 = INTEGER: 2
SNMPv2-SMI::enterprises.3808.1.1.1.7.2.7.0 = NULL
SNMPv2-SMI::enterprises.3808.1.1.1.2.2.5.0 = INTEGER: 1
```
I also have a Linux machine still on 2.7.4, it interprets less data but doesn't report it as unavailable.
<details>
<summary>upsc output (2.7.4)</summary>
```
battery.runtime: 255600.00
battery.runtime.elapsed: 0.00
device.mfr: CYBERPOWER
device.model: PR1500LCD
device.serial: PYTLZ2000045
device.type: ups
driver.name: snmp-ups
driver.parameter.pollinterval: 2
driver.parameter.port: 192.168.42.127
driver.parameter.synchronous: no
driver.version: 2.7.4
driver.version.data: cyberpower MIB 0.1
driver.version.internal: 0.97
ups.firmware: CR01203J9O1
ups.mfr: CYBERPOWER
ups.model: PR1500LCD
ups.serial: PYTLZ2000045
ups.status: OL
```
</details>
There are no errors from `snmp-ups -DDDDD` and nothing that looks out of the ordinary besides the empty ups.status. Running `upsmon -DDDDD` just gives me an uninformative error. The socket is properly created at `/var/db/nut/snmp-ups-cyberpower` and is user/group readable, opening up the permissions completely doesn't change anything.
```
Network UPS Tools upsmon 2.8.0
kill: No such process
0.000133 UPS: cyberpower@localhost (secondary) (power value 1)
0.000242 Using power down flag file /etc/killpower
0.000411 [D1] debug level is '5'
0.000416 [D1] debug level is '5'
0.000856 [D1] Saving PID 13271 into /var/db/nut/upsmon.pid
0.002830 [D1] Trying to connect to UPS [cyberpower@localhost]
0.003025 UPS [cyberpower@localhost]: connect failed: Connection failure: Connection refused
0.003031 [D2] do_notify: ntype 0x0005 (COMMBAD)
0.003034 Communications with UPS cyberpower@localhost lost
0.003208 [D3] Current power value: 1
0.003213 [D3] Minimum power value: 1
```
This has been fixed in 2.8.1 and consequently all following releases, current one being 2.8.2.
Until iX update the NUT package you won’t have any luck.
https://ixsystems.atlassian.net/browse/NAS-128043
I configured my OPNsense firewall, which has 2.8.2, as the NUT master and have both my TrueNAS installations communicate with that. It works this way.
P.S. The github issue references FreeBSD but this is strictly a problem in upstream NUT. So it applies to TN CORE and SCALE all the same.
Thank You very much for that information pmh!! I will experiment some with running a NUT server on my Zabbix server and see if I can get he TrueNAS box to run secondary to that.
Thanks again for your help!