I have a Windows Server 2003 machine with SNMP turned on. I want to be able to query the battery level of the server since it is connected to an APC UPS through a USB cable.
So far I can do:
snmpwalk -Os -c public -v 1 192.168.128.2 1.3.6.1.4.1.318
And get:
enterprises.318.1.1.1.4.1.1.0 = INTEGER: 1
enterprises.318.1.2.1.1.1.0 = STRING: "PowerChute Business Edition Agent, (C) 2001 APC."
However I'm nowhere near getting an actual OID that has the percentage of battery remaining. Any ideas?
You can get better information from WMI. The Win32_Battery class should get you what you need.
I recommend downloading scriptomatic2 from Microsoft to see what that class provides and some starter code to get you going. (For best results, copy the Scriptomatic executable to that machine and run it from there so that it can read the system's CIM namespace.)
The OID is: .1.3.6.1.4.1.318.1.1.1.2.2.1.0
Furthermore, to get the value in bash so you can use it within a script do: