Overriding Nagios hostgroup service with host service
I know it's an old post, but I just ran across this question while I was looking for something else. I'm not much of a nagios expert, but I do love it.
Any check that you place in a hostgroup will apply to any host in that hostgroup (which you knew already). If you create the same check in the host cfg, then it'll override the hostgroup check.
Anyhow, the way I do this is to:
1. Set up a hostgroup cfg file with the checks in it. Here's my basic C: drive space check.
define service{
use generic-service
hostgroup_name windows-servers
service_description C: Drive Space
notification_period workhours
check_command check_nt!USEDDISKSPACE!-l c -w 80 -c 90
}
2. However, one server runs with much less free space than the norm. So in it's host cfg, I have:
define service{
use generic-service
host_name ServerName
service_description C: Drive Space
check_command check_nt!USEDDISKSPACE!-l c -w 95 -c 99
notification_period workhours
}
Now the service check is going to alert you for 80% and 90% for all hosts in the hostgroup, except for the host that you added the check with the change values in it.
Arranging it this way allows me to only add custom services, and service checks that aren't the norm in the host definition.
I'm not sure if this is common use or not, but this article blew my mind when it came to setting up the config files. I was already tired of editing these humongous text files, and this just made it so easy.
Anyway, I hope that helps.
You could use "Custom Variable Macros" (http://nagios.sourceforge.net/docs/3_0/macros.html)
In your ping service definition use e.g.:
check_command check_ping!200.0,20%!$_HOSTVAR_SERVICE_PING_CRITICAL_RTA$,40%
In your host template set a default value:
_VAR_SERVICE_PING_CRITICAL_RTA 500
In the host definition that should use a difference value set e.g.
_VAR_SERVICE_PING_CRITICAL_RTA 1500
explicitly.