× NETGEAR will be terminating ReadyCLOUD service by July 1st, 2023. For more details click here.
Orbi WiFi 7 RBE973
Reply

HOWTO | Monitor the attached UPS via SNMP

MacManiak
Aspirant

HOWTO | Monitor the attached UPS via SNMP

Hello.

I've done a little (and really simple) modification on my ReadyNAS Pro 6.

I've created a script called "/usr/local/bin/testups.sh" :
#!/bin/bash

RESULT=`/bin/upsc ups@localhost:3493 | grep $1 | awk '{print $2}'`

echo -e $RESULT

I've executed a chmod to set it as executable :
Lusankya:~# chmod +x /usr/local/bin/testups.sh
Lusankya:~#

Then, I've added these lines into the "/etc/snmp/snmpd.conf" :
extend battery.charge /usr/local/bin/testups.sh charge
extend battery.voltage /usr/local/bin/testups.sh voltage
extend battery.runtime /usr/local/bin/testups.sh runtime
extend ups.mfr /usr/local/bin/testups.sh mfr
extend ups.model /usr/local/bin/testups.sh model
extend ups.serial /usr/local/bin/testups.sh serial
extend ups.status /usr/local/bin/testups.sh status

The last step was to restart the SNMP service.

And now, with Cacti, I can graph the time left (seconds) and the battery level (percent).

Here's a sample of the output generated by a snmpwalk request :
[14:15:42] root@MacMini:2 ~ $ snmpwalk -c public -v 2c lusankya nsExtendOutput1Line
NET-SNMP-EXTEND-MIB::nsExtendOutput1Line."ups.mfr" = STRING: EATON
NET-SNMP-EXTEND-MIB::nsExtendOutput1Line."ups.model" = STRING: Protection
NET-SNMP-EXTEND-MIB::nsExtendOutput1Line."ups.serial" = STRING: xxxxxxxxx
NET-SNMP-EXTEND-MIB::nsExtendOutput1Line."ups.status" = STRING: OL
NET-SNMP-EXTEND-MIB::nsExtendOutput1Line."battery.charge" = STRING: 100
NET-SNMP-EXTEND-MIB::nsExtendOutput1Line."battery.runtime" = STRING: 1129
NET-SNMP-EXTEND-MIB::nsExtendOutput1Line."battery.voltage" = STRING: 2.3
[14:15:57] root@MacMini:2 ~ $


Enjoy! 😎
Message 1 of 1
Top Contributors
Discussion stats
  • 0 replies
  • 4121 views
  • 0 kudos
  • 1 in conversation
Announcements