Error restarting Nagios Service

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
truedni
Posts: 1
Joined: Fri Jun 29, 2012 5:22 am

Error restarting Nagios Service

Post by truedni »

Hi All,

I have a problem that I was wondering if someone could help with.

I have been adding a few Servers to the monitoring software as normal today without a problem. I then went back in to change an group memeber of a contact group, run the verification (as normal) which came back as OK. I then went to restart the services to put the changes into effect, and I got the following error:

Nagios Core 3.2.3
Copyright (c) 2009-2010 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 10-03-2010
License: GPL

Website: http://www.nagios.org
Error: Cannot open main configuration file '/etc/nagios/objects/service' for reading!
Warning: Cannot open log file '/var/nagios/nagios.log' for writing
Nagios 3.2.3 starting... (PID=4559)
Warning: Cannot open log file '/var/nagios/nagios.log' for writing
Local time is Fri Jun 29 11:13:26 BST 2012
Warning: Cannot open log file '/var/nagios/nagios.log' for writing
Warning: Cannot open log file '/var/nagios/nagios.log' for writing
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=4559)


If I run the verfiy option again, it still comes back with no issues detected:

Website: http://www.nagios.org
Reading configuration data...
Read main config file okay...
Processing object config file '/etc/nagios/objects/commands.cfg'...
Processing object config file '/etc/nagios/objects/contacts.cfg'...
Processing object config file '/etc/nagios/objects/timeperiods.cfg'...
Processing object config file '/etc/nagios/objects/templates.cfg'...
Processing object config file '/etc/nagios/objects/localhost.cfg'...
Processing object config file '/etc/nagios/objects/xxxx.cfg'...
Processing object config file '/etc/nagios/objects/xxxxx.cfg'...
Processing object config file '/etc/nagios/objects/xxxxx.cfg'...
Processing object config file '/etc/nagios/objects/xxxx.cfg'...
Processing object config file '/etc/nagios/objects/xxxxx.cfg'...
Processing object config file '/etc/nagios/objects/xxxxx.cfg'...
Processing object config file '/etc/nagios/objects/xxxxx.cfg'...
Processing object config file '/etc/nagios/objects/xxxxxx.cfg'...
Read object config files okay...

Running pre-flight check on configuration data...

Checking services...
Checked 140 services.
Checking hosts...
Checked 101 hosts.
Checking host groups...
Checked 9 host groups.
Checking service groups...
Checked 0 service groups.
Checking contacts...
Checked 12 contacts.
Checking contact groups...
Checked 9 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 24 commands.
Checking time periods...
Checked 5 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: 0


Things look okay - No serious problems were detected during the pre-flight check


Any Ideas, as I have never seen this issue before!!

Many Thanks!
agriffin
Posts: 876
Joined: Mon May 09, 2011 9:36 am

Re: Error restarting Nagios Service

Post by agriffin »

What output do you get when you run the following command?

Code: Select all

ls -l /etc/nagios/objects/service /var/nagios/nagios.log
Also, it would probably help if you posted your nagios.cfg.
adityavatsa
Posts: 2
Joined: Mon Aug 04, 2014 7:52 am

Re: Error restarting Nagios Service

Post by adityavatsa »

Hello All,

I also faced similar problem. I removed few devices which were no longer supposed to be monitored by Nagios. While compiling I got following error:

Error: Cannot open main configuration file '/etc/nagios/objects/sites/-v' for reading!

Please suggest a solution for this and let me know if you need some more inputs.

Thanks!
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Error restarting Nagios Service

Post by tmcdonald »

adityavatsa wrote:I also faced similar problem. I removed few devices which were no longer supposed to be monitored by Nagios. While compiling I got following error:
You got this error while compiling? Were you trying to upgrade and you saw this error? Please post the exact commands you ran and their error output.
Former Nagios employee
adityavatsa
Posts: 2
Joined: Mon Aug 04, 2014 7:52 am

Re: Error restarting Nagios Service

Post by adityavatsa »

Hello,

I used following command to compile :

nagios –v /etc/nagios/nagios.cfg

And I got the following error message:

Website: http://www.nagios.org
Error: Cannot open main configuration file '/root/–v' for reading!
Nagios 3.2.3 starting... (PID=21254)
Local time is Tue Aug 05 08:36:09 CEST 2014
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=21254)

Thanks!
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Error restarting Nagios Service

Post by tmcdonald »

That's not the command to compile nagios; that is the command to verify your configuration is correct. Try running the command again but instead of just "nagios" give it the full path to the nagios program.
Former Nagios employee
Locked