Default argument values for nagios check commands

Bostjan Skufca bostjan at a2o.si
Tue Nov 23 04:57:00 CET 2010


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:)

Thanks for your hints/help anyway!

Best regards,
Bostjan


On 10 November 2010 11:12, Andreas Ericsson <ae at op5.se> wrote:

> On 11/10/2010 03:28 AM, Bostjan Skufca wrote:
> > 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!
> >
>
> If you want to make modifications to Nagios, you'll need to get the
> latest sources from CVS.
>
> The changes will have to be made so that the object structure doesn't
> change if you want to get this before Nagios 4 (which is still a loooong
> way off).
>
> --
> Andreas Ericsson                   andreas.ericsson at op5.se
> OP5 AB                             www.op5.se
> Tel: +46 8-230225                  Fax: +46 8-230231
>
> Considering the successes of the wars on alcohol, poverty, drugs and
> terror, I think we should give some serious thought to declaring war
> on peace.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20101123/45418d0c/attachment.html>
-------------- next part --------------
------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-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