local-service' specified in service definition

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.
Locked
ScottB
Posts: 4
Joined: Fri Jun 08, 2012 11:32 am

local-service' specified in service definition

Post by ScottB »

Hello all,
I recently added RRDTool, PNP4Nagios, PHP 5.2 and PHP Modules and now when trying to:

Code: Select all

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
I get the error:

Code: Select all

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)
which is:

Code: Select all

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.
agriffin
Posts: 876
Joined: Mon May 09, 2011 9:36 am

Re: local-service' specified in service definition

Post by agriffin »

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.
ScottB
Posts: 4
Joined: Fri Jun 08, 2012 11:32 am

Re: local-service' specified in service definition

Post by ScottB »

Thank you, I did add this to templates.cfg but so far I don't see a service named local-service. I'm still hunting.

Code: Select all

# 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
        }
ScottB
Posts: 4
Joined: Fri Jun 08, 2012 11:32 am

Re: local-service' specified in service definition

Post by ScottB »

I think I'll need to add it... I'll try to find where to do that this AM.

Here is what I see:

Code: Select all

# 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
ScottB
Posts: 4
Joined: Fri Jun 08, 2012 11:32 am

Re: local-service' specified in service definition

Post by ScottB »

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.
agriffin
Posts: 876
Joined: Mon May 09, 2011 9:36 am

Re: local-service' specified in service definition

Post by agriffin »

You're welcome. I'm glad you got thing worked out.
Locked