3

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?

1 Answer 1

6

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".

3
  • 1
    This works for removing so thank you. Is there any way to still keep the check but increase the Warning / critical level for just this one host?
    – Gray Race
    Jan 25, 2012 at 21:36
  • 1
    You'd have to parameterize the Command Argument Macros and separate them with "!"s then overwrite the argument for that particular host.
    – dmourati
    Jan 26, 2012 at 6:59
  • 2
    In the case of check_nrpe, the warning/critical thresholds are defined on the other end, in nrpe.cfg, by default. So... you can define separate warning/crit thresholds on each host. If you're using ARGs with NRPE, you'd have to do as dmourati suggested, above, and define a new check command for just 'unixlab' that has different thresholds (e.g., "check_nrpe_with_args!check_total_procs!100 200" or similar)
    – Keith
    Feb 13, 2012 at 20:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .