Nagios service won't 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.
Locked
Saadat Hydri
Posts: 2
Joined: Fri Sep 08, 2017 7:16 am

Nagios service won't start

Post by Saadat Hydri »

Hello Everyone. Posting here for the first time. So i set up nagios core on a fresh server installation running Centos 6.7.
Did it using this "https://www.unixmen.com/install-and-con ... -rhel-6-4/" installation guide. Things that i installed befor nagios were PHP and Mysqld. The nagios installation was completed without any errors. After the installation when i tried to start nagios as root i got the following output:

[root@saadat ~]# service nagios status
No lock file found in /var/run/nagios/nagios.pid.

Went to the /var/run/nagios/ directory and created the nagios.pid file by myself.
Then tried to check the status of nagios and found :

[root@saadat ~]# service nagios status
nagios is not running


Then tried to start nagios and got nothing but this:

[root@saadat ~]# service nagios start
Starting nagios:[root@saadat ~]#
(Nothing happens after this)

On the other hand when i accessed nagios from the browser "ServerIP/nagios" it opens the main page of nagios but it says Nagios Core not running with an X mark.

On clicking anything on the left menu i get the page with the error:

Whoops!

Error: Could not read object configuration data!

Here are some things you should check in order to resolve this error:

Verify configuration options using the -v command-line option to check for errors.
Check the Nagios log file for messages relating to startup or status data errors.
Make sure you read the documentation on installing, configuring and running Nagios thoroughly before continuing. If all else fails, try sending a message to one of the mailing lists. More information can be found at https://www.nagios.org.


Upon rinning the command "nagios -v nagios.cfg" i get the output:

Nagios Core 4.3.2
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 2017-05-09
License: GPL

Website: https://www.nagios.org
Reading configuration data...
Error: Cannot open main configuration file '/root/nagios.cfg' for reading!
Error processing main config file!



What might be the error in this configuration?? No idea what to do now. Please seniors suggest something to me in this difficult time :(

Thanks in advance.
bolson

Re: Nagios service won't start

Post by bolson »

Please execute the following:

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

And post the result.

By not including the path to nagios.cfg, your command is looking for the file in your /root directory and not finding it there.
Saadat Hydri
Posts: 2
Joined: Fri Sep 08, 2017 7:16 am

Re: Nagios service won't start

Post by Saadat Hydri »

Yes you are right, the command says no such file.

[root@saadat ~]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
-bash: /usr/local/nagios/bin/nagios: No such file or directory

[root@saadat ~]# /usr/local/nagios/bin/nagios -v nagios.cfg
-bash: /usr/local/nagios/bin/nagios: No such file or directory

Please tell me what went wrong during the installation and how should i resolve this.

Thanks
bolson

Re: Nagios service won't start

Post by bolson »

Please run the following two commands and post your result:

Code: Select all

find / -name nagios
find / -name nagios.cfg
bolson

Re: Nagios service won't start

Post by bolson »

Remove the nagios.pid file that you created. This file should never be created manually. Then run the following command as root:

Code: Select all

service nagios start
The first error you received:

Code: Select all

No lock file found in /var/run/nagios/nagios.pid
was to be expected. You ran:

Code: Select all

service nagios status
while nagios wasn't running and the error basically reported that.
DiegoAnjos
Posts: 49
Joined: Thu Feb 14, 2013 9:32 am

Re: Nagios service won't start

Post by DiegoAnjos »

I got the same issue when I installed Graphios.
Graphios created a bew nagios.cfg file and something was wrong in it, so I restored the original nagios.cfg and it fixed the issue.


While I was digging into the root cause, I found that the file /usr/loncal/nagios/var/nagios.lock was't being updated. Maybe you should take a look on this file, and check its path on nagios.cfg as well:

Code: Select all

lock_file=/usr/local/nagios/var/nagios.lock
bolson

Re: Nagios service won't start

Post by bolson »

Has your issue been resolved and may we close this topic?
Locked