Page 1 of 1

Problem with Escalation

Posted: Tue Mar 17, 2020 8:58 am
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,

Re: Problem with Escalation

Posted: Tue Mar 17, 2020 4:18 pm
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
}

Re: Problem with Escalation

Posted: Wed Mar 18, 2020 2:42 am
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.

Re: Problem with Escalation

Posted: Wed Mar 18, 2020 7:38 am
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

Re: Problem with Escalation

Posted: Wed Mar 18, 2020 9:23 am
by danjoh
OK, I'll try to update to 4.4.5 tomorrow and test again.

Re: Problem with Escalation

Posted: Wed Mar 18, 2020 9:26 am
by scottwilkerson
danjoh wrote:OK, I'll try to update to 4.4.5 tomorrow and test again.
Sounds good

Re: Problem with Escalation

Posted: Thu Mar 19, 2020 4:39 am
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,

Re: Problem with Escalation

Posted: Thu Mar 19, 2020 7:19 am
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