Page 1 of 1

Service Escalation wildcards

Posted: Wed Feb 18, 2015 2:38 pm
by danslarge
Is it possible in Nagios Core 3.4.1 (or later) to have something like this:

define serviceescalation{
hostgroup_name HOSTGROUP1, HOSTGROUP2, etc.
service_description *
other escalation directives ...
}

such that all service checks for any host in said hostgroup(s) is escalated. That is, it works for various types of hosts even if service descriptions vary. I've tried to figure this out but no success so far.

Re: Service Escalation wildcards

Posted: Wed Feb 18, 2015 3:44 pm
by tmcdonald
http://nagios.sourceforge.net/docs/3_0/ ... ricks.html
If you want to create service escalations for all services assigned to a particular host, you can use a wildcard in the service_description directive.

Re: Service Escalation wildcards

Posted: Wed Feb 25, 2015 12:45 pm
by danslarge
Thanks. I have set that up on a host basis, but not with a hostgroup encompassing several diverse hosts. We have a distributed nagios setup and I want to have hostgroups for all hosts in each distributed node and then use wildcards to configure service escalations for any service in any host within that hostgroup. This works great for host escalations but on service escalations, I keep getting the dreaded "can't expand..." error when I pre-flight nagios configs on the central server where I setting this up.

Re: Service Escalation wildcards

Posted: Wed Feb 25, 2015 3:02 pm
by abrist
Are these services in question distinct service definitions for each host, or are they inherited through hostgroups to said hosts?

Re: Service Escalation wildcards

Posted: Fri Feb 27, 2015 12:26 pm
by danslarge
ah, that's a good question.

We have been using a mixture. For instance we have a "hostgroup" ssh.cfg that is defined as a service as well as a hostgroup such that any host that we want to monitor ssh on can just have the ssh hostgroup added to the host definition.

We also use service definitions directly associated with host definitions in some instances.

Do you think that's the problem?

Re: Service Escalation wildcards

Posted: Mon Mar 02, 2015 11:00 am
by jdalrymple
This is very likely the problem you're experiencing.

When you try to use the wildcard configuration as tmcdonald suggested do you get the expected behavior from ANY of the services such as those which are inherited through hostgroup definitions? Or does the wildcard expansion seem to not work for you at all?

Re: Service Escalation wildcards

Posted: Thu Mar 05, 2015 7:55 pm
by danslarge
Yes, but to be specific:

I'm trying to break this down into individual hostgroups based on client/site name. That is, every host for a particular client/site is a member of a hostgroup e.g. "acme" so I can tailor escalations to the correct contact group on a client by client basis. I've done this successfully for one smaller client. Here's an example:

Code: Select all

define serviceescalation{
        hostgroup_name          acme
        service_description     *
        contact_groups          acme_sms
        first_notification      2
        last_notification       0
        notification_interval   15
        escalation_period       24x7
        escalation_options      u,c
        }
This client has a mixture of services assigned directly to the host as well as using the service hostgroup mechanism I've described earlier (i.e. an ssh hostgroup for all devices being checked for ssh). This works for this client with a handfull of host devices.

I then did this same process on a larger client with more servers & network devices. After carefully making sure there was at least on service defined for every host, when running:

/usr/sbin/nagios3 -v /etc/nagios3/nagios.cfg

I get the dreaded error: Could not expand services specified in service escalation...

Any ideas on why this is happening? Is there a way to find out what it is triping up on?

Re: Service Escalation wildcards

Posted: Fri Mar 06, 2015 2:55 pm
by ssax
Please post the results of the following:

Code: Select all

grep use_regexp_matching /usr/local/nagios/etc/nagios.cfg
It should be set to 0.

Re: Service Escalation wildcards

Posted: Mon Mar 09, 2015 1:48 pm
by danslarge
My path is different, but it is zero:

Code: Select all

dan@nagios:~$ grep use_regexp_matching /etc/nagios3/nagios.cfg                    
use_regexp_matching=0

Re: Service Escalation wildcards

Posted: Mon Mar 09, 2015 3:35 pm
by scottwilkerson
danslarge,

Does every host in hostgroup acme have the same services, or are there services on some hosts that are not on others?

The config you showed should work, but ALL of the hosts must have ALL the same services