Solved: Nagios: qh: Failed to init socket ‘/usr/local/nagios/var/rw/nagios.qh’. bind() failed:

Today in this post, we will see one of the common error message and its solution.

I. Error Message

Aug 24 22:04:03 ngelinux01 nagios[26983]: Nagios 4.4.5 starting... (PID=26983)
Aug 24 22:04:03 ngelinux01 systemd[1]: nagios.service: Main process exited, code=exited, status=1/FAILURE
Aug 24 22:04:03 ngelinux01 nagios[26983]: Local time is Thu Aug 24 22:04:03 PDT 2023
Aug 24 22:04:03 ngelinux01 nagios[26983]: LOG VERSION: 2.0
Aug 24 22:04:03 ngelinux01 nagios[26983]: qh: Failed to init socket '/usr/local/nagios/var/rw/nagios.qh'. bind() failed: No such file or directory
Aug 24 22:04:03 ngelinux01 nagios[26983]: Error: Failed to initialize query handler. Aborting
Aug 24 22:04:03 ngelinux01 systemd[1]: nagios.service: Failed with result 'exit-code'.
-- Subject: Unit failed

 

II. Solution

a. Remove nagios service executable permission

[root@ngelinux01 ndoutils-2.1.3]# ls -l /usr/lib/systemd/system/nagios.service
-rwxr-xr-x 1 root root 489 Jun 25 22:51 /usr/lib/systemd/system/nagios.service

[root@ngelinux01 ndoutils-2.1.3]# chmod -x /usr/lib/systemd/system/nagios.service

 

b. Create the directory which was missing and make its permission 777.

[root@ngelinux01 ndoutils-2.1.3]# mkdir -p /usr/local/nagios/var/rw/
[root@ngelinux01 ndoutils-2.1.3]# chmod -R 777 /usr/local/nagios/var/rw/

 

c. Restart the Nagios Service.

[root@ngelinux01 ndoutils-2.1.3]# service nagios restart
Redirecting to /bin/systemctl restart nagios.service
[root@ngelinux01 ndoutils-2.1.3]#

Now the Nagios service will be able to create the socket file and the error is resolved.

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments