I just discovered the existance of custom object variables which fulfill my needs. I define warn/crit thresholds in default service definition and modify them in local service definition if needed. Thus this became a non-issue for me. (and just now when I already got familiar with Nagios source code:)<br>
<br>Thanks for your hints/help anyway!<br><br>Best regards,<br>Bostjan<br><br><br><div class="gmail_quote">On 10 November 2010 11:12, Andreas Ericsson <span dir="ltr"><<a href="mailto:ae@op5.se">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><div></div><div class="h5">On 11/10/2010 03:28 AM, Bostjan Skufca wrote:<br>
> On 5 November 2010 10:59, Andreas Ericsson<<a href="mailto:ae@op5.se">ae@op5.se</a>>  wrote:<br>
><br>
>> On 11/04/2010 03:50 PM, Bostjan Skufca wrote:<br>
>>> 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>
>> Try and find out ;)<br>
>><br>
><br>
> I definitely will, as soon as I catch enough spare time to do it. Or when<br>
> modifying nagios config pisses me off just right :)<br>
><br>
><br>
><br>
>>> Let me explain.<br>
>>><br>
>>> I would like my nagios configuration to be as transparent as possible,<br>
>> 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<br>
>> 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<br>
>> (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>
>> 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>
>><br>
><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<br>
> forgotten. Done.<br>
><br>
><br>
><br>
>><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>
>><br>
>>><br>
>>> I have not yet dug into nagios internals, but would this be possible<br>
>> without<br>
>>> too much hassle?<br>
>><br>
>> Yes. Look in get_raw_command_line_r() and add your 30-40 lines of code<br>
>> there.<br>
>><br>
><br>
> Well, I believe I should be looking into process_macros() first. This<br>
> get_raw_command_line_r() does not exist, only variation without _r.<br>
> Thanks for hint!<br>
><br>
<br>
</div></div>If you want to make modifications to Nagios, you'll need to get the<br>
latest sources from CVS.<br>
<br>
The changes will have to be made so that the object structure doesn't<br>
change if you want to get this before Nagios 4 (which is still a loooong<br>
way off).<br>
<div><div></div><div class="h5"><br>
--<br>
Andreas Ericsson                   <a href="mailto:andreas.ericsson@op5.se">andreas.ericsson@op5.se</a><br>
OP5 AB                             <a href="http://www.op5.se" target="_blank">www.op5.se</a><br>
Tel: +46 8-230225                  Fax: +46 8-230231<br>
<br>
Considering the successes of the wars on alcohol, poverty, drugs and<br>
terror, I think we should give some serious thought to declaring war<br>
on peace.<br>
</div></div></blockquote></div><br>