Thursday, January 12, 2012

Testing SNMP Traps

If you are testing the snmp traps from a DUT to the linux PC then the following steps can be followed.

STEP 1 : Configure the snmp server in the DUT with the ip of the linux PC

eg:
snmp-server host 10.24.134.55 version v1

STEP 2 : Start the SNMP service in the linux PC

eg:
/etc/rc.d/init.d/snmpd start

STEP 3 : Issue "snmptrapd -f -Le" command to capture the traps in PC. If you are automating the
steps then log the traps in a file

eg: snmptrapd -f -Lf /var/log/trap.log

STEP 4 : Disable and then enable eth1 or any interface of your DUT to generate traps

eg: (config)#interface eth 1
(config-if-e1000-1)#enable
(config-if-e1000-1)#disable
(config-if-e1000-1)#enable

STEP 5 : Verify if the traps are logged

eg: tail -l /var/log/trap.log
STEP 6: Stop the snmp service

eg: /etc/rc.d/init.d/snmpd stop

Problems you might encounter:

1. If you get the following message in the PC

Warning: no access control information configured.^M
This receiver will *NOT* accept any incoming notifications.^M
NET-SNMP version 5.4.2.1

then you will have to change the file called /etc/snmp/snmptrapd.conf
Add this line to the snmptrapd.conf file

disableAuthorization yes
For details see the link:

http://forums.fedoraforum.org/archive/index.php/t-159234.html

2. If you get an error :-

couldn't open udp:162 -- errno 98 ("Address already in use")

then you will have to kill the snmptrapd process that is running.

ps -ef | grep snmptrapd
kill <pid>

or

pkill snmptrapd

No comments:

Post a Comment