This is the multi-page printable view of this section.
Click here to print.
Return to the regular view of this page.
SNMP
SNMP is a protocol that’s almost always used to monitor things. Usually metrics. Though it can be used as a management interface as well.
Every time I use it I imagine a conclave of exports, meeting together and sequestering themselves for a year, then coming out of a back room and proclaiming “Here it is, the perfect protocol for doing everything”.
And it’s completely different than anything else. The one true faith protocol.
1 - Eaton UPS
Eaton offers network management cards for many of their UPS lines that provide a web management console and SNMP server. The “Eaton Gigabit Network Card (NETWORK-M2)” is the offering at time of writing.
For SNMP, this card implements the RFC 1628 UPS standard as well as an Eaton specific set of objects starting at 1.3.6.1.4.1.534.
snmpwalk -v1 -c public your.ups.address
snmpwalk -v1 -c public your.ups.address 1.3.6.1.4.1.534
To make sense of these you need the Eaton MIBs. If you download and extract to your working folder you can query like this.
snmpwalk -v1 -c public -m +./EATON-OIDS.txt:./EATON-EMP-MIB.txt:./XUPS-MIB.txt your.ups.address 1.3.6.1.4.1.534
Some useful MIBs are:
|
|
| sysLocation |
Physical location for the device being monitored |
| xupsInputVoltage |
The measured input voltage from the UPS meters in volts |
| xupsOutputSource |
The present source of output power |
| xupsBatVoltage |
Battery voltage as reported by the UPS meters |
| xupsInputFrequency |
The utility line frequency in tenths of Hz |
| xupsOutputWatts |
The measured real output power in watts |
| xupsEnvAmbientTemp |
The reading of the ambient temperature in the vicinity |
You’d query these like so:
snmpget -v1 -c public -m +./EATON-OIDS.txt:./EATON-EMP-MIB.txt:./XUPS-MIB.txt your.ups.address \
sysLocation.0 xupsInputVoltage.1 xupsOutputSource.0 xupsBatVoltage.0 xupsInputFrequency.0 xupsOutputWatts.1 xupsEnvAmbientTemp.0
Some objects need a .0 here and others a .1 as shown above.
Notes
The object xupsOutputSource is generally used to determine if the UPS is ‘on battery’. There is a trap specifically for OnBattery, but you can’t query the traps.
xupsOutputSource OBJECT-TYPE
SYNTAX INTEGER {
other(1),
none(2),
normal(3),
bypass(4),
battery(5),
booster(6),
reducer(7),
parallelCapacity(8),
parallelRedundant(9),
highEfficiencyMode(10),
maintenanceBypass(11),
essMode(12)
}
Troubleshooting
There is no such variable name in this MIB
You might need to “walk” the object to get the instance ID as .0 is only for scalar objects, and not tabular.
snmpget -v1 -c public -m +./EATON-OIDS.txt:./EATON-EMP-MIB.txt:./XUPS-MIB.txt your.ups.address xupsInputVoltage.0
Error in packet
Reason: (noSuchName) There is no such variable name in this MIB.
Failed object: XUPS-MIB::xupsInputVoltage.0
snmpwalk -v1 -c public -m +./EATON-OIDS.txt:./EATON-EMP-MIB.txt:./XUPS-MIB.txt your.ups.address xupsInputVoltage
XUPS-MIB::xupsInputVoltage.1 = INTEGER: 116 RMS Volts
snmpget -v1 -c public -m +./EATON-OIDS.txt:./EATON-EMP-MIB.txt:./XUPS-MIB.txt your.ups.address xupsInputVoltage.1
XUPS-MIB::xupsInputVoltage.1 = INTEGER: 116 RMS Volts
Resources
2 - Samlex UPS
Samlex makes a line of rack-mount inverters with a web management console and respond to SNMP requests. Their PSR-1200-24 and -48 models. They supply the MIB on an included USB thumb drive. If you lose it you may never find it again on the web. Here’s a copy just in case.
Download
If you probe them without the MIB or knowing their enterprise OID, you don’t get much back.
snmpwalk -v2c -c public your.samlex.ip
However, you can probe the enterprise section and you’ll see they have thier own section with some 64 values and traps.
snmpwalk -v2c -c public your.samlex.ip 1.3.6.1.4.1
To make sense of these, you’ll need that MIB file from above.
snmpwalk -v2c -c public -m ./SAMLEXAMERICA-MIB.txt your.samlex.ip 1.3.6.1.4.1
The most useful values are probably the ones that tell you:
- which system is this (sysLocation)
- are you on battery or grid right now (inverterMode)
- what is your battery voltage (vin)
- what is your grid voltage (gridvout)
- how much power you’re putting out (power)
- what your temps are (tempDD tempDA)
You can pull those in a loop like so
while read X;do
snmpget -v2c -m +./SAMLEXAMERICA-MIB.TXT -c public $X \
sysLocation.0 inverterMode.0 vin.0 gridvout.0 power.0 tempDD.0 tempDA.0
echo
done < file_of_device_IPs
You can also pull this into Prometheus
https://samlexamerica.com/wp-content/uploads/2021/08/11001-PSR-1200-24-48-0821_Lrez.pdf