This is a discussion on Re: linkup linkdown monitoring impacts the performance within the SNMP Coders forums, part of the Networking and Network Related category; On Fri, 24 Feb 2006, Robert Story wrote: > > On Fri, 24 Feb 2006 10:29:31 +0100 (CET) ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
On Fri, 24 Feb 2006, Robert Story wrote:
> > On Fri, 24 Feb 2006 10:29:31 +0100 (CET) Peder wrote: > PCN> If you work on a system with "netlink" support (a linux system, for > PCN> instance) and don't shrink from a bit of C coding you can make a sol= ution > PCN> that gives the alarms immediately, and costs absolutely nothing on > PCN> run-time. The trick is to open a netlink socket and subscribe to li= nk > PCN> change messages. Then generate the alarms using the net-snmp C API > PCN> interface. There is an example in one of the tutorials, and it work= s, I > PCN> have tried it. 100-200 lines of code. > > Do you have an example of the netlink watching code? The "quagga" package uses netlink much the way I suggest (actually I looked more in the "quagga" code than in the documentation when I wrote my own piece). Look in the file zebra/rt_netlink.c. The function netlink_link_change is the place where you recognize the ifUp/ifDown events - but of course you also need the surrounding infrastructure - the opening and configuration of the socket, the ordering of this specific brand of events, the adding of the FD for the socket to the central select loop etc etc. I did not find netlink easy to work with - the documentation is sloppy and complex, and the design is not impressive. It took me something like two full weeks, with a lot of cheating =3D looking in kernel source, to get the hang of it - but when you know how to work it, it works like a charm. And for performance it really beats using /proc for almost everything. best regards Peder Chr. N=F8rgaard =09Senior System Developer, M. Sc. Ericsson Denmark A/S, Telebit Division Skanderborgvej 232 =09tel: +45 30 91 84 31 DK-8260 Viby J, Denmark fax: +45 89 38 51 01 e-mail: Peder.Chr.Norgaard@ericsson.com (old e-mail 2000-2003: Peder.C.Norgaard@ted.ericsson.se) (old e-mail 1992-2000: pcn@tbit.dk) ---------------------------------------------------------------- This communication is confidential and intended solely for the addressee(s). Any unauthorized review, use, disclosure or distribution is prohibited. If you believe this message has been sent to you in error, please notify the sender by replying to this transmission and delete the message without disclosing it. Thank you. E-mail including attachments is susceptible to data corruption, interruption, unauthorized amendment, tampering and viruses, and we only send and receive e-mails on the basis that we are not liable for any such corruption, interception, amendment, tampering or viruses or any consequences thereof. ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=...720&dat=121642 _______________________________________________ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/...et-snmp-coders |