[PATCH] common/macros.c:2185:grab_standard_servicegroup_macro() speed up & Service check execution problem report

Andreas Ericsson ae at op5.se
Tue Jan 4 11:45:41 CET 2011


On 01/04/2011 11:33 AM, Jochen Bern wrote:
> On 01/04/2011 10:38 AM, Andreas Ericsson wrote:
>> On 01/04/2011 04:37 AM, Stephane LAPIE wrote:
>>> 3) Which brings me to a feature request : Nagios does not cache the
>>> generation output of standard macros such as service group members
>>> (derivated from configuration, and therefore static within any given
>>> Nagios process), and has to go through the process of regenerating the
>>> list every single time a child process is executed and environment
>>> macros are set. This is extremely time-consuming, and further
>>> performance improvements could be achieved through this.
>> Such a performance increase would come at a fairly costly price though,
>> since Nagios fork()'s each time it runs a check and the memory would
>> be duplicated to each child. Most of it should be shared on Linux, but
>> for Solaris, BSD and others it might prevent Nagios from running
>> altogether, and it would be a complete and utter waste to stash them
>> if environment variables are turned off and they're never used in a
>> real command, as is expected for large installations.
> 
> Wild idea: How about "cacheing" them into dotfiles that the plugins'
> interpreter can "source" (C shells) / "." (Bourne shells) / whatever?
> 
> E.g., set $NAGIOS_HOSTGROUPNAME within Nagios itself (if env vars are
> enabled) but have $NAGIOS_HOSTGROUPMEMBERS set by means of a
> .../nagios/var/env-constants/HostGroup_$NAGIOS_HOSTGROUPNAME .
> 
> Regards,
> 								J. Bern

You'd need a ton of files to get the macros right for every command that
Nagios runs, and since it's a new behaviour no scripts would use them
immediately, and unless they get frequently used they'd be rotated out
of the LRU sitting cache, so performance would suck far more than it does
for calculating them on the fly, but would be moved to disk io instead of
cpu time. Hardly a win.

A better solution would be to get rid of as many macros as possible and
enable some config switch that lets the user decide which macros should
be available as environment variables. In my experience, very few setups
actually require them, and when they do, it's just a small handful of the
~100 macros that Nagios provides.

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.

------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl




More information about the Developers mailing list