Re: [Nagios-devel] Default argument values for nagios check commands
Posted: Wed Nov 10, 2010 2:28 am
--001636284b987663330494a99d25
Content-Type: text/plain; charset=ISO-8859-1
On 5 November 2010 10:59, Andreas Ericsson wrote:
> On 11/04/2010 03:50 PM, Bostjan Skufca wrote:
> > Hi all!
> >
> > I was wondering if it is possible (or would be easy to implement) default
> > values for nagios check commands.
>
> Try and find out
>
I definitely will, as soon as I catch enough spare time to do it. Or when
modifying nagios config pisses me off just right
> > 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$
> > }
> >
>
> Neat idea.
>
> I don't have time for it just now though, so unless someone else steps
> in, this will have to wait. If you can't do it yourself, or pay someone
> to do it for you, I'd suggest you get an account at tracker.nagios.org
> and submit this as a feature-request.
>
I know how this works, paying vs doing it myself, but thanks anyway:)
Ah yes, that's what I was after, request tracker - so it does not get
forgotten. Done.
>
> Since it's already possible to do with a fairly easy workaround, it
> probably won't get a high priority though, but it might be fun as an
> exercise for someone who wants to try out their programming wings.
>
> >
> > I have not yet dug into nagios internals, but would this be possible
> without
> > too much hassle?
>
> Yes. Look in get_raw_command_line_r() and add your 30-40 lines of code
> there.
>
Well, I believe I should be looking into process_macros() first. This
get_raw_command_line_r() does not exist, only variation without _r.
Thanks for hint!
Best regards,
b.
--001636284b987663330494a99d25
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
On 5 November 2010 10:59, Andreas Ericsson <[email protected]> wrote:
On 11/04/2010 03:50 PM, Bostjan Skufca wrote:
</d
...[email truncated]...
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
Content-Type: text/plain; charset=ISO-8859-1
On 5 November 2010 10:59, Andreas Ericsson wrote:
> On 11/04/2010 03:50 PM, Bostjan Skufca wrote:
> > Hi all!
> >
> > I was wondering if it is possible (or would be easy to implement) default
> > values for nagios check commands.
>
> Try and find out
>
I definitely will, as soon as I catch enough spare time to do it. Or when
modifying nagios config pisses me off just right
> > 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$
> > }
> >
>
> Neat idea.
>
> I don't have time for it just now though, so unless someone else steps
> in, this will have to wait. If you can't do it yourself, or pay someone
> to do it for you, I'd suggest you get an account at tracker.nagios.org
> and submit this as a feature-request.
>
I know how this works, paying vs doing it myself, but thanks anyway:)
Ah yes, that's what I was after, request tracker - so it does not get
forgotten. Done.
>
> Since it's already possible to do with a fairly easy workaround, it
> probably won't get a high priority though, but it might be fun as an
> exercise for someone who wants to try out their programming wings.
>
> >
> > I have not yet dug into nagios internals, but would this be possible
> without
> > too much hassle?
>
> Yes. Look in get_raw_command_line_r() and add your 30-40 lines of code
> there.
>
Well, I believe I should be looking into process_macros() first. This
get_raw_command_line_r() does not exist, only variation without _r.
Thanks for hint!
Best regards,
b.
--001636284b987663330494a99d25
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
On 5 November 2010 10:59, Andreas Ericsson <[email protected]> wrote:
On 11/04/2010 03:50 PM, Bostjan Skufca wrote:
</d
...[email truncated]...
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]