Page 1 of 1

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

Posted: Fri Dec 12, 2008 10:38 pm
by Guest
--=====================_965714625==_
Content-Type: text/plain; charset="us-ascii"

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
--=====================_965714625==_
Content-Type: application/octet-stream; name="nagios-cvs-auto-services-v2.u"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="nagios-cvs-auto-services-v2.u"

SW5kZXg6IGh0bWwvZG9jcy9vYmplY3RkZWZpbml0aW9ucy5odG1sCj09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KUkNTIGZp
bGU6IC9jdnNyb290L25hZ2lvcy9uYWdpb3MvaHRtbC9kb2NzL29iamVjdGRlZmluaXRpb25zLmh0
bWwsdgpyZXRyaWV2aW5nIHJldmlzaW9uIDEuMTkKZGlmZiAtdSAtcCAtcjEuMTkgb2JqZWN0ZGVm
aW5pdGlvb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b3JkaW5hCiBUaGlzIHZhcmlhYmxlIGlz
IHVzZWQgdG8gZGVmaW5lIGNvb3JkaW5hdGVzIHRvIHVzZSB3aGVuIGRyYXdpbmcgdGhlIGhvc3Qg
aW4gdGhlIDxhIGhyZWY9ImNnaXMuaHRtbCNzdGF0dXN3cmxfY2dpIj5zdGF0dXN3cmw8L2E+IENH
SS4gIENvb3JkaW5hdGVzIGNhbiBiZSBwb3NpdGl2ZSBvciBuZWdhdGl2ZSByZWFsIG51bWJlcnMu
ICBUaGUgb3JpZ2luIGZvciBkcmF3aW5nIGlzICgwLjAsMC4wLDAuMCkuICBGb3IgcmVmZXJlbmNl
LCB0aGUgc2l6ZSBvZiB0aGUgaG9zdCBjdWJlcyBkcmF3biBpcyAwLjUgdW5pdHMgb24gZWFjaCBz
aWRlICh0ZXh0IHRha2VzIGEgbGl0dGxlIG1vcmUgc3BhY2UpLiAgVGhlIGNvb3JkaW5hdGVzIHlv
dSBzcGVjaWZ5IGhlcmUgYXJlIHVzZWQgYXMgdGhlIGNlbnRlciBvZiB0aGUgaG9zdCBjdWJlLg0K
IDwvdGQ+D

...[email truncated]...


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