Failed to init socket error on CentOS7

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
vbiyani
Posts: 2
Joined: Fri Dec 11, 2015 1:06 am

Failed to init socket error on CentOS7

Post by vbiyani »

Similar to issue faced at https://support.nagios.com/forum/viewto ... =7&t=22141 , I installed Nagios Core 4.0.8 on CentOS7 and running into same issue inspite of configuring the query_socket variable. Even after adding the said variable, I run into error:

Code: Select all

Dec 11 06:05:56 0.nserver.com nagios[23593]: Nagios 4.0.8 starting... (PID=23593)
Dec 11 06:05:56 0.nserver.com nagios[23593]: Local time is Fri Dec 11 06:05:56 UTC 2015
Dec 11 06:05:56 0.nserver.com nagios[23593]: qh: Failed to init socket '/usr/local/nagios/var/rw/query.sh'. bind() failed: No such file or directory
Dec 11 06:05:56 0.nserver.com nagios[23593]: Error: Failed to initialize query handler. Aborting
Dec 11 06:05:56 0.nserver.com systemd[1]: nagios.service: main process exited, code=exited, status=1/FAILURE
Dec 11 06:05:56 0.nserver.com systemd[1]: Unit nagios.service entered failed state.
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Failed to init socket error on CentOS7

Post by hsmith »

How did you install core? Source / repo?
Former Nagios Employee.
me.
vbiyani
Posts: 2
Joined: Fri Dec 11, 2015 1:06 am

Re: Failed to init socket error on CentOS7

Post by vbiyani »

I am installing Nagios using Salt from EPEL repo directly from binaries. I was able to work around the issue by creating the directory /usr/local/nagios/rw/query and making sure nagios and subdirectories are owned by user & group nagios. Though still wondering why would installation not do it by itself. Since the installation is done as root user through salt-minion, access should not be an issue.
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Failed to init socket error on CentOS7

Post by hsmith »

I believe the version on the repo uses different file paths than compiling from source..

I don't have a Cent7 machine set up at the moment that I can put core on, but here's an example of /etc/init.d/nagios

Code: Select all

 Our install-time configuration.
prefix=/usr/local/nagios
exec_prefix=${prefix}
NagiosBin=${exec_prefix}/bin/nagios
NagiosCfgFile=${prefix}/etc/nagios.cfg
NagiosCfgtestFile=${prefix}/var/nagios.configtest
NagiosStatusFile=${prefix}/var/status.dat
NagiosRetentionFile=${prefix}/var/retention.dat
NagiosCommandFile=${prefix}/var/rw/nagios.cmd
NagiosVarDir=${prefix}/var
NagiosRunFile=${prefix}/var/nagios.lock
NagiosLockDir=/var/lock/subsys
NagiosLockFile=nagios
NagiosCGIDir=${exec_prefix}/sbin
NagiosUser=nagios
NagiosGroup=nagios
checkconfig="true"
You may want to verify these match up with the directory that actually gets made

Perhaps take a look /usr/lib/systemd/system/ ? I don't have system in front of me to test like I said, so that file path may be slightly wrong.
Former Nagios Employee.
me.
Locked