Default argument values for nagios check commands

Bostjan Skufca bostjan at a2o.si
Thu Nov 4 15:50:53 CET 2010


Hi all!

I was wondering if it is possible (or would be easy to implement) default
values for nagios check commands. Let me explain.

I would like my nagios configuration to be as transparent as possible, which
also means it should be as small as possible (no duplicated definitions).
This works fine if you have homogenic host family. Once you start hitting
diversity things are not that simple anymore. Anyway...


Currently I have to have two similar command definitions to achieve the
effect desired, one is fixed and other has variable arguments:

###### Start of current config
#################################################
### First command
define command{
        command_name    check-metric_sys-intr
        command_line    $USER3$/check_ganglia $HOSTNAME$ sys_intr less 2000
5000
}
### Second command for hosts that do not fall into the average
define command{
        command_name    check-metric_sys-intr_custom
        command_line    $USER3$/check_ganglia $HOSTNAME$ sys_intr less
$ARG1$ $ARG2$
}


##### Then there are service definitions
### For average host
define service{
        use service_check-metric_sys-intr    # Defined previously as
template with "register 0"
        host_name    host-average.example.net
}
### For not-so-average host
define service{
        use service_check-metric_sys-intr
        host_name    host-exception.example.net
        check_command   check-metric_sys-intr_custom!5000!10000
}
###### End of current config
#################################################



I would like those arguments ARG1 and ARG2 to have some way of defining
default values,  and the final config should look something like this (note
the colon operator for default values and only one command definition)



###### Start of desired config
#################################################
define command{
        command_name    check-metric_sys-intr
        command_line    $USER3$/check_ganglia $HOSTNAME$ sys_intr less
$ARG1:2000$ $ARG2:5000$
}

##### Then there are service definitions
### For average host
define service{
        use service_check-metric_sys-intr
        host_name    host-average.example.net
}
### For not-so-average host
define service{
        use service_check-metric_sys-intr
        host_name    host-exception.example.net
        check_command   check-metric_sys-intr!5000!10000
}
###### End of current config
#################################################


I have not yet dug into nagios internals, but would this be possible without
too much hassle?
Thank you for your time,
b.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20101104/8e553058/attachment.html>
-------------- next part --------------
------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a 
Billion" shares his insights and actions to help propel your 
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
-------------- next part --------------
_______________________________________________
Nagios-devel mailing list
Nagios-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-devel


More information about the Developers mailing list