1 # Net-SNMP module for apcupsd
3 This is Net-SNMP module for monitoring APC UPSes without SNMP support. It reads
4 output from apcupsd (/sbin/apcaccess) and writes it into appropriate OIDs like
5 UPSes with built-in SNMP support.
8 https://github.com/jirutka/apcupsd-snmp
9 https://github.com/Hackit2me/apcupsd-snmp
13 To load this into a running agent with embedded Perl support turned on, simply
14 put the following line to your snmpd.conf file:
16 perl do "/path/to/mod_apcupsd.pl";
18 Net-snmp must be compiled with Perl support and apcupsd properly configured
24 Try `snmpwalk -v 2c -c public <host> .1.3.6.1.4.1.318.1.1.1` and you should
27 $ snmpwalk -v 2c -c public localhost .1.3.6.1.4.1.318.1.1.1
28 PowerNet-MIB::upsBasicIdentModel.0 = STRING: "Back-UPS RS 500"
29 PowerNet-MIB::upsBasicIdentName.0 = STRING: "grid"
30 PowerNet-MIB::upsAdvIdentFirmwareRevision.0 = STRING: "30.j2.I USB FW:j2"
31 PowerNet-MIB::upsAdvIdentSerialNumber.0 = STRING: "BB0314005xxx"
32 PowerNet-MIB::upsBasicBatteryTimeOnBattery.0 = Timeticks: (0) 0:00:00.00
33 PowerNet-MIB::upsBasicBatteryLastReplaceDate.0 = STRING: "2009-02-26"
34 PowerNet-MIB::upsAdvBatteryCapacity.0 = Gauge32: 100
35 PowerNet-MIB::upsAdvBatteryTemperature.0 = Gauge32: 29
36 PowerNet-MIB::upsAdvBatteryRunTimeRemaining.0 = Timeticks: (190200) 0:31:42.00
37 PowerNet-MIB::upsAdvBatteryNominalVoltage.0 = INTEGER: 12
38 PowerNet-MIB::upsAdvBatteryActualVoltage.0 = INTEGER: 13
39 PowerNet-MIB::upsAdvInputLineVoltage.0 = Gauge32: 228
40 PowerNet-MIB::upsAdvInputFrequency.0 = Gauge32: 49
41 PowerNet-MIB::upsAdvInputLineFailCause.0 = INTEGER: blackout(4)
42 PowerNet-MIB::upsAdvOutputVoltage.0 = Gauge32: 230
43 PowerNet-MIB::upsAdvOutputLoad.0 = Gauge32: 22
44 PowerNet-MIB::upsAdvConfigRatedOutputVoltage.0 = INTEGER: 230
45 PowerNet-MIB::upsAdvConfigHighTransferVolt.0 = INTEGER: 254
46 PowerNet-MIB::upsAdvConfigLowTransferVolt.0 = INTEGER: 198
47 PowerNet-MIB::upsAdvConfigAlarm.0 = INTEGER: atLowBattery(2)
48 PowerNet-MIB::upsAdvConfigMinReturnCapacity.0 = INTEGER: 0
49 PowerNet-MIB::upsAdvConfigSensitivity.0 = INTEGER: high(4)
50 PowerNet-MIB::upsAdvConfigLowBatteryRunTime.0 = Timeticks: (24000) 0:04:00.00
51 PowerNet-MIB::upsAdvConfigReturnDelay.0 = Timeticks: (0) 0:00:00.00
52 PowerNet-MIB::upsAdvConfigShutoffDelay.0 = Timeticks: (0) 0:00:00.00
53 PowerNet-MIB::upsAdvTestDiagnosticSchedule.0 = INTEGER: unknown(1)
54 PowerNet-MIB::upsAdvTestDiagnosticsResults.0 = INTEGER: 0
56 or if you like numeric OIDs:
58 snmpwalk -v 2c -c public -On localhost .1.3.6.1.4.1.318.1.1.1
59 .1.3.6.1.4.1.318.1.1.1.1.1.1.0 = STRING: "Back-UPS RS 500"
60 .1.3.6.1.4.1.318.1.1.1.1.1.2.0 = STRING: "grid"
61 .1.3.6.1.4.1.318.1.1.1.1.2.1.0 = STRING: "30.j2.I USB FW:j2"
62 .1.3.6.1.4.1.318.1.1.1.1.2.3.0 = STRING: "BB0314005xxx"
63 .1.3.6.1.4.1.318.1.1.1.2.1.2.0 = Timeticks: (0) 0:00:00.00
64 .1.3.6.1.4.1.318.1.1.1.2.1.3.0 = STRING: "2009-02-26"
65 .1.3.6.1.4.1.318.1.1.1.2.2.1.0 = Gauge32: 100
66 .1.3.6.1.4.1.318.1.1.1.2.2.2.0 = Gauge32: 29
67 .1.3.6.1.4.1.318.1.1.1.2.2.3.0 = Timeticks: (184800) 0:30:48.00
68 .1.3.6.1.4.1.318.1.1.1.2.2.7.0 = INTEGER: 12
69 .1.3.6.1.4.1.318.1.1.1.2.2.8.0 = INTEGER: 13
70 .1.3.6.1.4.1.318.1.1.1.3.2.1.0 = Gauge32: 228
71 .1.3.6.1.4.1.318.1.1.1.3.2.4.0 = Gauge32: 49
72 .1.3.6.1.4.1.318.1.1.1.3.2.5.0 = INTEGER: blackout(4)
73 .1.3.6.1.4.1.318.1.1.1.4.2.1.0 = Gauge32: 230
74 .1.3.6.1.4.1.318.1.1.1.4.2.3.0 = Gauge32: 21
75 .1.3.6.1.4.1.318.1.1.1.5.2.1.0 = INTEGER: 230
76 .1.3.6.1.4.1.318.1.1.1.5.2.2.0 = INTEGER: 254
77 .1.3.6.1.4.1.318.1.1.1.5.2.3.0 = INTEGER: 198
78 .1.3.6.1.4.1.318.1.1.1.5.2.4.0 = INTEGER: atLowBattery(2)
79 .1.3.6.1.4.1.318.1.1.1.5.2.6.0 = INTEGER: 0
80 .1.3.6.1.4.1.318.1.1.1.5.2.7.0 = INTEGER: high(4)
81 .1.3.6.1.4.1.318.1.1.1.5.2.8.0 = Timeticks: (24000) 0:04:00.00
82 .1.3.6.1.4.1.318.1.1.1.5.2.9.0 = Timeticks: (0) 0:00:00.00
83 .1.3.6.1.4.1.318.1.1.1.5.2.10.0 = Timeticks: (0) 0:00:00.00
84 .1.3.6.1.4.1.318.1.1.1.7.2.1.0 = INTEGER: unknown(1)
85 .1.3.6.1.4.1.318.1.1.1.7.2.3.0 = INTEGER: 0
87 You can also query only one OID:
89 $ snmpwalk -v 2c -c public grid .1.3.6.1.4.1.318.1.1.1.2.2.3.0
90 PowerNet-MIB::upsAdvBatteryRunTimeRemaining.0 = Timeticks: (190200) 0:31:42.00
93 ## What can be improved
95 * Reimplement snmp_handler to correctly support walking through subtrees of
96 .1.3.6.1.4.1.318.1.1.1 (e.g. .1.3.6.1.4.1.318.1.1.1.2). Currently it can
97 list subtrees only on .1.3.6.1.4.1.318.1.1.1 and leafs.
99 * Add remaining OIDs that apcupsd could get data for. I included only OIDs for
100 my APC Back-UP RS 500.
102 * Implement support for setting values and traps.
104 *Feel free to contribute!* I have no intention in future development.
109 * Download PowerNet (APC) MIB file:
110 [powernet401.mib](http://www.michaelfmcnamara.com/files/mibs/powernet401.mib).
112 * I'm not skilled Perl programmer, this is my first Perl script I ever wrote.
113 So if you find something weird in it, please let me know about it and fix it.
114 However it's working perfectly fine for me, so I hope it's ok.