New feature patch: using hostgroups or servicegroups as arguments to on-demand macros
Ethan Galstad
nagios at nagios.org
Sat Mar 27 03:20:12 CET 2004
This is a most excellent idea! I'll get this integrated into CVS
tonight.
On 26 Mar 2004 at 20:42, Christopher Gurnee wrote:
>
> On-demand macros are a great thing, and the check_cluster2 plug-in is
> a great way to use them. Unfortunately, if you want to use more than a
> few on-demand macros on a single line, it can be a bit of a pain (but
> of course, works just fine). This patch lets you use a hostgroup or
> servicegroup name as an argument to an on-demand macro, and then
> expands the macro appropriately with respect to all the members of the
> group. For example, instead of saying:
>
> check_command
> check_service_cluster!"DNS"!1!5!$SERVICESTATEID:dns-server-1:DNS$,$SER
> VI CESTATEID:dns-server-2:DNS$,...
>
> you can define a service group (using regular expressions in this
> case):
>
> define servicegroup{
> servicegroup_name All-DNS
> alias All DNS services
> members dns-server-[0-9]*,DNS
> }
>
> and then replace all of the SERVICESTATEID macros in the check_command
> with:
>
> $SERVICESTATEID:All-DNS:,$
>
> This will expand to all of the SERVICESTATEIDs of all of the services
> in the All-DNS servicegroup, separated by commas. After this patch,
> there are 4 ways to use on-demand macros:
>
> $HOSTMACRO:host$
> $HOSTMACRO:hostgroup:delimiter$
> $SERVICEMACRO:host:service$
> $SERVICEMACRO:servicegroup:delimiter$
>
> The delimiter is used to separate the results after expanded (it
> doesn't have to be a single character, but it will usually just be a
> comma). Note that this adds an ambiguity with on-demand service
> macros. In order to differentiate in between the last two lines above,
> Nagios will first try to expand an on-demand service macro as a
> $SERVICEMACRO:host:service$, and if that doesn't work (if host:service
> doesn't exist), then Nagios will try it as
> $SERVICEMACRO:servicegroup:delimiter$.
>
> Please be forewarned; although I've done a little testing, I can't be
> sure this doesn't introduce some new bug....
>
> Regards,
> Chris
>
Ethan Galstad,
Nagios Developer
---
Email: nagios at nagios.org
Website: http://www.nagios.org
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
More information about the Developers
mailing list