Custom Macros in Service Definitions?
Marc Powell
marc at ena.com
Tue Nov 17 19:39:59 CET 2009
On Nov 17, 2009, at 10:45 AM, Marcel wrote:
> Now I want to refer to this $_HOSTip_provate_VIP_1$ macro in services definitions, but nagios is complaining about not finding the service.
What is the exact error that you are seeing? I can't see how a problem with that macro substitution would generate any error about 'not finding the service'.
> The documentation isn't clear whether or not custom macros could be used in service definitions.
>
> I've a command like this:
>
> define command{
> command_name check_http_str_return_args
> command_line $USER1$/check_http -I $ARG1$ $ARG2$
> }
>
> And the service definition:
>
> define service{
> use generic-service
> (...)
> check_command check_http_str_return_args!$_HOSTip_private_VIP_1$!-u / -t 10 -w 3 -c 5 -e HTTP/1.1 200 OK
> }
This is unusual but based on the documentation on how to check service and host clusters, I expect this should probably work. Looking in the code it looks like macro substitution happens at the right place too... There is a problem with the resulting command in that '-e HTTP/1.1 200 OK' will be translated to '-e' with an argument of 'HTTP/1.1' and then a dangling 200 and a dangling OK to the entire command. If you want to match more than HTTP/1.1, enclose the entire 'HTTP/1.1 200 OK' in quotes.
> My question is:
>
> Is it by design that custom macros should NOT be used in service definitions?
I don't recall seeing it stated either way (should/should not). I know that you can use other macros in this way and don't believe that custom macros are special.
--
Marc
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null
More information about the Users
mailing list