Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Error: Template 'local-service' specified in service definition could not be not found (config file '/usr/local/nagios/etc/objects/localhost.cfg', starting on line 150)
define service{
use local-service ; Name of service template to use
host_name localhost
service_description HTTP
check_command check_http
notifications_enabled 0
}
I didn't have any problems with this until I made the modifications listed above and I'm not sure what syntax I may have goofed on. I'm sure that when I resolve this I will be able to utilize the solution to fix other problems I likely created while installing and modifying the rest of the feature.
This is a brand new installation monitoring linux and windows machines (which it seems to still be doing) on CentOS release 5.8 (Final)
I'm sorry, I searched online and didn't even bought the Self Paced training but after watching the video's I'm still not sure where I may have messed this one up. Any pointers would be greatly appreciated!
Last edited by ScottB on Mon Jun 11, 2012 11:13 am, edited 1 time in total.
I'm not sure what caused this problem to appear after installing those components, but the problem is that are trying to use a template that doesn't exist. Look through your config files for a service named local-service (several of them may use local-service just like in the snippet you posted, try not to mix that up).
If you find a service named local-service, it may be that it's not set to act as a template or it may not be getting read at all by Nagios. If you don't find it we'll need to add it.
# Local service definition template - This is NOT a real service, just a template!
# define service{
# name local-service ; The name of this service template
# use generic-service ; Inherit default values from the generic-service $
# max_check_attempts 4 ; Re-check the service up to 4 times in order to d$
# normal_check_interval 5 ; Check the service every 5 minutes under normal c$
# retry_check_interval 1 ; Re-check the service every minute until a hard s$
# register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL S$
# }
define host {
name host-pnp
action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=_HOST_
register 0
}
define service {
name srv-pnp
action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=$SERVICEDESC$
register 0
}
# pwd
/usr/local/nagios/etc
grep -r "local-service" ./
./objects/templates.cfg:# name local-service ; The name of this service template
./objects/localhost.cfg: use local-service ; Name of service template to use
./objects/localhost.cfg: use local-service ; Name of service template to use
./objects/localhost.cfg: use local-service ; Name of service template to use
./objects/localhost.cfg: use local-service ; Name of service template to use
./objects/localhost.cfg: use local-service ; Name of service template to use
./objects/localhost.cfg: use local-service ; Name of service template to use
./objects/localhost.cfg: use local-service ; Name of service template to use
./objects/localhost.cfg: use local-service ; Name of service template to use
I just replaced all instances of local-service with generic-service in localhost.cfg.
Restarted Nagios and apache and this took care of the problem. Thank you for your help.