Hi all,
Hope everyone is OK.
I met a problem as title,
As i know this problem will happen in all versions of net-snmp.
if we have the following configuration, all interfaces will be monitored.
*notificationEvent linkUpTrap linkUp ifIndex ifAdminStatus
ifOperStatus*
*notificationEvent linkDownTrap linkDown ifIndex ifAdminStatus
ifOperStatus*
*
*
*monitor -u cjslyxz -r 60 -e linkUpTrap "Generate linkUp" ifOperStatus
!= 2*
*monitor -u cjslyxz -r 60 -e linkDownTrap "Generate linkDown" ifOperStatus
== 2*
*
*
I think we should only care about the interfaces ,the IfAdminStatus of
which is down.
But i can not configure the following
*monitor -u cjslyxz -r 60 -e linkDownTrap "Generate linkDown" ifOperStatus
== 2 AND ifAdminStauts==1(up)*
*
*
OR if i only care about interface eth0
*monitor -u cjslyxz -r 60 -e linkDownTrap "Generate linkDown"
ifOperStatus.2 == 2 *//index 1 is for lo
So i think i can't solve this problem only change the configuretion, Am i
right?
After i read some code of net-snmp,i think there're several ways to fix
this.
Way 1: need to add one flags IFOPERSTATUS_UNUSED.
In function netsnmp_access_interface_ioctl_flags_get
if(ifentry->os_flags & IFF_UP) {
ifentry->admin_status = IFADMINSTATUS_UP;
if(ifentry->os_flags & IFF_RUNNING)
ifentry->oper_status = IFOPERSTATUS_UP;
else
ifentry->oper_status = IFOPERSTATUS_DOWN; //Here we can
change the status to any other flag, such as unused,
}
else {
ifentry->admin_status = IFADMINSTATUS_DOWN;
ifentry->oper_status = IFOPERSTATUS_DOWN;
}
Way 2:
Change the condition of trigger the trap, let it support "*ifOperStatus ==
2 AND ifAdminStauts==1*" OR "*ifOperStatus.2 == 2 *"
Any suggestions? which one is better?
BR/Merlin
------------------------------------------------------------------------------
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13.
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders