Problem with Escalation

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
danjoh
Posts: 73
Joined: Mon Dec 07, 2015 10:43 am
Location: Zürich, Switzerland
Contact:

Problem with Escalation

Post by danjoh »

Hello!

I am playing around with Escalation and I have probably missed something.

I have tested two things. The first (the simple one) does not work at all.
Here I just added the following for one host:

Code: Select all

define serviceescalation {
        host_name                       <hostname>
        service_description             *
        contact_groups                  +escalation
        first_notification              5
        last_notification               0
        notification_interval           10
}
When I try this, "nagios -v /etc/nagios/nagios.cfg" comes back with this:

Code: Select all

 Reading configuration data...
   Read main config file okay...
Error: Service '<hostname>' on host '*' has an escalation but is not defined anywhere!
Error: Could not register service escalation (config file '/etc/nagios/conf.d/<hostname>.cfg', starting on line 100)
   Error processing object config files!
And, yes, I have "use_regexp_matching=1" in nagios.cfg.

What I want to achieve is to be able to escalate all services for one host without having to create a "serviceescalation" definition for each defined service.

Any suggestions on how to accomplish this?

Regards,
--
D/\N
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Problem with Escalation

Post by scottwilkerson »

Code: Select all

Reading configuration data...
   Read main config file okay...
Error: Service '<hostname>' on host '*' has an escalation but is not defined anywhere!
Error: Could not register service escalation (config file '/etc/nagios/conf.d/<hostname>.cfg', starting on line 100)
   Error processing object config files!
Did you somehow invert the <hostname> and * in the definition? or is there another one around line 100 of /etc/nagios/conf.d/<hostname>.cfg that is inverted because I just tested it with this and it worked fine:

Code: Select all

define serviceescalation {
    host_name                localhost
    service_description      *
    contact_groups           admins
    first_notification       5
    last_notification        0
    notification_interval    10
}
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
danjoh
Posts: 73
Joined: Mon Dec 07, 2015 10:43 am
Location: Zürich, Switzerland
Contact:

Re: Problem with Escalation

Post by danjoh »

No, I do not think I do...
Here is the complete host definition:

Code: Select all

define host {
        use                             linux-server,host-pnp
        host_name                       testhost
        _ZONE                           hostgroup_Zone2
}

define service {
        use                             local-service,srv-pnp
        service_description             Current Users
        host_name                       testhost
        check_command                   check_users!2!5
        contacts                        +sla_user
        notification_interval           10
}

define service {
        use                             local-service,srv-pnp
        service_description             Current Load
        host_name                       testhost
        check_command                   check_load!5.0,4.0,3.0!10.0,6.0,4.0
}

define serviceescalation {
        service_description             *
        host_name                       testhost
        contact_groups                  +escalation
        first_notification              5
        last_notification               0
        notification_interval           10
}
This gives:

Code: Select all

Reading configuration data...
   Read main config file okay...
Error: Service 'testhost' on host '*' has an escalation but is not defined anywhere!
Error: Could not register service escalation (config file '/etc/nagios/conf.d/Zone2/testhost.cfg', starting on line 23)
   Error processing object config files!
If I comment out the serviceescalation definition then everything looks good.

Could this be something related to the Nagios versions?
I am running "Nagios Core 4.3.4" at the moment.
--
D/\N
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Problem with Escalation

Post by scottwilkerson »

danjoh wrote: Could this be something related to the Nagios versions?
I am running "Nagios Core 4.3.4" at the moment.
I suppose that is possible, I was running 4.4.5 when I tested it
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
danjoh
Posts: 73
Joined: Mon Dec 07, 2015 10:43 am
Location: Zürich, Switzerland
Contact:

Re: Problem with Escalation

Post by danjoh »

OK, I'll try to update to 4.4.5 tomorrow and test again.
--
D/\N
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Problem with Escalation

Post by scottwilkerson »

danjoh wrote:OK, I'll try to update to 4.4.5 tomorrow and test again.
Sounds good
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
danjoh
Posts: 73
Joined: Mon Dec 07, 2015 10:43 am
Location: Zürich, Switzerland
Contact:

Re: Problem with Escalation

Post by danjoh »

:( Upgrading to 4.4.5 did not change anything - still got the exact same error.

Then after some testing with different approaches (among other things, define host and services without use of the "use" directive) I took "a long shoot" and changed

Code: Select all

service_description             *
to

Code: Select all

service_description             .*
(note the dot in front of *) in the serviceescalation definition, thinking there could be an issue with the regular expression matching.
And voilà, no more errors when doing the verify. I can also see a serviceescalation definition for each service for this host in objects.cache AND escalation notifications work.

So your regexp matching seems to differ from mine (mine seems to be more "strict").

Thanks for your time and keep up the good work.

Regards,
--
D/\N
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Problem with Escalation

Post by scottwilkerson »

danjoh wrote::( Upgrading to 4.4.5 did not change anything - still got the exact same error.

Then after some testing with different approaches (among other things, define host and services without use of the "use" directive) I took "a long shoot" and changed

Code: Select all

service_description             *
to

Code: Select all

service_description             .*
(note the dot in front of *) in the serviceescalation definition, thinking there could be an issue with the regular expression matching.
And voilà, no more errors when doing the verify. I can also see a serviceescalation definition for each service for this host in objects.cache AND escalation notifications work.

So your regexp matching seems to differ from mine (mine seems to be more "strict").

Thanks for your time and keep up the good work.

Regards,
Ahh that makes sense! Glad you got it working

Locking thread
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked