<div class="gmail_quote">On 5 November 2010 10:59, Andreas Ericsson <span dir="ltr"><<a href="mailto:ae@op5.se" target="_blank">ae@op5.se</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

<div>On 11/04/2010 03:50 PM, Bostjan Skufca wrote:<br>
</div><div>> Hi all!<br>
><br>
> I was wondering if it is possible (or would be easy to implement) default<br>
> values for nagios check commands.<br>
<br>
</div>Try and find out ;)<br></blockquote><div><br>I definitely will, as soon as I catch enough spare time to do it. Or when modifying nagios config pisses me off just right :)<br><br><br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">


<div><div><br>
> Let me explain.<br>
><br>
> I would like my nagios configuration to be as transparent as possible, which<br>
> also means it should be as small as possible (no duplicated definitions).<br>
> This works fine if you have homogenic host family. Once you start hitting<br>
> diversity things are not that simple anymore. Anyway...<br>
><br>
> Currently I have to have two similar command definitions to achieve the<br>
> effect desired, one is fixed and other has variable arguments:<br>
><br>
> ###### Start of current config<br>
> #################################################<br>
> ### First command<br>
> define command{<br>
>          command_name    check-metric_sys-intr<br>
>          command_line    $USER3$/check_ganglia $HOSTNAME$ sys_intr less 2000<br>
> 5000<br>
> }<br>
> ### Second command for hosts that do not fall into the average<br>
> define command{<br>
>          command_name    check-metric_sys-intr_custom<br>
>          command_line    $USER3$/check_ganglia $HOSTNAME$ sys_intr less<br>
> $ARG1$ $ARG2$<br>
> }<br>
><br>
><br>
> ##### Then there are service definitions<br>
> ### For average host<br>
> define service{<br>
>          use service_check-metric_sys-intr    # Defined previously as<br>
> template with "register 0"<br>
>          host_name    <a href="http://host-average.example.net" target="_blank">host-average.example.net</a><br>
> }<br>
> ### For not-so-average host<br>
> define service{<br>
>          use service_check-metric_sys-intr<br>
>          host_name    <a href="http://host-exception.example.net" target="_blank">host-exception.example.net</a><br>
>          check_command   check-metric_sys-intr_custom!5000!10000<br>
> }<br>
> ###### End of current config<br>
> #################################################<br>
><br>
><br>
><br>
> I would like those arguments ARG1 and ARG2 to have some way of defining<br>
> default values,  and the final config should look something like this (note<br>
> the colon operator for default values and only one command definition)<br>
><br>
><br>
><br>
> ###### Start of desired config<br>
> #################################################<br>
> define command{<br>
>          command_name    check-metric_sys-intr<br>
>          command_line    $USER3$/check_ganglia $HOSTNAME$ sys_intr less<br>
> $ARG1:2000$ $ARG2:5000$<br>
> }<br>
><br>
<br>
</div></div>Neat idea.<br>
<br>
I don't have time for it just now though, so unless someone else steps<br>
in, this will have to wait. If you can't do it yourself, or pay someone<br>
to do it for you, I'd suggest you get an account at <a href="http://tracker.nagios.org" target="_blank">tracker.nagios.org</a><br>
and submit this as a feature-request.<br></blockquote><div><br>I know how this works, paying vs doing it myself, but thanks anyway:)<br>Ah yes, that's what I was after, request tracker - so it does not get forgotten. Done.<br>

<br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>
Since it's already possible to do with a fairly easy workaround, it<br>
probably won't get a high priority though, but it might be fun as an<br>
exercise for someone who wants to try out their programming wings.<br>
<div><br>
><br>
> I have not yet dug into nagios internals, but would this be possible without<br>
> too much hassle?<br>
<br>
</div>Yes. Look in get_raw_command_line_r() and add your 30-40 lines of code there.<br></blockquote><div><br>Well, I believe I should be looking into process_macros() first. This get_raw_command_line_r() does not exist, only variation without _r.<br>
Thanks for hint!<br><br></div></div>Best regards,<br>b.<br><br>