Snmpwalk Command Line Examples – POFTUT

Snmpwalk Command Line Examples

SNMP protocol provides useful features to monitor and configure network and server systems remotely. Monitoring features are much popular than configuration. snmpwalk is a function provided by SNMP protocol to get metrics of remote system in bulk.

Get All OIDS

We will first look the simplest usage of the snmpwalk command. We just provide minimum options to the snmpwalk. We will provide following options as minimum

  • `-v 2c` version information 2 community
  • `-c`the public or private secret
$ snmpwalk -v 2c -c public localhost
Get All OIDS
Get All OIDS

Get Specific OIDS

In previous example we have listed all existing and configured OIDs. But this is not useful for all cases. We may need to filter and specify only OIDS we need. We will add to the end of the command the OIDs we want to get. In this example we only want OID of contact information.

$ snmpwalk -v 2c -c public localhost iso.
Get Specific OIDS
Get Specific OIDS

Specify MIB Library Path For External MIBs

Normally Linux provide a lot of default MIBs but in some cases the remote system vendor may provide 3rd party MIBs. We can use these MIBs in order to get OIDs of remote system. We will specify the MIBs location with -M option.

$ snmpwalk -v 2c -c public -M /root/ismail/ciscoMIB localhost iso.

Change Default Timeout or Set New Timeout

While running snmpwalk there is default timeout where the command will wait for a response from remote systems. We can change this default timeout value and set whatever we want the -t option by providing the value of timeout. In this example we will set timeout as 10 seconds.

$ snmpwalk -t 10 -v 2c -c public -M /root/ismail/ciscoMIB localhost iso.

Set Default Retry Count

If there are network related problem and packet loss we may require to retry snmpwalk command. This will resend request after specified timout value. We will use -r option in order to set retry count. In this example we will retry 1 time. So the total timeout for single host will be 20 seconds .

$ snmpwalk -r 1 -t 10 -v 2c -c public -M /root/ismail/ciscoMIB localhost iso.

LEARN MORE  Windows Performance Recorder (wpr) Command Tutorial with Examples To Record Performance Metrics

1 thought on “Snmpwalk Command Line Examples”

  1. snmp isn’t all that fun to use, most vendors don’t describe their oid’s properly leading you to hours and hours of useless research to find the metrics you need, I can’t belive that in 2019 we’re still using such an awful system. Makes no sense to me.


Leave a Comment