Log in Go to the main page Page History Go to the file list Go to the site toolbox

Net-snmp Masterclass

From NetworkStuff



Hitori-extralarge.png

The official net-snmp tutorials can be found here: http://net-snmp.sourceforge.net/wiki/index.php/Tutorials and net-snmp itself can be downloaded here: http://www.net-snmp.org/download.html.

Contents

Get

Use the snmpget and snmptable commands to retrieve device information available via SNMP

The snmpwalk command can also be used to display a device's MIB tree and all it's OIDs and their values, from the point you specify. This can remove the need for multiple snmpget commands but should be used with caution as a huge amount of information may be returned.

Set

Use the snmpset command to modify a device's configuration or SNMP parameters via SNMP

Status

Use the snmpstatus command to quickly ascertain what a device is and if it is operational

For example; snmpstatus -v 2c -c public 1.2.3.4

[UDP: [1.2.3.4]:161]=>[Cisco Internetwork Operating System Software
IOS (tm) Catalyst 4000 L3 Switch Software (cat4000-I5K91S-M), Version 12.2(18)EW, EARLY DEPLOYMENT RELEASE SOFTWARE (fc1)
TAC Support: http://www.cisco.com/tac
Copyright (c) 1986-2004 by cisco Systems, Inc.] Up: 461 days, 17:06:40.26
Interfaces: 114, Recv/Trans packets: 200669671/-1218540833 | IP: 1268005101/359369154
45 interfaces are down!

Trap

Use the snmptrap command to send test traps from a device

For example; snmptrap -v 2c -c public 1.2.3.4 "" 1.3.6.1.4.1.3375.2.4.0.15 1.3.6.1.4.1.3375.2.1.1.1.1.6.0 s "Test"

Walk

Use the snmpwalk command to view a device's MIB tree and OIDs and their values

Variable Types

  • i - Integer
  • u - Unsigned
  • c - Counter 32
  • s - String
  • x - Hexidecimal String
  • d - Decimal String
  • n - Null Object
  • o - Object Id
  • t - Time Ticks
  • a - IP Address
  • b - Bits

Using Non-Standard MIBs Temporarily

Windows

Place the MIB file in this existing sub-directory of the net-snmp installation directory: ..\share\snmp\mibs

Linux:

Place the MIB file in this existing sub-directory of the net-snmp installation directory: /usr/local/share/snmp/mibs or the existing sub-directory of the user home directory: ../.snmp/mibs

Using Non-Standard MIBs Permanently

Windows

  • Place the MIB file in this existing sub-directory of the net-snmp installation directory: ..\share\snmp\mibs
  • Edit the snmp.conf file found in this existing sub-directory of the net-snmp installation directory: ..\etc\snmp
  • Add these lines to the end of the configuration file (never enter the file name extension such as .txt or .my:)
mibs +name-of-mib-file-one
mibs +name-of-mib-file-two
mibs +name-of-mib-file-three

Linux:

  • Place the MIB file in this existing sub-directory of the net-snmp installation directory: /usr/local/share/snmp/mibs or the existing sub-directory of the user home directory: ../.snmp/mibs
  • Edit the snmp.conf file found in this existing sub-directory of the net-snmp installation directory: /usr/local/share or the existing sub-directory of the user home directory: ../.snmp
  • Add these lines to the end of the configuration file (never enter the file name extension such as .txt or .my:)
mibs +name-of-mib-file-one
mibs +name-of-mib-file-two
mibs +name-of-mib-file-three

MIB Issues

MIBs downloaded from the Cisco website tend to have copyright information inserted at the top of them. If you are having issues when attempting to use Cisco MIBs, edit the MIB file and remove any text or 'white space' present before the line containing; DEFINITIONS ::= BEGIN which should be on the first line of the file.

Accessories-text-editor-v2-medium.png Usage Notes

Icemon-medium.png Related Articles

For details of useful MIBs and OIDs you might use with this program suite, see the SNMP MIB & OID Guide article.


Internet-group-chat-small.png We really do appreciate all feedback so please do send your comments, suggestions or corrections to steve#networkstuff.eu (replacing the # with an @)


Personal tools
This page was last modified on 1 December 2009, at 16:30. - Disclaimers - About Network Stuff
Powered by MediaWiki