[PATCH] Fix default value for enable_environment_macros

Andreas Ericsson ae at op5.se
Fri Jan 11 13:17:57 CET 2013


On 01/10/2013 11:31 PM, Ton Voon wrote:
> 
> On 29 Aug 2012, at 14:05, Andreas Ericsson wrote:
> 
>> On 08/29/2012 12:49 AM, Alex Bame wrote:
>>> Hello list,
>>> 
>>> Sometime between 3.3.1 and 3.4.1 the default value for the 
>>> enable_environment_macros configuration changed from TRUE to
>>> FALSE. The docs and config templates still say that TRUE is the
>>> default, however.
>>> 
>>> The attached patch changes it back to TRUE.
>>> 
>> 
>> NAK. William provided a reasonable explanation, so I won't get
>> into one. I'll make sure to mention it in the release-notes though
>> and I'll also change the sample config to make sure they're set to
>> FALSE by default there too.
> 
> The sample-config still has a default value of 1.
> 

Thanks for noticing. I've amended it now.

> However, even with this set to true, it looks like Nagios 4 doesn't
> set the envvars. In host/service checks, it looks like no envvars are
> set. Is there a technical reason why this is not done, or is this a
> bug?
> 

The technical reason is twofold: I'm lazy, and environment macros cause
a lot of additional problems for anything but very small systems, while
providing a mediocre benefit at best.

The problem people have been seeing with Nagios 3 where certain checks
fail to run when they add an extra service to a servicegroup is due to
environment macros being enabled and the environment space being eaten.

To enable them again means transferring the entire environment to the
designated worker process, parsing it from there and setting it in a
new heap which we pass to execvpe().

Since we will always pay *all* overhead for all checks but very, very
few of them use more than one or two of the variables set, the benefit
really isn't worth the additional overhead.

A different (and far niftier) idea is to use "env" statements for
commands, where one can determine certain variables to pass through
the environment. That way we'd pay very little overhead and only for
the variables people actually want exported via the environment. It
would also make it possible to set certain environment variables for
plugins that require them (like many of the oracle checks do).

So.. yes, it's a bug, but consider environment variable support of the
current notion (all or nothing) to be deprecated and scheduled for
removal in Nagios 5 with a more powerful way to control environment
variables replacing it.

-- 
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.

------------------------------------------------------------------------------
Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
much more. Get web development skills now with LearnDevNow -
350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122812




More information about the Developers mailing list