Multiple services with the same service_description directives

Noah Leaman noah at mac.com
Thu Jan 29 06:08:26 CET 2004


Is this a safe? It seems to work. I don't see anything mentioned in the 
Object Inheritance or the Time-Saving Tricks For Template-Based Object 
Definitions sections of the docs 
(http://nagios.sourceforge.net/docs/1_0/templatetricks.html and 
http://nagios.sourceforge.net/docs/1_0/templatetricks.html). It seems 
though it's a result of template object inheritance.

define service {
  use					generic-service-template
  service_description		Ping Test
  hostgroup_name		wan-us,lan-us
  check_command		check_ping!200.0,50%!1000.0,90%
}
define service {
  use					generic-service-template
  service_description		Ping Test
  hostgroup_name		lan-euro,wan-euro
  check_command		check_ping!3000.0,80%!5000.0,100%
}

< From the nagios docs >
This directive is used to define the description of the service, which 
may contain spaces, dashes, and colons (semicolons, apostrophes, and 
quotation marks should be avoided). No two services associated with the 
same host can have the same description. Services are uniquely 
identified with their host_name and service_description directives.
</From the nagios docs >

So it works as long as one host is assigned to both services of the 
same description... which does makes sense. But knowing that "No two 
services associated with the same host can have the same description," 
I find it useful to "reuse" service descriptions across multiple 
definitions.

For example, I can set up an SNMP based service for routers that have 
different read community strings:

define service {
  use					generic-service-template
  service_description          Uptime
  hostgroup_name              wan-us,lan-us
  check_command              check_snmp_uptime!ReadCommunity1
}
define service {
  use					generic-service-template
  service_description          Uptime
  hostgroup_name              wan-us,lan-us
  check_command              check_snmp_uptime!ReadCommunity2
}
define service {
  use					generic-service-template
  service_description          Uptime
  hostgroup_name              wan-asia,lan-asia
  check_command              check_dummy
  active_checks_enabled  0
}

The cool thing here is that I don't have to change the service 
description for what is essentially the same service check (even for 
the passive checks I have being done on a distribution server). So they 
all show up with the same sevice desc even though they are configured 
slightly differently.

Is this a safe or am I going to run into problems?

-- 
Noah



-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list