Nagios wont Start due to Service Definition Error

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
neofire
Posts: 2
Joined: Tue Sep 02, 2014 1:22 am

Nagios wont Start due to Service Definition Error

Post by neofire »

Hey guys, I am new to nagios (nagios core 4.0.8 to be extact), i am having a issue with my configuration and i hope someone can point me in the right direction

what i am trying to do is configure a file called servicegroups.cfg and have all the service definitions in there, and a separate file for the services.cfg, When i start nagios i get the following error when it starts

Code: Select all

LOG FILE
[1409639103] Event broker module 'NERD' deinitialized successfully.
[1409639103] Nagios 4.0.8 starting... (PID=55310)
[1409639103] Local time is Tue Sep 02 16:25:03 EST 2014
[1409639103] LOG VERSION: 2.0
[1409639103] qh: Socket '/usr/local/nagios/var/rw/nagios.qh' successfully initialized
[1409639103] qh: core query handler registered
[1409639103] nerd: Channel hostchecks registered successfully
[1409639103] nerd: Channel servicechecks registered successfully
[1409639103] nerd: Channel opathchecks registered successfully
[1409639103] nerd: Fully initialized and ready to rock!
[1409639103] wproc: Successfully registered manager as @wproc with query handler
[1409639103] wproc: Registry request: name=Core Worker 55314;pid=55314
[1409639103] wproc: Registry request: name=Core Worker 55313;pid=55313
[1409639103] wproc: Registry request: name=Core Worker 55312;pid=55312
[1409639103] wproc: Registry request: name=Core Worker 55311;pid=55311
[1409639103] Error: Template 'local-service' specified in service definition could not be not found (config file '/usr/local/nagios/etc/services/localhost.cfg', starting on line 96)
[1409639103] Bailing out due to one or more errors encountered in the configuration files. Run Nagios from the command line with the -v option to verify your config before restarting. (PID=55310)
[1409639103] Event broker module 'NERD' deinitialized successfully.
Here is my servicegroups.cfg

Code: Select all

define servicegroup {
        servicegroup_name               local-service
        alias                           local-service
         members                         localhost
        register                        1
}

now i have configured a service definition for "Local-Service", and the file its referenced in is also in my nagios cfg as well

Code: Select all

NAGIOS.cfg
# You can specify individual object config files as shown below:
cfg_file=/usr/local/nagios/etc/commands.cfg
cfg_file=/usr/local/nagios/etc/contacts.cfg
cfg_file=/usr/local/nagios/etc/contactgroups.cfg
cfg_file=/usr/local/nagios/etc/contacttemplates.cfg
cfg_file=/usr/local/nagios/etc/timeperiods.cfg
#cfg_file=/usr/local/nagios/etc/templates.cfg

# Hosts
cfg_dir=/usr/local/nagios/etc/hosts/
cfg_file=/usr/local/nagios/etc/hosttemplates.cfg
cfg_file=/usr/local/nagios/etc/hostgroups.cfg
cfg_file=/usr/local/nagios/etc/hostextinfo.cfg
cfg_file=/usr/local/nagios/etc/hostescalations.cfg
cfg_file=/usr/local/nagios/etc/hostdependencies.cfg

## Services
cfg_file=/usr/local/nagios/etc/servicegroups.cfg
cfg_file=/usr/local/nagios/etc/servicetemplates.cfg
cfg_dir=/usr/local/nagios/etc/services/
cfg_file=/usr/local/nagios/etc/serviceextinfo.cfg
cfg_file=/usr/local/nagios/etc/serviceescalations.cfg
cfg_file=/usr/local/nagios/etc/servicedependencies.cfg
i know nagios is reading the servicesgroup.cfg because if i define the servicegroup in another file eg the services.cfg i then get a error stating i have duplicate configuration
FTL
Posts: 72
Joined: Fri Oct 21, 2011 7:23 am

Re: Nagios wont Start due to Service Definition Error

Post by FTL »

The error is in localhost.cfg

[1409639103] Error: Template 'local-service' specified in service definition could not be not found (config file '/usr/local/nagios/etc/services/localhost.cfg', starting on line 96)

Post that up
emislivec
Posts: 52
Joined: Tue Feb 25, 2014 10:06 am

Re: Nagios wont Start due to Service Definition Error

Post by emislivec »

neofire wrote:

Code: Select all

[1409639103] Error: Template 'local-service' specified in service definition could not be not found (config file '/usr/local/nagios/etc/services/localhost.cfg', starting on line 96)

Code: Select all

#cfg_file=/usr/local/nagios/etc/templates.cfg
The 'local-service' template is defined in /usr/local/nagios/etc/templates.cfg. Uncommenting that line in nagios.cfg should resolve this error.

Code: Select all

cfg_file=/usr/local/nagios/etc/templates.cfg
neofire
Posts: 2
Joined: Tue Sep 02, 2014 1:22 am

Re: Nagios wont Start due to Service Definition Error

Post by neofire »

Thanks guys this worked, sorry for such a noob question
Locked