Proof by IOS!!! Mastering the Basics of SNMP

From: Andrew Bruce Caslow <abcaslow_at_netmasterclass.net>
Date: Tue, 5 Oct 2010 13:08:41 -0400

Hi Everyone,

 

An important IP Service to master for the R&S CCIE lab is SNMP. SNMP is very
important for providing a scalable solution for monitoring and managing a
numnber of network devices.

 

A conversation we had recently with a number of Cisco 360 students in a NMC
Live On-line Group mentoring session is:

 

How can I prove that my baseline MPLS configuration is operational? Well,
here is one interesting way to do this with embedded TCL shell within the
IOS: use some of the command-line SNMP commands available in tclsh. Here is
an example:

 

Let's say we want not enabled the SNMP agent process on a Cisco router:

 

Let's apply our "proof by IOS" approach (proof by show command/proof by
debug/etc) to prove that SNMP is disabled on a router:

 

 

R6#sh snmp
%SNMP agent not enabled

 

Another command I like to use is:

 

R6#sh processes | i SNMP
112 Mwe 42152DFC 0 1 0 5744/6000 0 SNMP Timers

198 Mwe 41571AA4 0 2 0 8624/9000 0 EEM ED SNMP

 

Notice that there are two SMNP related processes running but when SNMP is
actually enabled you will see many more SNMP related processes enabled.

 

Now, let's enter in our SNMP related tclsh command:

 

R6(tcl)#snmp_getbulk public 0 10 ifDescr
{<snmp error type='tcl_snmp_internal_error' value='9' text='Could not parse
message returned from snmp engine.' />}

 

Notice it generated a rather cryptic message.

 

Now, let's enable the SNMP agent process on our router by entering in only
one command:

 

R6(config)#snmp-server community nmc ro

 

Once this one command is entered, I now have "read only" access to this
router's SNMP agent.

 

Now, when I enter in the show snmp command, I no longer receive the message:

 

%SNMP agent not enabled

 

I receive the following:

 

R6#sh snmp
Chassis: FTX1236A2ZD
1 SNMP packets input
    0 Bad SNMP version errors
    1 Unknown community name
    0 Illegal operation for community name supplied
    0 Encoding errors
    0 Number of requested variables
    0 Number of altered variables
    0 Get-request PDUs
    0 Get-next PDUs
    0 Set-request PDUs
    0 Input queue packet drops (Maximum queue size 1000)
0 SNMP packets output
    0 Too big errors (Maximum packet size 1500)
    0 No such name errors
    0 Bad values errors
    0 General errors
    0 Response PDUs
    0 Trap PDUs

SNMP logging: disabled

 

I also have many more processes running that are related to SNMP:

 

 

R6#sh processes | i SNMP
  84 Mwe 417CC1F0 0 1 011396/12000 0 IP SNMP

112 Mwe 42152DFC 0 2 0 5744/6000 0 SNMP Timers

166 Lwe 421579BC 124 1 12400010152/12000 0 SNMP ENGINE

198 Mwe 41571AA4 0 2 0 8624/9000 0 EEM ED SNMP

205 Mwe 417CE060 0 1 011228/12000 0 IP SNMPV6

216 Lwe 41207550 0 1 011196/12000 0 SNMP
ConfCopyPro
217 Mwe 421536EC 0 1 011648/12000 0 SNMP Traps

R6#

 

Now, when I enter my SNMP command in tclsh I get some output:

 

urned from snmp engine.' />}
R6(tcl)#snmp_getbulk nmc 0 10 ifDescr
{<obj oid='ifDescr.1' val='FastEthernet0/0'/>}
{<obj oid='ifDescr.2' val='FastEthernet0/1'/>}
{<obj oid='ifDescr.3' val='Serial0/0/0'/>}
{<obj oid='ifDescr.4' val='Serial0/0/1'/>}
{<obj oid='ifDescr.6' val='Null0'/>}
{<obj oid='ifDescr.9' val='Loopback106'/>}
{<obj oid='ifDescr.10' val='Loopback666'/>}
{<obj oid='ifDescr.11' val='FastEthernet0/0.40'/>}
{<obj oid='ifDescr.12' val='FastEthernet0/0.3000'/>}
{<obj oid='ifType.1' val='6'/>}

 

Feel free to enter SNMP mib queries with this command.

 

You can also query the router's MIB with the following IOS show command
(shown with an example):

 

R6(tcl)#sh snmp mib | i ospf

 

Make note, your search criteria must be case-sensitive!

 

Once you have found the desired MIB object, you can enter it with the
command-line snmp command "snmp_getbulk":

 

R6(tcl)#snmp_getbulk nmc 0 5 ospfIfEntry
{<obj oid='ospfIfEntry.1.172.16.16.6.0' val='172.16.16.6'/>}
{<obj oid='ospfIfEntry.1.172.16.67.6.0' val='172.16.67.6'/>}
{<obj oid='ospfIfEntry.1.172.16.106.1.0' val='172.16.106.1'/>}
{<obj oid='ospfIfEntry.2.172.16.16.6.0' val='0'/>}
{<obj oid='ospfIfEntry.2.172.16.67.6.0' val='0'/>}

 

If you want to learn more about SNMP, place a request with the NeMasterClass
Live On-line Group mentoring team.

 

For more details:
<http://www.netmasterclass.com/CCIE/Live-Online-Group-Mentoring/>
http://www.netmasterclass.com/CCIE/Live-Online-Group-Mentoring/ or contact
Rauf Rasulov at <mailto:rauf_at_netmasterclass.net> rauf_at_netmasterclass.net

 

Thanks!

 

Andrew Bruce Caslow, CCIE #3139

Master Cisco 360 Instructor

 <http://www.NetMasterClass.com> www.NetMasterClass.com

Blogs and organic groups at http://www.ccie.net
Received on Tue Oct 05 2010 - 13:08:41 ART

This archive was generated by hypermail 2.2.0 : Mon Nov 01 2010 - 06:42:05 ART