Tuesday, July 12, 2011

Enable SNMP on Cisco Devices (part 1)

In this short tutorial I'll demonstrate how to quickly configure SNMP on your Cisco appliance and test it's working.

There will be another tutorial dealing with how to configure the SNMP manager side.

1) Let's start by logging in to your Cisco appliance (In my case I used 851 series Cisco router with IOS version 12.3).

2) Enter configuration mode:
cisco851#configure terminal

3) Set your community string and the mode (read only, read write):
cisco851(config)#snmp-server community myComunity1 RW

4) Point the appliance to the SNMP manager (in our case , with the same community string you've set before: 

 cisco851(config)#snmp-server host version 2c myComunity1

5) Enable the trap types you wish to monitor, for example:

cisco851(config)#snmp-server enable traps snmp linkdown linkup coldstart warmstart

6) Save the configuration:
cisco851(config)#do wr

At this point the basic configuration on the Cisco appliance is done, let's see if we able to querry the appliance from our server.

I have used Ubuntu 11.04 x64 box with "snmp" package installed.

Check it's indeed installed with:
root@ubuntu:~#dpkg --list |grep snmp
If not get it with:
root@ubuntu:~#apt-get install snmp

After snmp package has been succefully installed it's time test the configuration.

Issue the following command and see if you're able to retrieve the SNMPv1 agent  or our Cisco appliance ( MIB tree list :

root@ubuntu:~#snmpwalk -v 1 -c myComunity1

At this point you should be able to list the entire tree (output was ommited), means Cisco side is configured successfully.

You can now get the desired info for monitoring purposes, like the system uptime:

root@ubuntu:~#snmpget -v 1 -c myComunity1 iso.org.dod.internet.mgmt.mib-2.system.sysUpTime.0

DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (490514418) 56 days, 18:32:24.18
Or our appiance hostname:

root@ubuntu:~#snmpget -v 1 -c myComunity1 iso.org.dod.internet.mgmt.mib-2.system.sysName.0

SNMPv2-MIB::sysName.0 = STRING: gw1.slsphr.net.il
Mission accomplished.
In the next SNMP article I will touch the server side configuration.

1 comment:

smith luther said...

Configuring SNMP on the Cisco devices and testing will be simpler after reading this tutorial. Do share more information about other devices.

sfp lr