Fwd: [PATCH] Fix default value for enable_environment_macros
Ton Voon
tonvoon at gmail.com
Mon Jan 14 10:44:10 CET 2013
Apologies if you receive this twice - resending this as it appears that mail from ton.voon at opsview.com appears to be blocked to this mailing list.
On 11 Jan 2013, at 17:08, Andreas Ericsson wrote:
> On 01/11/2013 02:43 PM, Ton Voon wrote:
>> 2) an env_macros field is available in all objects to
>> define specifically which environment macros. This is a comma
>> separated list, defaulting to ALL for backwards compatibility
>>
>
> I was thinking more along the lines of
>
> define command {
> env ORACLE_HOME=/foo/bar/lala
> env HOST_NAME=$HOSTNAME$
> command_name check_something
> command_line /path/to/some-check
> }
>
> since that also lets users set variables that aren't exactly Nagios related.
I think that's a great idea and better than my proposal.
Conceptually, the environment macros are based on plugin/notification/eventhandlers/perfhandler requirements, so putting this in a "define command" is more accurate than in "define service".
>
>> I'm happy to do some of this work, but will require agreement on the
>> design and some technical assistance.
>>
>
> If you get the macros to the workers as kvvec key/value pairs like this:
>
> k=env
> v=NAGIOS_(MACRO_NAME)=macro value
>
> then I'll make sure the workers set up the environment properly. I'll
> make an addendum to the worker rules though so the (possibly huge)
> macro values don't have to be passed back to Nagios for every check
> executed.
Please find a patch that is setting the envvars. This sets before execution and then unsets at the end. I've only done it for 4 hard coded variables - it should be based on this new env property. It's clearly not production ready yet.
Are there any kv limits to be aware of?
What I can't work out is how to set the env property in "define command". Can you provide some pointers and assistance?
Ton
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nagios_worker_macros_research.patch
Type: application/octet-stream
Size: 3867 bytes
Desc: not available
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20130114/1a013190/attachment.obj>
-------------- next part --------------
-------------- next part --------------
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 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_122412
-------------- next part --------------
_______________________________________________
Nagios-devel mailing list
Nagios-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-devel
More information about the Developers
mailing list