Hostgroup tricks?

Tim AtLee T.AtLee at cfertech.com
Tue Nov 8 17:16:16 CET 2011


Hi Mark

Sorry for the lack of clarity.  Learned a valuable lesson in "don't email before coffee"... :)

I was successful in altering the Host Check Command for the individual host - that was clear from the documentation.

I am trying to remove this host from the "ping-servers" without altering the definition for the service or the hostgroup.  So right now, the service and hostgroup's are defined as:

define service {
        hostgroup_name          ping-servers
        service_description     PING
        check_command           check_ping!50.0,20%!100.0,60%
        use                     generic-service,graphed-service
}

define hostgroup {
        hostgroup_name          ping-servers
        alias                   Pingable hosts
        members                 *
}

And the new host, outsidefirewallhost, I would like to exclude from the 'ping-servers' service - but without modifying the definitions for the service or the hostrgroup.

I have tried Brandon Phelps' suggestion, but as he found out, Nagios doesn't like the negation in the host configuration.

I have been successful with this:
define hostgroup {
        hostgroup_name          ping-servers
        alias                   Pingable hosts
        members                 *,!outsidefirewallhost
}

Should I just get over my personal hang-ups and implement it this way?

Thanks again,

Tim



From: Frost, Mark {PBC} [mailto:mark.frost1 at pepsico.com]
Sent: Tuesday, November 08, 2011 8:37 AM
To: Nagios Users List
Subject: Re: [Nagios-users] Hostgroup tricks?



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/e666a60d/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