Hi all,
root@NX-ZWYC-M1F202-A16-HW6865-A-INT-212:/# cat /etc/snmp/snmptrapd.conf
#
# EXAMPLE-trap.conf:
# An example configuration file for configuring the Net-SNMP snmptrapd agent.
#
###############################################################################
#
# This file is intended to only be an example.
# When the snmptrapd agent starts up, this is where it will look for it.
#
# All lines beginning with a '#' are comments and are intended for you
# to read. All other lines are configuration commands for the agent.
disableAuthorization yes
#
# PLEASE: read the snmptrapd.conf(5) manual page as well!
#
#authCommunity log,execute,net private
#authCommunity log,execute,net public
#authCommunity log,execute,net snmp@sankuai
#
traphandle .1.3.6.1.2.1.15.0.1 ./bgp-peer-status
traphandle .1.3.6.1.2.1.15.0.2 ./bgp-peer-status
root@NX-ZWYC-M1F202-A16-HW6865-A-INT-212:/# cat ./bgp-peer-status
#!/bin/bash
echo `cat -`
Then I up/down bgp peer use these command:
NX-ZWYC-M1F202-A16-HW6865-A-INT-212(config-router)# router bgp 65003
NX-ZWYC-M1F202-A16-HW6865-A-INT-212(config-router)# neighbor 192.168.10.9 shutdown
NX-ZWYC-M1F202-A16-HW6865-A-INT-212(config-router)# no neighbor 192.168.10.9 shutdown
This is trap message I got, I got 2 messages, you could see, the 2 message is the same, especially in bgp peer status, I guess this is a BUG ?
root@NX-ZWYC-M1F202-A16-HW6865-A-INT-212:/etc/snmp# /usr/sbin/snmptrapd -f -Lo4d
NET-SNMP version 5.7.3
2019-08-15 09:42:15 172.18.8.212(via UDP: [127.0.0.1]:34916->[127.0.0.1]:162) TRAP, SNMP v1, community public
iso.3.6.1.2.1.15 Enterprise Specific Trap (1) Uptime: 23:59:58.54
iso.3.6.1.2.1.15.3.1.14.192.168.10.9 = Hex-STRING: 06 02 iso.3.6.1.2.1.15.3.1.2.192.168.10.9 = INTEGER: 6 # This is first BGP peer status, which is Establish
localhost
UDP: [127.0.0.1]:34916->[127.0.0.1]:162
iso.3.6.1.2.1.1.3.0 0:23:59:58.54
iso.3.6.1.6.3.1.1.4.1.0 iso.3.6.1.2.1.15.0.1
iso.3.6.1.2.1.15.3.1.14.192.168.10.9 "06 02 "
iso.3.6.1.2.1.15.3.1.2.192.168.10.9 6
iso.3.6.1.6.3.18.1.3.0 172.18.8.212
iso.3.6.1.6.3.18.1.4.0 "public"
iso.3.6.1.6.3.1.1.4.3.0 iso.3.6.1.2.1.15
2019-08-15 09:42:22 172.18.8.212(via UDP: [127.0.0.1]:34916->[127.0.0.1]:162) TRAP, SNMP v1, community public
iso.3.6.1.2.1.15 Enterprise Specific Trap (2) Uptime: 1 day, 0:00:05.65
iso.3.6.1.2.1.15.3.1.14.192.168.10.9 = Hex-STRING: 06 02 iso.3.6.1.2.1.15.3.1.2.192.168.10.9 = INTEGER: 6 # This is second BGP peer status, which is also Establish
localhost
UDP: [127.0.0.1]:34916->[127.0.0.1]:162
iso.3.6.1.2.1.1.3.0 1:0:00:05.65
iso.3.6.1.6.3.1.1.4.1.0 iso.3.6.1.2.1.15.0.2
iso.3.6.1.2.1.15.3.1.14.192.168.10.9 "06 02 "
iso.3.6.1.2.1.15.3.1.2.192.168.10.9 6
iso.3.6.1.6.3.18.1.3.0 172.18.8.212
iso.3.6.1.6.3.18.1.4.0 "public"
iso.3.6.1.6.3.1.1.4.3.0 iso.3.6.1.2.1.15