Page 1 of 1

Defining On-demand Macro in Host Group in CCM

Posted: Tue May 20, 2014 12:27 am
by grenley
Hi.

We are using CCM to define our host groups; in this case, "linux-servers".
I have a bunch of checks that I assign to that host group.
I want to specify an on-demand macro in this host group (so I can use it as an environment var in a plugin).
A future host group, say, solaris-servers, may have a different value, but the plugin code wouldn't have to change.

Something like:
_LOGMONPATH /usr/local/nagios/etc/logmonpath

CCM appears to have very limited options for what kinds of things you can do with a Host Group definition.
Adding macros is not one of them.
Obviously, editing the cfg file is out as NagiosQL will just overwrite it.

Any ideas?
I think I'm stuck using CCM for this unless I can present a really compelling case otherwise.

Thanks very much.
Rick

Re: Defining On-demand Macro in Host Group in CCM

Posted: Tue May 20, 2014 4:58 pm
by slansing
I'd highly recommend taking a look at this document:

http://assets.nagios.com/downloads/nagi ... ndlers.pdf

Specifically at the on-demand macros section. You should be able to add them just as you would in core, you should be able to add them in the MISC section of your Host/service ccm definition. I hope I didn't misunderstand your question.

Re: Defining On-demand Macro in Host Group in CCM

Posted: Wed May 21, 2014 5:28 pm
by grenley
Thanks very much for your reply.
I think what you're referring to doesn't allow me to set macros/environment variables for whole platforms (e.g., via a host group definition)
As I've begun to understand more about the product, I realize my questions are pretty naive and I apologize for that.
I'm thinking that I could just write a wrapper script that sets environment variables and then calls the plugin directly.

Re: Defining On-demand Macro in Host Group in CCM

Posted: Thu May 22, 2014 8:10 am
by scottwilkerson
grenley wrote:Thanks very much for your reply.
I think what you're referring to doesn't allow me to set macros/environment variables for whole platforms (e.g., via a host group definition)
As I've begun to understand more about the product, I realize my questions are pretty naive and I apologize for that.
I'm thinking that I could just write a wrapper script that sets environment variables and then calls the plugin directly.
That's probably your easiest option.