Discussion:
[Apcupsd-users] apcupsd unable to do killpower with snmp driver
Павел Мотырев
2017-01-30 07:48:27 UTC
Permalink
Hello,

As the post subject suggests, I am unable to shutdown my UPS with SNMP
module.

Issue was observed on:

OS: Ubuntu 16.10
Apcupsd version: 3.14.14 (31 May 2016)
UPS: Smart-UPS 2200
SNMP module:
MN:AP9619 HR:A10 MD:11/02/2005
AOS: 3.7.3 (02/02/2010), StatApp(name: sumx): 3.7.2 (02/02/2010)

tcpdump after "apcupsd --killpower" exec:
<...lines with getting UPS state...>
IP 192.168.1.38.57389 > 192.168.1.5.161: C=xxx SetRequest(33) .1.3.6.
1.4.1.318.1.1.1.6.1.1=2
IP 192.168.1.5.161 > 192.168.1.38.57389: C=xxx GetResponse(33) ***@1
.1.3.6.1.4.1.318.1.1.1.6.1.1=2

Main cause - OID for upsBasicControlConserveBattery is incorrect.
Correct upsBasicControlConserveBattery OID is .1.3.6.1.4.1.318.1.1.1.6.1.1.0
(additional ".0" at the end)

I have tested this OID manually with snmpset - it's working correct.
Here tcpdump of this tests with comments:
IP 192.168.1.38.59474 > 192.168.1.5.161: C=xxx SetRequest(35) .1.3.6.
1.4.1.318.1.1.1.6.1.1.0=2
IP 192.168.1.5.161 > 192.168.1.38.59474: C=xxx GetResponse(35) ***@1
.1.3.6.1.4.1.318.1.1.1.6.1.1.0=2 // it's ok. UPS not on battery power.
IP 192.168.1.5.49315 > 192.168.1.38.162: Trap(108) .1.3.6.1.4.1.318
192.168.1.5 enterpriseSpecific s=5 26777240 .1.3.6.1.4.1.318.2.3.3.0="UPS:
On battery power in response to an input power problem."
IP 192.168.1.38.35216 > 192.168.1.5.161: C=xxx SetRequest(35) .1.3.6.
1.4.1.318.1.1.1.6.1.1.0=2
IP 192.168.1.5.161 > 192.168.1.38.35216: C=xxx GetResponse(35) .1.3.6.
1.4.1.318.1.1.1.6.1.1.0=2 // UPS correctly going to sleep

Same problem with upsAdvControlUpsOff - correct OID is .1.3.6.1.4.1.318.
1.1.1.6.2.1.0 (additional ".0" at the end).

In attach - patch with trying to fixing this problem in simplest way and
output of snmp-walk from my UPS SNMP module.

Also, from power.mib you can see that some other OIDs must be changed by
adding ".0" at the end. I've fixed only 2 values, because any other OIDs
are not used to write.

Loading...