Using nagios check_cluster for services

I could not figure out how to get this to work. I think it’s because I didn’t understand that the $ signs were being used to call a macro. I would like to document this in detail here for others in case you’re in the same boat.

Here is the command I’m using.

define command{
command_name check_service_cluster
command_line /usr/lib/nagios/plugins/check_cluster --service -c $ARG1$ -d "$ARG2$" -v
}

When using this command ARG1 indicates the threshold for non-ok data points at which a critical alert is returned. It uses the special threshold syntax.
An example:
@2:2 This means if there are exactly 2 data points in non-ok state return critical

ARG2 should be a comma-separated list of service statuses. The number 0 = OK. The number 2 = CRITICAL. A macro like the following will return the status of a service:
$SERVICESTATEID:host1:service1$

The following are two macros for two services separated by a comma:
$SERVICESTATEID:host1:service1$,$SERVICESTATEID:host2:service1$

The following check_command argument will monitor two services. The @2:2 means it will fail if 2 services are in a non-OK state. The service name is service1 and it will look on host1 and host2.
check_service_cluster!@2:2!$SERVICESTATEID:host1:service1$,$SERVICESTATEID:host2:service1$

Leave a Reply