Trouble getting hostgroup exclusions to work

Justin Pasher justinp at newmediagateway.com
Wed Jan 14 18:52:56 CET 2009


Hello,

Nagios 3.0.6-2~bpo40+1 (Debian etch-backports)

I'm beginning to wonder whether what I want to accomplish is possible 
(since it's not officially documented). After seeing a post a few days 
ago, I discovered you could use an "!" in front of a hostname/hostgroup 
to exclude that host from a list. I decided to simplify my config a bit 
using this, and for the most part it works great. However, I noticed 
that when I tried to exclude an entire hostgroup, it wouldn't work.

My setup is a basic "define these hostgroups to identify the 'role' of a 
server and define a services block to attach a specific check to that 
hostgroup". Attached is the config snippet I am working with right now 
(simplified by reducing the number of hosts, but hopefully not too much 
to eliminate the problem). Basically, there are three levels of server 
load checks depending on what is considered a critical load. Most 
servers fall under the "linux-load" hostgroup and service, but a few 
need to be in a different one with a higher load threshold. I'm trying 
to accomplish this by excluding the servers in the "linux-load-big" and 
"linux-load-big2" from the "linux-load" group, but it's not working 
properly. All servers in the "linux-load-big" group are also showing up 
in the "linux-load" group. If I add a "members" directive within one of 
the hostgroups and specify individual host names, it will properly 
exclude that host. It just doesn't seem to be doing it when I try to 
exclude an entire hostgroup.

The docs say you can do this for a "service" block, but it doesn't 
specifically state you can do it for a hostgroup block, so that's why 
I'm wondering if it is even possible.

http://nagios.sourceforge.net/docs/3_0/objecttricks.html

Thanks.

----------------------------------------
define hostgroup {
    hostgroup_name      debian-servers
    alias               Debian GNU/Linux Servers
    members             debhost1,debhost2,debhost3,debhost4
}

define hostgroup {
    hostgroup_name      gentoo-servers
    alias               Gentoo GNU/Linux Servers
    members             gentoohost1
}

define hostgroup {
    hostgroup_name      redhat-servers
    alias               RedHat GNU/Linux Servers
    members             rhhost1,rhhost2,rhhost3,rhhost4
}

define hostgroup {
    hostgroup_name      linux-load
    alias               Linux Load Monitoring
    hostgroup_members   
debian-servers,gentoo-servers,redhat-servers,!linux-load-big,!linux-load-big2
}

define hostgroup {
    hostgroup_name      linux-load-big
    alias               Linux Load (big) Monitoring
    members             debhost3,debhost4
}

define hostgroup {
    hostgroup_name      linux-load-big2
    alias               Linux Load (big2) Monitoring
    members             rhhost3,rhhost4
}

define service {
    hostgroup_name      linux-load
    service_description LOAD
    check_command       check_nrpe_7arg!check_load!6.0!5.0!5.0!8.0!7.0!7.0
}

define service {
    hostgroup_name      linux-load-big
    service_description LOAD-BIG
    check_command       
check_nrpe_7arg!check_load!10.0!9.0!9.0!12.0!11.0!11.0
}

define service {
    hostgroup_name      linux-load-big2
    service_description LOAD-BIG2
    check_command       
check_nrpe_7arg!check_load!15.0!14.0!14.0!17.0!16.0!16.0
}
----------------------------------------


Justin Pasher


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list