Nagios service fails to start

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.
jannetta
Posts: 9
Joined: Tue Sep 06, 2016 6:35 am

Re: Nagios service fails to start

Post by jannetta »

root@nagios:~# nagios3 -vv /etc/nagios3/nagios.cfg

Nagios Core 3.5.1
Copyright (c) 2009-2011 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-30-2013
License: GPL

Website: http://www.nagios.org
Reading configuration data...
Read main config file okay...
Processing object config directory '/etc/nagios3/global'...
Processing object config directory '/etc/nagios3/Default_collector'...
Read object config files okay...

Running pre-flight check on configuration data...

Checking services...
Error: There are no services defined!
Checked 0 services.
Checking hosts...
Error: There are no hosts defined!
Checked 0 hosts.
Checking host groups...
Checked 0 host groups.
Checking service groups...
Checked 0 service groups.
Checking contacts...
Error: There are no contacts defined!
Checked 0 contacts.
Checking contact groups...
Checked 0 contact groups.
Checking service escalations...
Checked 0 service escalations.
Checking service dependencies...
Checked 0 service dependencies.
Checking host escalations...
Checked 0 host escalations.
Checking host dependencies...
Checked 0 host dependencies.
Checking commands...
Checked 0 commands.
Checking time periods...
Checked 0 time periods.
Checking for circular paths between hosts...
Checking for circular host and service dependencies...
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 0
Total Errors: 3

***> One or more problems was encountered while running the pre-flight check...

Check your configuration file(s) to ensure that they contain valid
directives and data defintions. If you are upgrading from a previous
version of Nagios, you should be aware that some variables/definitions
may have been removed or modified in this version. Make sure to read
the HTML documentation regarding the config files, as well as the
'Whats New' section to find out what has changed.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Nagios service fails to start

Post by tgriep »

By default, the Nagios process needs at least one host check and one service check defined to run.
Usually there is a localhost.cfg file that is used to monitor the Nagios server. That file should be in somewhere in this folder or below.

Code: Select all

/etc/nagios3/
If you find it, copy them to this folder and see if the Nagios processes starts.

Code: Select all

/etc/nagios3/global
Be sure to check out our Knowledgebase for helpful articles and solutions!
jannetta
Posts: 9
Joined: Tue Sep 06, 2016 6:35 am

Re: Nagios service fails to start

Post by jannetta »

The following files were in /etc/nagios3/conf.d
-rw-r--r-- 1 root root 1695 Jul 29 2011 contacts_nagios2.cfg
-rw-r--r-- 1 root root 418 Jul 29 2011 extinfo_nagios2.cfg
-rw-r--r-- 1 root root 1152 Jul 29 2011 generic-host_nagios2.cfg
-rw-r--r-- 1 root root 1803 Jul 29 2011 generic-service_nagios2.cfg
-rw-r--r-- 1 root root 678 Jul 29 2011 hostgroups_nagios2.cfg
-rw-r--r-- 1 root root 2167 Jul 29 2011 localhost_nagios2.cfg
-rw-r--r-- 1 root root 657 Jul 29 2011 services_nagios2.cfg
-rw-r--r-- 1 root root 1609 Jul 29 2011 timeperiods_nagios2.cfg

i copied localhost_nagios2.cfg you /etc/nagios3/global as localhost.cfg but it has not made a difference.

I also tried copying all files as is to the global directory, but it still didn't work.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Nagios service fails to start

Post by tgriep »

What error are you getting when you run the verification?
Once those are resolved, then the Nagios daemon should start.
Be sure to check out our Knowledgebase for helpful articles and solutions!
jannetta
Posts: 9
Joined: Tue Sep 06, 2016 6:35 am

Re: Nagios service fails to start

Post by jannetta »

All I can make of this is that localhost needs to be defined somewhere ... how? where?

Code: Select all

root@nagios:/etc/nagios3/global# systemctl start nagios3
Job for nagios3.service failed. See 'systemctl status nagios3.service' and 'journalctl -xn' for details.
root@nagios:/etc/nagios3/global# nagios3 -vv /etc/nagios3/nagios.cfg 

Nagios Core 3.5.1
Copyright (c) 2009-2011 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-30-2013
License: GPL

Website: http://www.nagios.org
Reading configuration data...
   Read main config file okay...
Processing object config directory '/etc/nagios3/global'...
Processing object config file '/etc/nagios3/global/extinfo_nagios2.cfg'...
Processing object config file '/etc/nagios3/global/generic-service_nagios2.cfg'...
Processing object config file '/etc/nagios3/global/localhost_nagios2.cfg'...
Processing object config file '/etc/nagios3/global/timeperiods_nagios2.cfg'...
Processing object config file '/etc/nagios3/global/contacts_nagios2.cfg'...
Processing object config file '/etc/nagios3/global/services_nagios2.cfg'...
Processing object config file '/etc/nagios3/global/generic-host_nagios2.cfg'...
Processing object config file '/etc/nagios3/global/hostgroups_nagios2.cfg'...
Processing object config directory '/etc/nagios3/Default_collector'...
   Read object config files okay...

Running pre-flight check on configuration data...

Checking services...
Error: Service check command 'check_load' specified in service 'Current Load' for host 'localhost' not defined anywhere!
Error: Service check command 'check_users' specified in service 'Current Users' for host 'localhost' not defined anywhere!
Error: Service check command 'check_all_disks' specified in service 'Disk Space' for host 'localhost' not defined anywhere!
Error: Service check command 'check_http' specified in service 'HTTP' for host 'localhost' not defined anywhere!
Error: Service check command 'check_ssh' specified in service 'SSH' for host 'localhost' not defined anywhere!
Error: Service check command 'check_procs' specified in service 'Total Processes' for host 'localhost' not defined anywhere!
	Checked 6 services.
Checking hosts...
Error: Host check command 'check-host-alive' specified for host 'localhost' is not defined anywhere!
	Checked 1 hosts.
Checking host groups...
	Checked 4 host groups.
Checking service groups...
	Checked 0 service groups.
Checking contacts...
Error: Service notification command 'notify-service-by-email' specified for contact 'root' is not defined anywhere!
Error: Host notification command 'notify-host-by-email' specified for contact 'root' is not defined anywhere!
	Checked 1 contacts.
Checking contact groups...
	Checked 1 contact groups.
Checking service escalations...
	Checked 0 service escalations.
Checking service dependencies...
	Checked 0 service dependencies.
Checking host escalations...
	Checked 0 host escalations.
Checking host dependencies...
	Checked 0 host dependencies.
Checking commands...
	Checked 0 commands.
Checking time periods...
	Checked 4 time periods.
Checking for circular paths between hosts...
Checking for circular host and service dependencies...
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 0
Total Errors:   9

***> One or more problems was encountered while running the pre-flight check...

     Check your configuration file(s) to ensure that they contain valid
     directives and data defintions.  If you are upgrading from a previous
     version of Nagios, you should be aware that some variables/definitions
     may have been removed or modified in this version.  Make sure to read
     the HTML documentation regarding the config files, as well as the
     'Whats New' section to find out what has changed.

User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Nagios service fails to start

Post by Box293 »

In your nagios.cfg you have:

Code: Select all

cfg_dir=/etc/nagios3/global
cfg_dir=/etc/nagios3/Default_collector
In one of these directories you should have some .cfg files.

Have a look at these example files which may be what you need to get it to work:

https://github.com/NagiosEnterprises/na ... ate-object
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked