patch: servicegroup members expansion

Matthew Kent matt at bravenet.com
Mon Mar 29 10:53:17 CEST 2004


This patch adds a fallback to attempt hostgroup expansion during the
recombobulate phase for servicegroups before it errors out. 

This stems from trying the hostgroup and servicegroup macro expansion
that Christompher Gurnee submitted with check_cluster2. It works great,
but the problem I had is that my hosts don't share a common naming
scheme to easily servicegroup them with a regex (plus I'm lazy and don't
want to enumerate them all by hand).

One solution was to use the servicegroup line in my HTTP service
definitions, but this meant I could only specify one hostgroup and
servicegroup pair in each definition to keep the cluster results apart,
resulting in an extra 6 service definitions for the clustered checks.

But if we expand a hostgroup I can do simply:

define servicegroup {
servicegroup_name       pod1_http
alias                   Pod 1 Apaches
members                 pod1,HTTP
}

;defs for pod2,3 etc.

define service {
use                     service-cluster
hostgroup_name          pod1,pod2,pod3,pod4,pod5,pod6,core
service_description     HTTP
check_command           check_http_pods!1!3!/keepalive.html!Alive
notification_options    n
}

define service {
use                     service-critical
host_name               nagiosmaster
service_description     POD1_HTTP
check_command
check_service_cluster!"HTTP"!1!2!$SERVICESTATEID:pod1_http:,$
}

;defs for pod2,3 etc.

Saves me some more static values to update and reduces the number of
HTTP service definitions for clustering in my config from 7 to 1.

Thoughts?

-- 
Matthew Kent \ SA \ bravenet.com \ 1-250-954-3203 ext 108
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nagios-2.0a1-servicegroupmembers.patch
Type: text/x-patch
Size: 7626 bytes
Desc: not available
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20040329/27cbcbc5/attachment.bin>


More information about the Developers mailing list