[Nut-upsdev] SNMP agent for NUT
Luiz Angelo Daros de Luca
luizluca at gmail.com
Sun Jun 10 01:06:29 UTC 2012
Hello guys,
I was some years ago when I sent something to this list.
NUT is a great tool but lacks SNMP management. It can access a device using SNMP
but I found no way to read NUT values using SNMP. It would be very
useful in order to integrate with
network management software based on SNMP. As I did not find a
solution, I wrote it myself.
I wrote a MIB file and a SNMP agent for net-snmp (pass_persist) in
order to expose the contents of upsc command to SNMP softwares. I
works simply by adding to snmpd.conf:
pass_persist .1.3.6.1.4.1.26376.99 /my/path/to/snmp.nut -f
The script and MIB files are at:
https://github.com/luizluca/nut-snmpagent
It is, for sure, not finished. I did not find a IANA enterprise
number, that is no costs to register, for NUT so I
spoofed my company one. I'm still using a fake upsc output in order to
have a more complex mix of devices.
I collected some output examples in the documentation but I might
still missed some special case.
Also, I did not extensively tested it with real hardware. Anyway, my
UPS is quite simple for that.
I got two minor doc bugs in the process. The first is that the
driver.version.data, that I found in some examples, its not listed as
a variable.
The other is the description of "power.minimum" as "Maximum seen
apparent power (VA)".
I would appreciate some feedback/help/suggestions in any part of the
solution. I'm willing to release it with any permissive license.
The agent might not fit the requirements of all users (it is written
in ruby with a lot of metaprogramming) but the MIB file
seems to be in a good shape, expect for the missing IANA number. BTW,
I'm no SNMP expert.
Regards,
PS: Just for an example, the current output that I get from a snmpwalk
is like this (for 6 devices):
NUT-MIB::deviceIndex.1 = INTEGER: 1
NUT-MIB::deviceIndex.2 = INTEGER: 2
NUT-MIB::deviceIndex.3 = INTEGER: 3
NUT-MIB::deviceIndex.4 = INTEGER: 4
NUT-MIB::deviceIndex.5 = INTEGER: 5
NUT-MIB::deviceIndex.6 = INTEGER: 6
NUT-MIB::deviceName.1 = STRING: ups2
NUT-MIB::deviceName.2 = STRING: xxx
NUT-MIB::deviceName.3 = STRING: upsoutlet
NUT-MIB::deviceName.4 = STRING: ups3p1
NUT-MIB::deviceName.5 = STRING: ups3p2
NUT-MIB::deviceName.6 = STRING: ups3
NUT-MIB::deviceDesc.1 = STRING: UPS2 10 KVA Lacerda Titan Black
tri-mono 10KVA (220v) Serial A08823221
NUT-MIB::deviceDesc.2 = STRING: Fictious
NUT-MIB::deviceDesc.3 = STRING: Example outlet
NUT-MIB::deviceDesc.4 = STRING: phases1
NUT-MIB::deviceDesc.5 = STRING: phases2
NUT-MIB::deviceDesc.6 = STRING: test3
NUT-MIB::deviceModel.1 = STRING: Titan Black tri-mono 10KVA
NUT-MIB::deviceModel.2 = STRING: Titan Black tri-mono 10KVA
NUT-MIB::deviceModel.6 = STRING: Ellipse MAX 1100
NUT-MIB::deviceMfr.1 = STRING: Lacerda Sistemas de Energia
NUT-MIB::deviceMfr.2 = STRING: Lacerda Sistemas de Energia
NUT-MIB::deviceMfr.6 = STRING: EATON
NUT-MIB::deviceSerial.1 = STRING: A08823221
NUT-MIB::deviceSerial.2 = STRING: A08823221
NUT-MIB::deviceSerial.6 = STRING: ADKK22008
NUT-MIB::deviceType.1 = STRING: ups
NUT-MIB::deviceType.2 = STRING: ups
NUT-MIB::deviceType.6 = STRING: ups
NUT-MIB::upsStatus.1 = STRING: OL
NUT-MIB::upsStatus.2 = STRING: OL
NUT-MIB::upsStatus.6 = STRING: OL CHRG
NUT-MIB::upsModel.6 = STRING: Ellipse MAX 1100
NUT-MIB::upsMfr.6 = STRING: EATON
NUT-MIB::upsSerial.6 = STRING: ADKK22008
NUT-MIB::upsVendorid.6 = STRING: 0463
NUT-MIB::upsProductid.6 = STRING: ffff
NUT-MIB::upsFirmware.6 = STRING: 5102AH
NUT-MIB::upsTemperature.1 = INTEGER: 47.0
NUT-MIB::upsTemperature.2 = INTEGER: 47.0
NUT-MIB::upsLoad.1 = INTEGER: 43
NUT-MIB::upsLoad.2 = INTEGER: 43
NUT-MIB::upsLoad.6 = INTEGER: 0
NUT-MIB::upsDelayStart.1 = INTEGER: 180
NUT-MIB::upsDelayStart.2 = INTEGER: 180
NUT-MIB::upsDelayStart.6 = INTEGER: 30
NUT-MIB::upsDelayShutdown.1 = INTEGER: 30
NUT-MIB::upsDelayShutdown.2 = INTEGER: 30
NUT-MIB::upsDelayShutdown.6 = INTEGER: 20
NUT-MIB::upsTimerStart.6 = INTEGER: -1
NUT-MIB::upsTimerShutdown.6 = INTEGER: -1
NUT-MIB::upsPowerNominal.6 = INTEGER: 1100
NUT-MIB::upsBeeperStatus.6 = STRING: enabled
NUT-MIB::upsType.1 = STRING: online
NUT-MIB::upsType.2 = STRING: online
NUT-MIB::inputVoltage.1 = INTEGER: 215.0
NUT-MIB::inputVoltage.2 = INTEGER: 215.0
NUT-MIB::inputVoltageNominal.1 = INTEGER: 220.0
NUT-MIB::inputVoltageNominal.2 = INTEGER: 220.0
NUT-MIB::inputVoltageExtended.6 = INTEGER: no(0)
NUT-MIB::inputTransferLow.6 = INTEGER: 165
NUT-MIB::inputTransferHigh.6 = INTEGER: 285
NUT-MIB::inputSensitivity.6 = STRING: normal
NUT-MIB::inputCurrentNominal.1 = INTEGER: 27.00
NUT-MIB::inputCurrentNominal.2 = INTEGER: 27.00
NUT-MIB::inputFrequency.1 = INTEGER: 60.0
NUT-MIB::inputFrequency.2 = INTEGER: 60.0
NUT-MIB::inputFrequency.4 = INTEGER: 50.0
NUT-MIB::inputFrequency.5 = INTEGER: 50.1
NUT-MIB::inputFrequencyNominal.1 = INTEGER: 60.0
NUT-MIB::inputFrequencyNominal.2 = INTEGER: 60.0
NUT-MIB::inputTransferBoostLow.6 = INTEGER: 185
NUT-MIB::inputTransferTrimHigh.6 = INTEGER: 265
NUT-MIB::inputPhases.4 = INTEGER: 3
NUT-MIB::inputPhases.5 = INTEGER: 3
NUT-MIB::outputVoltage.1 = INTEGER: 221.0
NUT-MIB::outputVoltage.2 = INTEGER: 221.0
NUT-MIB::outputVoltage.5 = INTEGER: 120.0
NUT-MIB::outputVoltage.6 = INTEGER: 230.0
NUT-MIB::outputVoltageNominal.6 = INTEGER: 230.0
NUT-MIB::outputFrequencyNominal.5 = INTEGER: 60.0
NUT-MIB::outputFrequencyNominal.6 = INTEGER: 50.0
NUT-MIB::outputCurrent.5 = INTEGER: 244.20
NUT-MIB::outputPhases.4 = INTEGER: 3
NUT-MIB::outputPhases.5 = INTEGER: 1
NUT-MIB::batteryCharge.1 = INTEGER: 100.0
NUT-MIB::batteryCharge.2 = INTEGER: 30.0
NUT-MIB::batteryCharge.6 = INTEGER: 100.0
NUT-MIB::batteryChargeLow.6 = INTEGER: 20.0
NUT-MIB::batteryVoltage.1 = INTEGER: 274.60
NUT-MIB::batteryVoltage.2 = INTEGER: 273.60
NUT-MIB::batteryVoltageNominal.1 = INTEGER: 240.00
NUT-MIB::batteryVoltageNominal.2 = INTEGER: 240.00
NUT-MIB::batteryRuntime.6 = INTEGER: 2525
NUT-MIB::batteryType.6 = STRING: PbAc
NUT-MIB::outletIndex.3.0 = INTEGER: 0
NUT-MIB::outletIndex.3.1 = INTEGER: 1
NUT-MIB::outletIndex.3.2 = INTEGER: 2
NUT-MIB::outletIndex.6.0 = INTEGER: 0
NUT-MIB::outletIndex.6.1 = INTEGER: 1
NUT-MIB::outletId.3.0 = STRING: 0
NUT-MIB::outletId.3.1 = STRING: 1
NUT-MIB::outletId.3.2 = STRING: 2
NUT-MIB::outletId.6.0 = STRING: 1
NUT-MIB::outletId.6.1 = STRING: 2
NUT-MIB::outletDesc.3.0 = STRING: Main Outlet
NUT-MIB::outletDesc.3.1 = STRING: PowerShare Outlet 1
NUT-MIB::outletDesc.3.2 = STRING: PowerShare Outlet 2
NUT-MIB::outletDesc.6.0 = STRING: Main Outlet
NUT-MIB::outletDesc.6.1 = STRING: PowerShare Outlet 1
NUT-MIB::outletSwitch.3.1 = INTEGER: on(1)
NUT-MIB::outletSwitch.3.2 = INTEGER: on(1)
NUT-MIB::outletStatus.6.1 = INTEGER: on(1)
NUT-MIB::outletSwitchable.3.0 = INTEGER: yes(1)
NUT-MIB::outletSwitchable.3.1 = INTEGER: yes(1)
NUT-MIB::outletSwitchable.3.2 = INTEGER: yes(1)
NUT-MIB::outletSwitchable.6.0 = INTEGER: no(0)
NUT-MIB::outletSwitchable.6.1 = INTEGER: no(0)
NUT-MIB::outletAutoswitchChargeLow.3.1 = INTEGER: 0
NUT-MIB::outletAutoswitchChargeLow.3.2 = INTEGER: 0
NUT-MIB::outletDelayShutdown.3.1 = INTEGER: -1
NUT-MIB::outletDelayShutdown.3.2 = INTEGER: -1
NUT-MIB::outletDelayStart.3.1 = INTEGER: -1
NUT-MIB::outletDelayStart.3.2 = INTEGER: -1
NUT-MIB::driverName.1 = STRING: blazer_ser
NUT-MIB::driverName.2 = STRING: blazer_ser
NUT-MIB::driverName.6 = STRING: usbhid-ups
NUT-MIB::driverVersion.1 = STRING: 2.6.2
NUT-MIB::driverVersion.2 = STRING: 2.6.2
NUT-MIB::driverVersion.6 = STRING: 2.4.1-1988:1990M
NUT-MIB::driverVersionInternal.1 = STRING: 1.51
NUT-MIB::driverVersionInternal.2 = STRING: 1.51
NUT-MIB::driverVersionInternal.6 = STRING: 0.34
NUT-MIB::serverInfo = STRING: serverinfo example
NUT-MIB::serverVersion = STRING: test server version
NUT-MIB::threephaseDomain.4.input.mains.none = INTEGER: input(1)
NUT-MIB::threephaseDomain.4.input.mains.l1 = INTEGER: input(1)
NUT-MIB::threephaseDomain.4.input.bypass.l1l2 = INTEGER: input(1)
NUT-MIB::threephaseDomain.4.output.load.none = INTEGER: output(2)
NUT-MIB::threephaseDomain.4.output.load.l1 = INTEGER: output(2)
NUT-MIB::threephaseDomain.5.input.mains.none = INTEGER: input(1)
NUT-MIB::threephaseDomain.5.input.mains.n = INTEGER: input(1)
NUT-MIB::threephaseDomain.5.input.mains.l2 = INTEGER: input(1)
NUT-MIB::threephaseDomain.5.input.mains.l3l1 = INTEGER: input(1)
NUT-MIB::threephaseDomain.5.output.load.none = INTEGER: output(2)
NUT-MIB::threephaseSubdomain.4.input.mains.none = INTEGER: mains(1)
NUT-MIB::threephaseSubdomain.4.input.mains.l1 = INTEGER: mains(1)
NUT-MIB::threephaseSubdomain.4.input.bypass.l1l2 = INTEGER: bypass(2)
NUT-MIB::threephaseSubdomain.4.output.load.none = INTEGER: load(4)
NUT-MIB::threephaseSubdomain.4.output.load.l1 = INTEGER: load(4)
NUT-MIB::threephaseSubdomain.5.input.mains.none = INTEGER: mains(1)
NUT-MIB::threephaseSubdomain.5.input.mains.n = INTEGER: mains(1)
NUT-MIB::threephaseSubdomain.5.input.mains.l2 = INTEGER: mains(1)
NUT-MIB::threephaseSubdomain.5.input.mains.l3l1 = INTEGER: mains(1)
NUT-MIB::threephaseSubdomain.5.output.load.none = INTEGER: load(4)
NUT-MIB::threephaseContext.4.input.mains.none = INTEGER: none(0)
NUT-MIB::threephaseContext.4.input.mains.l1 = INTEGER: l1(2)
NUT-MIB::threephaseContext.4.input.bypass.l1l2 = INTEGER: l1l2(8)
NUT-MIB::threephaseContext.4.output.load.none = INTEGER: none(0)
NUT-MIB::threephaseContext.4.output.load.l1 = INTEGER: l1(2)
NUT-MIB::threephaseContext.5.input.mains.none = INTEGER: none(0)
NUT-MIB::threephaseContext.5.input.mains.n = INTEGER: n(1)
NUT-MIB::threephaseContext.5.input.mains.l2 = INTEGER: l2(3)
NUT-MIB::threephaseContext.5.input.mains.l3l1 = INTEGER: l3l1(10)
NUT-MIB::threephaseContext.5.output.load.none = INTEGER: none(0)
NUT-MIB::threephaseCurrent.4.input.mains.l1 = INTEGER: 133.00
NUT-MIB::threephaseCurrent.5.input.mains.n = INTEGER: 3.40
NUT-MIB::threephaseCurrent.5.input.mains.l2 = INTEGER: 48.20
NUT-MIB::threephaseCurrent.5.output.load.none = INTEGER: 244.20
NUT-MIB::threephaseVoltage.4.input.bypass.l1l2 = INTEGER: 398.3
NUT-MIB::threephaseVoltage.5.input.mains.l3l1 = INTEGER: 405.4
NUT-MIB::threephaseVoltage.5.output.load.none = INTEGER: 120.0
NUT-MIB::threephasePower.4.output.load.l1 = INTEGER: 35700
NUT-MIB::threephasePowerfactor.4.output.load.none = INTEGER: .82
NUT-MIB::threephaseFrequency.4.input.mains.none = INTEGER: 50.0
NUT-MIB::threephaseFrequency.5.input.mains.none = INTEGER: 50.1
NUT-MIB::threephaseFrequencyNominal.5.output.load.none = INTEGER: 60.0
---
Luiz Angelo Daros de Luca, Me.
luizluca at gmail.com
More information about the Nut-upsdev
mailing list