SNMP Data Query with snmpget and snmpwalk

From Thomas-Krenn-Wiki
Jump to navigation Jump to search

A typical query with "snmpget" might look like this (in this, requesting the OID for the BalanceNG version):

    snmpget -v1 -c public tklb1 .1.3.6.1.4.1.2771.1.1

Querying (and outputting) the entire BalanaceNG 2.x management information base (MIB) might be performed as follows:

    snmpwalk -v1 -c public tklb1 .1.3.6.1.4.1.2771.1

The BALANCENG-MIB.txt file can be copied into the /usr/share/snmp/mibs directory on the client. The following environment is used to inform local tools like snmpget and snmpwalk) where to find the BalanceNG MIB:

    export MIBS=+BALANCENG-MIB

The following output clarifies the difference:

    $ snmpget -v1 -c public tklb1 .1.3.6.1.4.1.2771.1.1
    SNMPv2-SMI::enterprises.2771.1.1 = STRING: "2.228"
    $ export MIBS=+BALANCENG-MIB
    $ snmpget -v1 -c public tklb1 .1.3.6.1.4.1.2771.1.1
    BALANCENG-MIB::Release = STRING: "2.228"

The following command makes this setting permanent for the current user:

    $ echo "mibs +MY-MIB" >> $HOME/.snmp/snmp.conf

Additional information can be found in the BalanceNG FAQ, http://www.inlab.de/balanceng/faq.html#Q2.21 (in English), as well as Chapter 4 of the BalanceNG manual (http://www.inlab.de/balanceng/BalanceNGManual-CURRENT-2.pdf).