Service Escalation wildcards

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
danslarge
Posts: 5
Joined: Wed May 28, 2014 1:37 pm

Service Escalation wildcards

Post 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.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Service Escalation wildcards

Post 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.
Former Nagios employee
danslarge
Posts: 5
Joined: Wed May 28, 2014 1:37 pm

Re: Service Escalation wildcards

Post 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.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Service Escalation wildcards

Post by abrist »

Are these services in question distinct service definitions for each host, or are they inherited through hostgroups to said hosts?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
danslarge
Posts: 5
Joined: Wed May 28, 2014 1:37 pm

Re: Service Escalation wildcards

Post 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?
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Service Escalation wildcards

Post 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?
danslarge
Posts: 5
Joined: Wed May 28, 2014 1:37 pm

Re: Service Escalation wildcards

Post 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?
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Service Escalation wildcards

Post 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.
danslarge
Posts: 5
Joined: Wed May 28, 2014 1:37 pm

Re: Service Escalation wildcards

Post 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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Service Escalation wildcards

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked