In this post , we present the working steps to enable SNMP Traps on a cisco switch. Hope this is useful to some beginners.
Check the SNMP Trap settings.
SW1#show snmp
Chassis: SRO112WE21
0 SNMP packets input
0 Bad SNMP version errors
0 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 global trap: disabled
SNMP agent enabled
SNMP logging: disabled
Enter into configuration mode , to send SNMPV2 traps to manager IP 10.20.30.1 using the interface of VLAN 45 , below commands may be used.
SW1#config t
SW1(config)# snmp-server community public ro
SW1(config)# snmp-server host 10.20.30.1 version 2c public
SW1(config)# snmp-server enable traps snmp
SW1(config)# snmp-server trap-source vlan 45
SW1(config)# end
SW1# show snmp
Chassis: SRO112WE21
0 SNMP packets input
0 Bad SNMP version errors
0 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)
6 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
6 Trap PDUs
SNMP global trap: enabled
SNMP agent enabled
SNMP logging: enabled
Logging to 10.20.30.1.162, 0/10, 6 sent, 0 dropped.