Default argument values for nagios check commands
Bostjan Skufca
bostjan at a2o.si
Wed Nov 10 03:28:38 CET 2010
On 5 November 2010 10:59, Andreas Ericsson <ae at op5.se> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20101110/3021bf44/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