Counter window No. 4
SNMP command builder
Fill in the form and the builder writes three Net-SNMP commands for the standard UPS MIB (RFC 1628): a full walk, a battery walk and a five-value get. The commands are built in your browser. Nothing you type is sent anywhere, and the page makes no SNMP request. Do not type a real passphrase or community string into this page: the commands show clearly marked placeholders (COMMUNITY, AUTH_PASSPHRASE, PRIV_PASSPHRASE) that you replace in your own terminal.
Delivered copy
Your commands
How the commands are built
Each line follows the Net-SNMP command pattern: the tool name, the version and credential options, the agent, then the object identifiers (OIDs).
Example commands, using the documentation address 192.0.2.20 (RFC 5737). Capitalised words are placeholders: replace them in your own terminal, never on this page.
snmpwalk -v 2c -c 'COMMUNITY' udp:192.0.2.20:161 1.3.6.1.2.1.33
snmpwalk -v 3 -l authPriv -u 'USER' -a SHA -A 'AUTH_PASSPHRASE' -x AES -X 'PRIV_PASSPHRASE' udp:192.0.2.20:161 1.3.6.1.2.1.33 - Agent. The transport and port are always written out, so a client's
snmp.confcannot change them (snmp.conf manual). An IPv4 address or host name becomesudp:host:port. An IPv6 address becomes'udp6:[address]:port'. The port box is required and starts at 161, the registered SNMP port. IPv6 text forms follow RFC 4291 section 2.2, checked locally in your browser. - Quoting. For POSIX-style shells, the user name is wrapped in single quotes, with any single quote inside it written as
'\'', so the shell reads it as one word. The IPv6 agent is quoted too, because some shells treat square brackets as a file pattern. The placeholders are quoted the same way; keep the quotes when you replace them. - Security levels.
noAuthNoPrivsends only the user name,authNoPrivadds-aand-A, andauthPrivalso adds-xand-X. - Protocols. The builder offers only the protocols the Net-SNMP
snmpcmdmanual lists: MD5 or SHA for-a, and DES or AES for-x. Newer Net-SNMP releases and some cards support more; checkman snmpcmdon your system and your card's documentation.
What the get command asks for
The UPS MIB lives under 1.3.6.1.2.1.33. Single values end in .0 (RFC 2578 section 7). The battery group is 1.3.6.1.2.1.33.1.2. Meanings and units below are from RFC 1628.
| Object | OID | What the value means |
|---|---|---|
upsIdentModel | 1.3.6.1.2.1.33.1.1.2.0 | Text: the UPS model name |
upsBatteryStatus | 1.3.6.1.2.1.33.1.2.1.0 | 1 unknown, 2 batteryNormal, 3 batteryLow, 4 batteryDepleted |
upsEstimatedMinutesRemaining | 1.3.6.1.2.1.33.1.2.3.0 | Minutes, an estimate at the present load |
upsEstimatedChargeRemaining | 1.3.6.1.2.1.33.1.2.4.0 | Percent of full charge, an estimate |
upsOutputSource | 1.3.6.1.2.1.33.1.4.1.0 | 1 other, 2 none, 3 normal, 4 bypass, 5 battery, 6 booster, 7 reducer |
The battery walk also returns upsSecondsOnBattery (1.3.6.1.2.1.33.1.2.2.0), the seconds on battery, which is zero when the UPS is not on battery. RFC 1628 caps it at the time since the management subsystem last restarted, so it can read lower than the real time on battery.
Assumptions and limits
- The commands only work if your card implements these RFC 1628 objects, and if your Net-SNMP client and the card both support the version, transport and protocol options you pick. Newer Net-SNMP releases support more options than the manual pages cited here list; check
man snmpcmdon your system. - Not every card answers the standard UPS MIB, and many cards also have a maker's own MIB. If the walk returns nothing under
1.3.6.1.2.1.33, check the card's SNMP settings and its documentation for RFC 1628 support. - Net-SNMP needs SNMPv3 passphrases of at least 8 characters (snmpusm manual). The builder cannot check that, because you never type the passphrase here.
- Ports run from 1 to 65535: port numbers are 16-bit values (RFC 6335), and port 0 is reserved in the IANA registry. SNMP agents are registered on UDP 161 and trap receivers such as snmptrapd on UDP 162.
- Passphrases typed on a command line can end up in your shell history. The Net-SNMP manual calls passing pass phrases on the command line insecure and points to
snmp.confinstead. - Values such as minutes remaining are the card's own estimates, not measurements made by this site.
- The printable ASCII rule and the 255-character cap on the user name and address are this builder's own rules, not limits from the standards.
Sources
- RFC 1628: UPS Management Information Base IETF, RFC Editor
- snmpcmd - options and behaviour common to most of the Net-SNMP command-line tools Net-SNMP manual pages
- snmpwalk - retrieve a subtree of management values using SNMP GETNEXT requests Net-SNMP manual pages
- snmpget - communicates with a network entity using SNMP GET requests Net-SNMP manual pages
- snmpusm - creates and maintains SNMPv3 users on a network entity Net-SNMP manual pages
- RFC 5737: IPv4 Address Blocks Reserved for Documentation IETF, RFC Editor
- RFC 4291: IP Version 6 Addressing Architecture, section 2.2 IETF, RFC Editor
- RFC 2578: Structure of Management Information Version 2 (SMIv2), section 7 IETF, RFC Editor
- RFC 6335: Internet Assigned Numbers Authority (IANA) Procedures for the Management of the Service Name and Transport Protocol Port Number Registry IETF, RFC Editor
- Service Name and Transport Protocol Port Number Registry IANA
- snmp.conf - configuration files for the Net-SNMP applications Net-SNMP manual pages
- snmptrapd - Receive and log SNMP trap messages. Net-SNMP manual pages