Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

And get:

enterprises.318. = INTEGER: 1
enterprises.318. = 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?

share|improve this question

migrated from Aug 19 '11 at 23:33

This question came from our site for computer enthusiasts and power users.

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.)

share|improve this answer
These answer sound interesting. But since im doing the query from linux it would be harder to use Windows Management Instrumentation protocol. – JorgeO Aug 22 '11 at 15:38
Brutal... Yes, that would be a problem. You can do this from Perl/Python/Ruby, but you may need some black-magic to get it going. (In perl, you want Win32::OLE) – gWaldo Aug 22 '11 at 16:31
up vote 1 down vote accepted

The OID is: .
Furthermore, to get the value in bash so you can use it within a script do:

# snmp query that returns battery level
BATTERY=`snmpwalk -Os -c public -v 1 . | sed 's/.*: //g'`
# snmp query that returns input voltage
INPUT_VOLTAGE=`snmpwalk -Os -c public -v 1 . | sed 's/.*: //g'`
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.