How to Null an inherited service check in nagios

nagios

We have a nagios setup that uses inheritance to a larger degree than I am used to. I’ve read the documentation at:

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

But I still can’t get my head around how to accomplish my goal.

I have server/host that has notified for procs warning. I investigated this and it is a known bug and safely ignored for this specific server. Ideally I’d like to increase the warning/critical points for the service definition for just this host; but I’m also comfortable just not using this service check until a patch for the current problem is issued. Disabling via the web interface is not an acceptable option for my mangers.

Service definition:

define service{
            use                             unix-agent-service
            hostgroup_name                  linux-servers
            service_description             Agent: Total Processes
            check_command                   check_nrpe!check_total_procs
    }

The host definition:

define host{
        use                     linux-server
        host_name               unixlab
        alias                   Unix Lab
        address                 PRIVATE
        }

Group/server Definition:

define host{
        name                            linux-server
        use                             generic-host
        alias                           Linux server
        hostgroups                      linux-servers
        register                        0
        }

The host inherits all the services defined in the hostgroup linux-servers. I’ve tried giving the service check a name and then setting that name to null in the host definition, but I think this syntax is wrong and/or I’m not understanding that part of inheritance:

define service{
        **name                                            agent-total-processes** 
       use                                             unix-agent-service
        hostgroup_name                  linux-servers
        service_description             Agent: Total Processes
        check_command                   check_nrpe!check_total_procs
}

The host definition:

define host{
        use                     linux-server
        host_name               unixlab
        alias                   Unix Lab
        address                 PRIVATE
        **agent-total-processes    null**
}

I’m sure I’m missing something obvious… based on my reading of inheritance this should be possible but I’m not able to wrap my head around it.

Thoughts?

Best Answer

In the service definition, you can exclude (using !) the particular host that you don't want to run it on:

define service {
        use                             unix-agent-service
        hostgroup_name                  linux-servers
        host_name                       !unixlab
        service_description             Agent: Total Processes
        check_command                   check_nrpe!check_total_procs
}

This will leave the service applied to every member of "linux-servers", except "unixlab".