doc:kb:snmp

Quick SNMP commands

snmpget -v2c -c <communtiy> <host> <OID>
snmpwalk -v2c -c <communtiy> <host> <OID>

You can get some more beaatiful info for a Table:

snmptable -v2c -c <communtiy> <host> <OID>

The common options of the SNMP query commands are documented on snmpcmd man page

As OIDs are hard to remember and some command output is easy to understand, may be you have to make sure that snmp loads additional vendor MIBs.

For that is best to keep vendor MIBs in a separate directory, i.e. /usr/local/lib/snmp/mibs and add it to the configuration:

# /etc/snmp/snmp.conf
mibDirs +/usr/local/lib/snmp/mibs/
mibs ALL
showMibErrors yes

In some setups the provided MIBs can have many errors, you can disable last line to not show them. Many of the errors are due the fact that some MIB files are directly imported as the origin RFC as plain text, so its syntax doesn't match the SMI one.

You can 'strip' (extract) the SMI (MIB definition from them) using [man>smistip|smistrip]]

With MIBs loaded you can translate back and forward the OID → name mapping using snmptranslate:

snmptranslate -On <objectName>
snmptranslate -Os <OID>

With the same tool you can display the entire tree:

snmptranslate -On -Tp -IR <OID>
  • doc/kb/snmp.txt
  • Last modified: 2021/06/10 21:45
  • by 127.0.0.1