Hostgroup tricks?

Frost, Mark {PBC} mark.frost1 at pepsico.com
Tue Nov 8 16:37:13 CET 2011



From: Tim AtLee [mailto:T.AtLee at cfertech.com]
Sent: Tuesday, November 08, 2011 9:46 AM
To: nagios-users at lists.sourceforge.net
Subject: [Nagios-users] Hostgroup tricks?

Hello

I have a hostgroup defined as:
define hostgroup {
        hostgroup_name          ping-servers
        alias                   Pingable hosts
        members                 *
}

I have recently added a host outside our firewall that has ping disabled.  I have changed the host's check_command to be 'check_tcp!80' so that the host won't be offline permanently, but I am wondering if there is a way to exclude this host from the 'ping-servers' hostgroup in the host definition?

Ideally, something like:
define host {
        host_name       outsidefirewallhost
        alias           Host outside firewall
        address         some.ip.address
        use             generic-host

        hostgroup    !ping-servers
}

This generates an error when I test the configuration.  The only way I have been able to achieve this is to change the ping-servers hostgroup definition to exclude this individual host (*,!outsidefirewallhost), but I'd rather keep the exclusion define in the host, not in the "blanket rule".

Maybe it's just me being OCD...  but is this possible?

Thanks,

Tim

Tim,

I'm a  little unclear about your question.  Are you trying to alter the "Host Check Command" for a single host definition?  That is, the method used by Nagios to determine if a host is up or not?  If that's the case, you can just override the definition for that one host:

define host {
        host_name       outsidefirewallhost
        alias           Host outside firewall
        address         some.ip.address
        check_command   check-tcp-port-80
        use             generic-host

}

Check the docs for information on precedence, but your "generic-host" inclusion will specify a check_command (usually ping or better yet fping), but defining a different value in the definition itself can override that for the specific definition.

If that's not what you mean, and you want to change a specific service to check everything in that hostgroup except that one host, that would look something like

define service {
        hostgroup_name  ping-servers
        host_name       !outsidefirewallhost
        service_description           My Service
        check_command   run-a-ping
        use             generic-service

}

Hopefully I've understood your question...

Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20111108/5c1525cc/attachment.html>
-------------- next part --------------
------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
-------------- next part --------------
_______________________________________________
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