start up nagios and get error in the log

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
ducle99
Posts: 11
Joined: Tue Jan 20, 2015 7:26 pm

start up nagios and get error in the log

Post by ducle99 »

When I start up nagios, I got this error in the nagios log file
Failed to connect to query socket '/usr/local/nagios/var/rw/nagios.qh': connect() failed: Connection refused

nagios 4.0.2 is running on Solaris 11.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: start up nagios and get error in the log

Post by Box293 »

Can you post your nagios.cfg file please.

Also run this command and post the output:

Code: Select all

ll /usr/local/nagios/var/
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
ducle99
Posts: 11
Joined: Tue Jan 20, 2015 7:26 pm

Re: start up nagios and get error in the log

Post by ducle99 »

nagios.cfg
(43.64 KiB) Downloaded 631 times
/usr/local/nagios/etc# ls -l /usr/local/nagios/var
total 632
drwxrwxr-x 2 nagios nagios 11 Feb 5 23:59 archives
-rw-r--r-- 1 nagios nagios 5 Feb 3 17:43 nagios.lock
-rw-r--r-- 1 nagios nagios 245510 Feb 6 09:11 nagios.log
-rw-r--r-- 1 nagios nagios 14935 Feb 5 17:35 objects.cache
-rw------- 1 nagios nagios 17707 Feb 6 08:35 retention.dat
drwxrwsr-x 2 nagios nagios 4 Feb 5 17:35 rw
drwxr-xr-x 3 root bin 3 Jan 27 11:14 spool
-rw-rw-r-- 1 nagios nagios 18178 Feb 6 09:11 status.dat
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: start up nagios and get error in the log

Post by abrist »

Stop nagios, get a listing of the rw folder, and then start nagios and get another listing. Post the results here:

Code: Select all

service nagios stop
ls -la /usr/local/nagios/var/rw
service nagios start
ls -la /usr/local/nagios/var/rw
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
ducle99
Posts: 11
Joined: Tue Jan 20, 2015 7:26 pm

Re: start up nagios and get error in the log

Post by ducle99 »

root@ddcldp103:/usr/local/nagios/var# ls -l /usr/local/nagios/var/rw
total 1
prwxrwx--x 1 nagios nagios 0 Jan 28 17:17 nagios.cmd
srw-rw---- 1 nagios nagios 0 Feb 6 10:57 nagios.qh

after start up nagios
/usr/local/nagios/var# ls -l /usr/local/nagios/var/rw
total 1
prwxrwx--x 1 nagios nagios 0 Jan 28 17:17 nagios.cmd
srw-rw---- 1 nagios nagios 0 Feb 6 14:37 nagios.qh
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: start up nagios and get error in the log

Post by Box293 »

It looks like the nagios.cmd is being left behind when nagios stops so I suspect we need to delete it so it is correctly started. There may also be more than instance of nagios running which can cause this.

Run this:

Code: Select all

service nagios stop
Then this:

Code: Select all

ps -aef | grep nagios.cfg
If you get any results for this (except for the grep result) you will need to kill those PID's

Code: Select all

kill PID
Where PID is the PID number from the last command.

Now run this:

Code: Select all

rm -f /usr/local/nagios/var/rw/nagios.cmd
service nagios start
Does this fix your problem?

Can you also post the output of this after running all those commands:

Code: Select all

ls -l /usr/local/nagios/var/rw
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
ducle99
Posts: 11
Joined: Tue Jan 20, 2015 7:26 pm

Re: start up nagios and get error in the log

Post by ducle99 »

I followed all steps, but the same error still show up in the logs.
/usr/local/nagios/var/rw# ls -al
total 7
drwxrwsr-x 2 nagios nagios 3 Feb 9 11:09 .
drwxrwxr-x 5 nagios nagios 10 Feb 9 11:12 ..
srw-rw---- 1 nagios nagios 0 Feb 9 11:09 nagios.qh
ducle99
Posts: 11
Joined: Tue Jan 20, 2015 7:26 pm

Re: start up nagios and get error in the log

Post by ducle99 »

I updated the nagios.cfg for the following entry
check_external_commands=1
and add the Apache user account to the nagios group.
When I restart nagios, the error is gone.
Thanks for your help.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: start up nagios and get error in the log

Post by abrist »

Have a good one. Locking.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Locked