Description of problem: snmpd.conf's linkUpDownNotifications does not report ifIndex, ifAdminStatus, and ifOperStatus as it should. The snmpd.conf(5) man page indicates that linkUpDownNotifications "is exactly equivalent to the configuration:" notificationEvent linkUpTrap linkUp ifIndex ifAdminStatus ifOperStatus notificationEvent linkDownTrap linkDown ifIndex ifAdminStatus ifOperStatus monitor -r 60 -e linkUpTrap "Generate linkUp" ifOperStatus != 2 monitor -r 60 -e linkDownTrap "Generate linkDown" ifOperStatus == 2 However, the notifications from linkUpDownNotifications are missing the data on ifIndex, ifAdminStatus, and ifOperStatus. Version-Release number of selected component (if applicable): net-snmp-5.3.2.2-9.el5 net-snmp-libs-5.3.2.2-9.el5 net-snmp-perl-5.3.2.2-9.el5 net-snmp-utils-5.3.2.2-9.el5 How reproducible: every time Steps to Reproduce: 1. Create and bring up a virtual interface ifconfig eth0:0 172.31.19.19 netmask 255.255.0.0 up 2. Add these lines to /etc/snmp/snmpd.conf agentSecName root rouser root trapsink 127.0.0.1 public 162 linkUpDownNotifications yes 3. Start snmpd and snmptrapd service snmpd start service snmptrapd start 4. Bring eth0:0 down ifconfig eth0:0 down 5. Wait up to 60 seconds and you will find this in /var/log/messages (wrapped for readability) Apr 19 13:55:53 r2d2 snmptrapd[22505]: 2010-04-19 13:55:53 r2d2.example.com [10.10.58.144] (via UDP: [127.0.0.1]:35239) TRAP, SNMP v1, community public NET-SNMP-MIB::netSnmpAgentOIDs.10 Link Down Trap (0) Uptime: 0:01:00.11 SNMPv2-MIB::snmpTrapEnterprise.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10 6. Bring eth0:0 back up again ifconfig eth0:0 172.31.19.19 netmask 255.255.0.0 up 7. After another 60 seconds or so you'll find Apr 19 13:56:53 r2d2 snmptrapd[22505]: 2010-04-19 13:56:53 r2d2.example.com [10.10.58.144] (via UDP: [127.0.0.1]:35239) TRAP, SNMP v1, community public NET-SNMP-MIB::netSnmpAgentOIDs.10 Link Up Trap (0) Uptime: 0:02:00.11 SNMPv2-MIB::snmpTrapEnterprise.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10 8. Modify snmpd.conf as shown and restart snmpd #linkUpDownNotifications yes notificationEvent linkUpTrap linkUp ifIndex ifAdminStatus ifOperStatus notificationEvent linkDownTrap linkDown ifIndex ifAdminStatus ifOperStatus monitor -r 60 -e linkUpTrap "Generate linkUp" ifOperStatus != 2 monitor -r 60 -e linkDownTrap "Generate linkDown" ifOperStatus == 2 9. Repeat steps to bring eth0:0 down/up. The new traps look like Apr 19 14:09:57 r2d2 snmptrapd[22505]: 2010-04-19 14:09:57 r2d2.example.com [10.10.58.144] (via UDP: [127.0.0.1]:34151) TRAP, SNMP v1, community public NET-SNMP-MIB::netSnmpAgentOIDs.10 Link Down Trap (0) Uptime: 0:00:30.12 IF-MIB::ifIndex.3 = INTEGER: 3 IF-MIB::ifAdminStatus.3 = INTEGER: down(2) IF-MIB::ifOperStatus.3 = INTEGER: down(2) SNMPv2-MIB::snmpTrapEnterprise.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10 Apr 19 14:10:27 r2d2 snmptrapd[22505]: 2010-04-19 14:10:27 r2d2.example.com [10.10.58.144] (via UDP: [127.0.0.1]:34151) TRAP, SNMP v1, community public NET-SNMP-MIB::netSnmpAgentOIDs.10 Link Up Trap (0) Uptime: 0:01:00.12 IF-MIB::ifIndex.1 = INTEGER: 1 IF-MIB::ifAdminStatus.1 = INTEGER: up(1) IF-MIB::ifOperStatus.1 = INTEGER: up(1) SNMPv2-MIB::snmpTrapEnterprise.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10 Actual results: With linkUpDownNotifications, these are missing: IF-MIB::ifIndex.3 = INTEGER: 3 IF-MIB::ifAdminStatus.3 = INTEGER: down(2) IF-MIB::ifOperStatus.3 = INTEGER: down(2) Expected results: linkUpDownNotifications include ifIndex, ifAdminStatus, and ifOperStatus. Additional info:
From net-snmp-5.3.2.2/agent/mibgroup/disman/event/mteTriggerConf.c void parse_linkUpDown_traps(const char *token, char *line) { /* * XXX - This isn't strictly correct according to the * definitions in IF-MIB, but will do for now. */ if (strncmp( line, "yes", 3) == 0) { DEBUGMSGTL(("disman:event:conf", "Registering linkUpDown traps\n")); parse_mteMonitor("monitor", "-r 60 -S -e _linkUp \"linkUp\" ifOperStatus != 2"); parse_mteMonitor("monitor", "-r 60 -S -e _linkDown \"linkDown\" ifOperStatus == 2"); } } The latest upstream code has not changed. http://net-snmp.svn.sourceforge.net/viewvc/net-snmp/tags/Ext-5-4-3-rc2/net-snmp/agent/mibgroup/disman/event/mteTriggerConf.c?revision=18476&view=markup&pathrev=18476#l_731
Created attachment 407685 [details] patch for link notification The attached patch is a bit of a hack but it seems to work. With this patch and the single line 'linkUpDownNotifications yes' in the snmpd.conf file, the logs now contain all the details: Apr 19 16:59:21 r2d2 snmptrapd[23480]: 2010-04-19 16:59:21 r2d2.example.com [10.10.58.144] (via UDP: [127.0.0.1]:39886) TRAP, SNMP v1, community public NET-SNMP-MIB::netSnmpAgentOIDs.10 Link Down Trap (0) Uptime: 0:00:30.14 IF-MIB::ifIndex.3 = INTEGER: 3 IF-MIB::ifAdminStatus.3 = INTEGER: down(2) IF-MIB::ifOperStatus.3 = INTEGER: down(2) SNMPv2-MIB::snmpTrapEnterprise.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10 Apr 19 16:59:51 r2d2 snmptrapd[23480]: 2010-04-19 16:59:51 r2d2.example.com [10.10.58.144] (via UDP: [127.0.0.1]:39886) TRAP, SNMP v1, community public NET-SNMP-MIB::netSnmpAgentOIDs.10 Link Up Trap (0) Uptime: 0:01:00.13 IF-MIB::ifIndex.1 = INTEGER: 1 IF-MIB::ifAdminStatus.1 = INTEGER: up(1) IF-MIB::ifOperStatus.1 = INTEGER: up(1) SNMPv2-MIB::snmpTrapEnterprise.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10 Apr 19 16:59:51 r2d2 snmptrapd[23480]: 2010-04-19 16:59:51 r2d2.example.com [10.10.58.144] (via UDP: [127.0.0.1]:39886) TRAP, SNMP v1, community public NET-SNMP-MIB::netSnmpAgentOIDs.10 Link Up Trap (0) Uptime: 0:01:00.13 IF-MIB::ifIndex.2 = INTEGER: 2 IF-MIB::ifAdminStatus.2 = INTEGER: up(1) IF-MIB::ifOperStatus.2 = INTEGER: up(1) SNMPv2-MIB::snmpTrapEnterprise.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10 Apr 19 16:59:51 r2d2 snmptrapd[23480]: 2010-04-19 16:59:51 r2d2.example.com [10.10.58.144] (via UDP: [127.0.0.1]:39886) TRAP, SNMP v1, community public NET-SNMP-MIB::netSnmpAgentOIDs.10 Link Up Trap (0) Uptime: 0:01:00.13 IF-MIB::ifIndex.4 = INTEGER: 4 IF-MIB::ifAdminStatus.4 = INTEGER: up(1) IF-MIB::ifOperStatus.4 = INTEGER: up(1) SNMPv2-MIB::snmpTrapEnterprise.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10
This bug seems to be fixed differently upstream: http://net-snmp.svn.sourceforge.net/viewvc/net-snmp?view=rev&revision=16984 I'll test if it works.
An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on therefore solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHBA-2011-1076.html