Page 1 of 2

Hostgroups and servicegroups escalation not working

Posted: Mon Sep 19, 2016 2:48 pm
by eloyd
Simple service escalations using hostgroups and servicegroups in Nagios Core 4.1.1 isn't working. I see conflicting results in the forums that it should or shouldn't. Documentation at https://assets.nagios.com/downloads/nag ... escalation says nothing about a servicegroup_name or servicegroups parameter (source code shows it's looking for servicegroup, servicegroups, or servicegroup_name).

However, documentation at https://assets.nagios.com/downloads/nag ... escalation says it's possible (search for "All Services In Multiple Servicegroups").

So if I do the following, I get a valid escalation (yes, "eloyd" is a valid contact):

Code: Select all

define serviceescalation{
        hostgroup_name          public
        service_description     Port:80
        first_notification      2
        last_notification       0
        notification_interval   30
        contacts                eloyd
        }
If I change service_description to servicegroup_name or servicegroups, I get an invalid config check result:

Code: Select all

define serviceescalation{
        hostgroup_name          public
        servicegroups           Ports
        first_notification      2
        last_notification       0
        notification_interval   30
        contacts                eloyd
        }

Nagios Core 4.1.1
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-19-2015
License: GPL

Website: https://www.nagios.org
Reading configuration data...
   Read main config file okay...
   Error processing object config files!


***> One or more problems was encountered while processing the config files...

     Check your configuration file(s) to ensure that they contain valid
     directives and data defintions.  If you are upgrading from a previous
     version of Nagios, you should be aware that some variables/definitions
     may have been removed or modified in this version.  Make sure to read
     the HTML documentation regarding the config files, as well as the
     'Whats New' section to find out what has changed.
So which is it, and how can I get it to work? And why isn't it spewing out an appropriate error during the verification run?

Re: Hostgroups and servicegroups escalation not working

Posted: Tue Sep 20, 2016 10:48 am
by lmiltchev
The example from the second link shows that you need to use the "servicegroup_name" directive...
define serviceescalation{
servicegroup_name SERVICEGROUP1,SERVICEGROUP2,...,SERVICEGROUPN
other escalation directives ...
}
but you are using "servicegroups"...
define serviceescalation{
hostgroup_name public
servicegroups Ports
first_notification 2
last_notification 0
notification_interval 30
contacts eloyd
}
Can you try changing that to see if this is going to fix the issue?

Re: Hostgroups and servicegroups escalation not working

Posted: Tue Sep 20, 2016 10:59 am
by eloyd
If I change service_description to servicegroup_name or servicegroups, I get an invalid config check result:
I may not have made this clear, but if I do servicegroups, servicegroup, servicegroup_name, servicegroups_name, or servicegroup_names, it doesn't work. Basically, if I use anything that shows in the sourcecode, I get an error but no information about that error. If I use something that doesn't show up in the source code (such as "servicegroup_names") then I get a normal error:

Code: Select all

Website: https://www.nagios.org
Reading configuration data...
   Read main config file okay...
Error: Invalid serviceescalation object directive 'servicegroup_names'.
Error: Could not add object property in file '/usr/local/nagios/etc/sv/sv_escalations.cfg' on line 3.
   Error processing object config files!

Re: Hostgroups and servicegroups escalation not working

Posted: Tue Sep 20, 2016 3:38 pm
by lmiltchev
OK, it seems like the problem is in Nagios XI as at the moment, there is no "service group" option available under the "Service Escalation Management". Other words, the only way to make the "time-saving" tricks work (All Services In Multiple Servicegroups) in XI is to put your config in the static.

I tested the following config in the static:

Code: Select all

define serviceescalation{
		servicegroup_name		NCPA,NRPE
		first_notification      2
      last_notification       0
      notification_interval   30
		contacts	nagiosadmin
		}
and after restarting nagios, I could see ALL of the services, members of the NCPA & NRPE servicegroups in the service escalations in the objects.cache.

I believe this is a good candidate for a feature request. We should really add this functionality to the service escalations. Let me know if you want me to post an internal FR.

Re: Hostgroups and servicegroups escalation not working

Posted: Tue Sep 20, 2016 3:51 pm
by eloyd
Core. Don't care about XI. It's not working in Core 4.1.1. :)

Re: Hostgroups and servicegroups escalation not working

Posted: Tue Sep 20, 2016 4:31 pm
by lmiltchev
If you set up a service escalation as such:

Code: Select all

define serviceescalation{
servicegroup_name Ports
first_notification 2
last_notification 0
notification_interval 30
contacts eloyd
}
and restart nagios, do you see all members of the "Ports" service group (host,service pair) in the service escalations in the objects.cache?

Re: Hostgroups and servicegroups escalation not working

Posted: Wed Sep 21, 2016 9:10 am
by eloyd
Yes, that works, and creates escalations for all services in the port groups on all hosts that they run on. But that's not what I want. I want to be able to specify the hostgroup_name as well, to limit the escalations to those in the "public" host group. It is this combination of hostgroup_name and servicegroup_name that fails. And Nagios provides no error condition as to why it fails on the configuration verify:

Code: Select all

define serviceescalation{
        hostgroup_name public
        servicegroup_name Ports
        first_notification 2
        last_notification 0
        notification_interval 30
        contacts eloyd


# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Nagios Core 4.1.1
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-19-2015
License: GPL

Website: https://www.nagios.org
Reading configuration data...
   Read main config file okay...
   Error processing object config files!


***> One or more problems was encountered while processing the config files...

     Check your configuration file(s) to ensure that they contain valid
     directives and data defintions.  If you are upgrading from a previous
     version of Nagios, you should be aware that some variables/definitions
     may have been removed or modified in this version.  Make sure to read
     the HTML documentation regarding the config files, as well as the
     'Whats New' section to find out what has changed.

#

Re: Hostgroups and servicegroups escalation not working

Posted: Wed Sep 21, 2016 2:14 pm
by jfrickson
Post a bug report on github for verify not flagging that as a problem.

If you want you can also post a feature request to allow specifying both.

The bug I could get to fairly soon, the FR would take longer.

Re: Hostgroups and servicegroups escalation not working

Posted: Mon Feb 06, 2017 12:05 pm
by welldynesystems
We are also looking for service group based escalation to be added to the interface. Was this ever submitted?

Re: Hostgroups and servicegroups escalation not working

Posted: Mon Feb 06, 2017 12:38 pm
by eloyd
I can't remember. But I did find this: https://github.com/NagiosEnterprises/na ... /issues/65