Re: Net-SNMP perl plugin with Nagios
Dave Shield <[email protected]>
| Newsgroups | gmane.network.net-snmp.user |
|---|---|
| Message-ID | <[email protected]> |
I've no real experience with writing Nagios plugins, but I'll offer a few thoughts: On 15 November 2010 17:28, Peter Hicks <[email protected]> wrote: > There are 36 calls to SNMP::init_snmp, which seems > like a heck of a lot Remember that any perl call relating to MIB files (adding search directories, loading MIB files, or translating from a name to an OID), will call 'init_snmp'. But the code invoked starts: static int have_inited = 0; if (have_inited) return; have_inited = 1; So the overhead involved should be negligible. > The issue I'm up against is that when multiple copies of this plugin run, > they take increasingly longer (up to 6-7 seconds) to return any data Hmmm... that sounds as if they might be competing with each other in some way. Perhaps some form of locking. What sort of response do you see with a single plugin? If this is slow, then I might suggest you try tweaking the plugin to use numeric OIDs and results, and suppress the loading of the MIB files. Judging by the script you posted, this only supports a fixed set of MIB tables, so it would be perfectly possible to hardcode the relevant numeric OIDs instead of the names. Loading the MIB files would be a non-trivial task, so omitting this might well speed things up noticeably. But if the response for a single plugin is acceptable, and the problem only arises with multiple plugins, then the cause probably lies elsewhere. Can you run the scripts manually (rather than via Nagios)? Do you see the same symptoms? If so, then that might give some indication as to where the delays are occuring. > Can anyone help? The code is at > http://stash.poggs.com/check-environment.pl One other thought - do you actually need to retrieve the whole table in each case? Wouldn't it be sufficient to walk the relevant state column, which seems to be the only value that you're actually using? Dave ------------------------------------------------------------------------------ Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. Spend less time writing and rewriting code and more time creating great experiences on the web. Be a part of the beta today http://p.sf.net/sfu/msIE9-sfdev2dev _______________________________________________ Net-snmp-users mailing list [email protected] Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users