Custom Macros in Service Definitions?

Marcel mitsuto at gmail.com
Tue Nov 17 20:54:55 CET 2009


Greetings Marc,

Well, I've wrapped the command in question with /bin/echo { command_line
def. } >> /tmp/check_http_jmx.log to see what Nagios is issuing.

The -I flag of the check_http command was being issued with just a dollar
sign ($) as it's parameter.

So i think it's a matter of macro double spanning, because there is a custom
macro ($_HOSTIP_PRIVATE_VIP_1$) being passed to be spanned by $ARG1$ at the
command_line definition. I do not know If I ever saw or used a configuration
like this.

I don't think is a problem of quoting, because Nagios should replace
$_HOSTIP_PRIVATE_VIP_1$ by it's custom host value say, 10.0.0.1, and then
pass this value to be replaced at $ARG1$ standard command macro, but all I
see is a dolar sign being issued by nagios as a parameter of -I.

Then my second question in my next email about double macro spanning.

Do you think it could be a configuration problem?

Best regards,
Marcel

On Tue, Nov 17, 2009 at 4:39 PM, Marc Powell <marc at ena.com> wrote:

>
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20091117/514a12b7/attachment.html>
-------------- next part --------------
------------------------------------------------------------------------------
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
-------------- next part --------------
_______________________________________________
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