Discussion:
[Nagios-users] service escalation on all services of all hosts
Michael Barrett
2011-06-06 21:12:02 UTC
Permalink
Hi, I'm having a problem with an example given in the Tips & Tricks documentation page. Currently I'm running: Nagios Core 3.2.0

Anyway, the tip I'm trying is from here http://nagios.sourceforge.net/docs/nagioscore/3/en/objecttricks.html#serviceescalation

The particular tip reads:

All Services On Same Host:
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. The definition below would create a service escalation for all services on host HOST1. All the instances of the service escalation would be identical (i.e. have the same contact groups, notification interval, etc.).

If you feel like being particularly adventurous, you can specify a wildcard in both the host_name and service_description directives. Doing so would create a service escalation for all services that you've defined in your configuration files.

##########

So I tried the following:

define serviceescalation {
name email-all
first_notification 1
last_notification 0
notification_interval 120
contact_groups ops-group

register 0
}

define serviceescalation {
use email-all
host_name *
service_description *
}

And when I go to restart nagios I get the following:

Error: Could not expand hostgroups and/or hosts specified in service (config file '/etc/nagios3/conf.d/services.cfg', starting on line 34)
Error processing object config files!


Anyone know why this is a problem? Am I missing something in the documentation, or is it just incorrect?

--
Michael Barrett
***@gmail.com
Paul M. Dubuc
2011-06-07 17:29:10 UTC
Permalink
Hi, I'm having a problem with an example given in the Tips& Tricks documentation page. Currently I'm running: Nagios Core 3.2.0
Anyway, the tip I'm trying is from here http://nagios.sourceforge.net/docs/nagioscore/3/en/objecttricks.html#serviceescalation
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. The definition below would create a service escalation for all services on host HOST1. All the instances of the service escalation would be identical (i.e. have the same contact groups, notification interval, etc.).
If you feel like being particularly adventurous, you can specify a wildcard in both the host_name and service_description directives. Doing so would create a service escalation for all services that you've defined in your configuration files.
##########
define serviceescalation {
name email-all
first_notification 1
last_notification 0
notification_interval 120
contact_groups ops-group
register 0
}
define serviceescalation {
use email-all
host_name *
service_description *
}
Error: Could not expand hostgroups and/or hosts specified in service (config file '/etc/nagios3/conf.d/services.cfg', starting on line 34)
Error processing object config files!
Anyone know why this is a problem? Am I missing something in the documentation, or is it just incorrect?
You probably have some hosts that have no services assigned. Using the
wildcard for both host_name and service_description will not work in that
case, unfortunately. All hosts specified MUST have a service that matches the
given service_description or you will get this error.

Paul Dubuc
Michael Barrett
2011-06-07 17:46:48 UTC
Permalink
Ahh, ok, that would explain it. That's a bummer. Thanks.
Hi, I'm having a problem with an example given in the Tips& Tricks documentation page. Currently I'm running: Nagios Core 3.2.0
Anyway, the tip I'm trying is from here http://nagios.sourceforge.net/docs/nagioscore/3/en/objecttricks.html#serviceescalation
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. The definition below would create a service escalation for all services on host HOST1. All the instances of the service escalation would be identical (i.e. have the same contact groups, notification interval, etc.).
If you feel like being particularly adventurous, you can specify a wildcard in both the host_name and service_description directives. Doing so would create a service escalation for all services that you've defined in your configuration files.
##########
define serviceescalation {
name email-all
first_notification 1
last_notification 0
notification_interval 120
contact_groups ops-group
register 0
}
define serviceescalation {
use email-all
host_name *
service_description *
}
Error: Could not expand hostgroups and/or hosts specified in service (config file '/etc/nagios3/conf.d/services.cfg', starting on line 34)
Error processing object config files!
Anyone know why this is a problem? Am I missing something in the documentation, or is it just incorrect?
You probably have some hosts that have no services assigned. Using the wildcard for both host_name and service_description will not work in that case, unfortunately. All hosts specified MUST have a service that matches the given service_description or you will get this error.
Paul Dubuc
--
Michael Barrett
***@gmail.com
Paul M. Dubuc
2011-06-07 18:11:44 UTC
Permalink
Post by Michael Barrett
Ahh, ok, that would explain it. That's a bummer. Thanks.
One way around this is to create a host group where you put hosts that have
services assigned:

define hostgroup{
hostgroup_name ServiceHosts
alias Hosts with Services Assigned
register 0 ; hide this hostgroup unless you want it displayed.
}

Then use a template that assigns hosts to this group:

define host{
name service-host
register 0 ; this is a template

hostgroups +ServiceHosts ; add host to this hostgroup
}

Make sure every host definition that has services assigned has the
use service-host
directive in it (or uses a template that does). Alternatively you can just
assign the services to the ServiceHosts group in the service definitions
instead of using this host template.

Then you can define your escalation this way:

define serviceescalation {
use email-all
hostgroup_name ServiceHosts
service_description *
}

Hope this helps.

Paul Dubuc
Post by Michael Barrett
Hi, I'm having a problem with an example given in the Tips& Tricks documentation page. Currently I'm running: Nagios Core 3.2.0
Anyway, the tip I'm trying is from here http://nagios.sourceforge.net/docs/nagioscore/3/en/objecttricks.html#serviceescalation
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. The definition below would create a service escalation for all services on host HOST1. All the instances of the service escalation would be identical (i.e. have the same contact groups, notification interval, etc.).
If you feel like being particularly adventurous, you can specify a wildcard in both the host_name and service_description directives. Doing so would create a service escalation for all services that you've defined in your configuration files.
##########
define serviceescalation {
name email-all
first_notification 1
last_notification 0
notification_interval 120
contact_groups ops-group
register 0
}
define serviceescalation {
use email-all
host_name *
service_description *
}
Error: Could not expand hostgroups and/or hosts specified in service (config file '/etc/nagios3/conf.d/services.cfg', starting on line 34)
Error processing object config files!
Anyone know why this is a problem? Am I missing something in the documentation, or is it just incorrect?
You probably have some hosts that have no services assigned. Using the wildcard for both host_name and service_description will not work in that case, unfortunately. All hosts specified MUST have a service that matches the given service_description or you will get this error.
Paul Dubuc
--
Michael Barrett
Loading...