[PATCH] new feature: automatic services for host (v2)

Ignacio Goyret igoyret at alcatel-lucent.com
Fri Dec 12 23:37:42 CET 2008


Hi all,
Here is the updated patch that I promised a while back.

There are a few differences with the previous version of this patch:

- The automatic instantiation of services is now done from a function
  separate from xodtemplate_end_object_definition(), although it is
  still called at that time. Having it as a separate function should
  make it a bit easier to move where the auto-instantiation is done
  to a more suitable location so templates could be supported.

- Support for "+". This is a new concept in nagios.
  After listening to complaints from several of our people and
  looking at our own config files, the addition of the "+"
  functionality makes the config files a lot easier to read
  since each new line _adds_  to whatever was specified before.
  The support for "+" was written as a separate function that
  happens to be used by "services" but it can easily be used
  by other string properties.

- Cleanup, as recommended by review comments.


What does it do?

The patch adds a new directive "services" to the "host" definitions.
This new directive lists one or more "service" templates which
are used to automatically create "service" definitions for
the host.

The following sequence:

    define host{
        host_name         bogus
        address           192.168.1.254
        services          template-check-1, template-check-2
        ...
    }

is exactly equivalent to the following sequence:

    define host{
        host_name         bogus
        address           192.168.1.254
        ...
    }
    define service {
        host_name         bogus
        use               template-check-1
    }
    define service {
        host_name         bogus
        use               template-check-2
    }

Alternatively (using "+" support), you could write the above example
as follows:

    define host{
        host_name         bogus
        address           192.168.1.254
        services          + template-check-1
        services          + template-check-2
        ...
    }

Enjoy!
-Ignacio
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nagios-cvs-auto-services-v2.u
Type: application/octet-stream
Size: 10553 bytes
Desc: not available
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20081212/b73d9639/attachment.obj>
-------------- next part --------------
------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
-------------- 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