setting both host and service check interval from templates
Posted: Mon Dec 16, 2013 9:49 am
Hi,
I'm currently working on a nagios server for our office, co-location and several servers for our customers. Most of the monitoring is working fine, but there is one issue I can't seem to find a solution for. Let's assume there are two servers (host_colocation and host_customer), one running in our co-location, the other running on our customers site. Both servers have OurSoftware (tm) running. I want to monitor our server (both host and service) very often, let's say every minute. There is no need to monitor our customers server (both host and service) that often. Once every hour is enough. The host check_interval can be set with templates. This works fine. But I want to set the service check_interval to the same value as the host check_interval. Below is a simplified version of the checks I'm currently using. Every host uses two templates. One for location, one for services.
This is the location template for all our co-location hosts. All these hosts are checked once every minute.
define host{
register 0
name template_host_colocation
use template_host_generic
check_interval 1
retry_interval 1
}
This is the location template for our customers' hosts. All these host are checked once every 60 minutes.
define host{
register 0
name template_host_customer
use template_host_generic
check_interval 60
retry_interval 60
}
There is the service template for our software. It is a host template for all hosts running our software. The template sets some custom variables (not shown in this example) and puts the host in a hostgroup.
define host{
register 0
name template_host_OurSoftware
hostgroups +hostgroup_OurSoftware
}
The hostgroup definition.
define hostgroup{
hostgroup_name hostgroup_OurSoftware
}
Every host in this hostgroup automatically gets a check for this service.
define service{
use template_service_generic
hostgroup_name hostgroup_OurSoftware
service_description OurSoftware
check_command check_OurSoftware
}
This is the definition for the co-location host. It uses one template for location and one template for services. The host check interval is inherited.
define host{
use template_host_colocation,template_host_OurSoftware
host_name colocation.example.org
}
This is the definition of the customer host.
define host{
use template_host_customer,template_host_OurSoftware
host_name customer.example.org
}
How can I set the check_interval for the services to different values on both servers? Can this be done in one of the templates or hostgroups? It can probably be set in a service template or servicegroup, but how would I add those to this host definition?
Cheers,
Maarten
I'm currently working on a nagios server for our office, co-location and several servers for our customers. Most of the monitoring is working fine, but there is one issue I can't seem to find a solution for. Let's assume there are two servers (host_colocation and host_customer), one running in our co-location, the other running on our customers site. Both servers have OurSoftware (tm) running. I want to monitor our server (both host and service) very often, let's say every minute. There is no need to monitor our customers server (both host and service) that often. Once every hour is enough. The host check_interval can be set with templates. This works fine. But I want to set the service check_interval to the same value as the host check_interval. Below is a simplified version of the checks I'm currently using. Every host uses two templates. One for location, one for services.
This is the location template for all our co-location hosts. All these hosts are checked once every minute.
define host{
register 0
name template_host_colocation
use template_host_generic
check_interval 1
retry_interval 1
}
This is the location template for our customers' hosts. All these host are checked once every 60 minutes.
define host{
register 0
name template_host_customer
use template_host_generic
check_interval 60
retry_interval 60
}
There is the service template for our software. It is a host template for all hosts running our software. The template sets some custom variables (not shown in this example) and puts the host in a hostgroup.
define host{
register 0
name template_host_OurSoftware
hostgroups +hostgroup_OurSoftware
}
The hostgroup definition.
define hostgroup{
hostgroup_name hostgroup_OurSoftware
}
Every host in this hostgroup automatically gets a check for this service.
define service{
use template_service_generic
hostgroup_name hostgroup_OurSoftware
service_description OurSoftware
check_command check_OurSoftware
}
This is the definition for the co-location host. It uses one template for location and one template for services. The host check interval is inherited.
define host{
use template_host_colocation,template_host_OurSoftware
host_name colocation.example.org
}
This is the definition of the customer host.
define host{
use template_host_customer,template_host_OurSoftware
host_name customer.example.org
}
How can I set the check_interval for the services to different values on both servers? Can this be done in one of the templates or hostgroups? It can probably be set in a service template or servicegroup, but how would I add those to this host definition?
Cheers,
Maarten