Page 1 of 1

start up nagios and get error in the log

Posted: Thu Feb 05, 2015 8:16 pm
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.

Re: start up nagios and get error in the log

Posted: Thu Feb 05, 2015 9:31 pm
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/

Re: start up nagios and get error in the log

Posted: Fri Feb 06, 2015 12:12 pm
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

Re: start up nagios and get error in the log

Posted: Fri Feb 06, 2015 3:39 pm
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

Re: start up nagios and get error in the log

Posted: Fri Feb 06, 2015 5:38 pm
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

Re: start up nagios and get error in the log

Posted: Sun Feb 08, 2015 6:41 pm
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

Re: start up nagios and get error in the log

Posted: Mon Feb 09, 2015 2:13 pm
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

Re: start up nagios and get error in the log

Posted: Mon Feb 09, 2015 2:35 pm
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.

Re: start up nagios and get error in the log

Posted: Mon Feb 09, 2015 4:53 pm
by abrist
Have a good one. Locking.