Page 1 of 1

[Nagios-devel] Default argument values for nagios check commands

Posted: Thu Nov 04, 2010 1:51 pm
by Guest
--20cf3005dcd6e3188804943b4877
Content-Type: text/plain; charset=ISO-8859-1

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.

--20cf3005dcd6e3188804943b4877
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Hi all!I was wondering if it is possible (or would be easy to imple=
ment) default values for nagios check commands. Let me explain.I wo=
uld like my nagios configuration to be as transparent as possible, which al=
so means it should be as small as possible (no duplicated definitions). Thi=
s works fine if you have homogenic host family. Once you start hitting dive=
rsity 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 commanddefine command{=A0=A0=A0=A0=A0=A0=A0 command_name=
=A0=A0=A0 check-metric_sys-intr=A0=A0=A0=A0=A0=A0=A0 command_line=A0=A0=
=A0 $USER3$/check_ganglia $HOSTNAME$ sys_intr less 2000 5000}### Se=
cond command for hosts that do not fall into the average

define command{=A0=A0=A0=A0=A0=A0=A0 command_name=A0=A0=A0 check-metric=
_sys-intr_custom=A0=A0=A0=A0=A0=A0=A0 command_line=A0=A0=A0 $USER3$/che=
ck_ganglia $HOSTNAME$ sys_intr less $ARG1$ $ARG2$}##### The=
n there are service definitions
### For average host
define service{=A0=A0=A0=A0=A0=A0=A0 use service_check-metric_sys-intr=
=A0=A0=A0 # Defined previously as template with "register 0"=
=A0=A0=A0=A0=A0=A0=A0 host_name=A0=A0=A0 <a href=3D"http:/

...[email truncated]...


This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]