Solved: ndo2db: Could not bind socket: Address already in use.
In this post, we will see one of the common error message of ndo2db and its solution.
I. Error Message
[root@ngelinux01 ~]# /usr/local/nagios/bin/ndo2db -c /usr/local/nagios/etc/ndo2db.cfg -f Could not bind socket: Address already in use [root@ngelinux01 ~]#
II. Solution
A. Search for ndo.sock files on the system
[root@ngelinux01 ~]# find / -name ndo.sock /tmp/ndo.sock /usr/local/nagios/var/ndo.sock ^C [root@ngelinux01 ~]#
B. Remove the socket file.
[root@ngelinux01 ~]# rm -rf /usr/local/nagios/var/ndo.sock [root@ngelinux01 ~]#
C. Restart the ndo2db service now.
[root@ngelinux01 ~]# service ndo2db restart Redirecting to /bin/systemctl restart ndo2db.service [root@ngelinux01 ~]# [root@ngelinux01 ~]# service ndo2db status Redirecting to /bin/systemctl status ndo2db.service ● ndo2db.service - Nagios Data Out Daemon Loaded: loaded (/usr/lib/systemd/system/ndo2db.service; enabled; vendor preset: disabled) Active: active (running) since Tue 2023-09-05 20:55:30 PDT; 3s ago Docs: http://www.nagios.org/documentation Process: 42675 ExecStopPost=/bin/rm -f /usr/local/nagios/var/ndo2db.pid (code=exited, status=0/SUCCESS) Main PID: 43219 (ndo2db) Tasks: 1 (limit: 102326) Memory: 836.0K CGroup: /system.slice/ndo2db.service └─43219 /usr/local/nagios/bin/ndo2db -c /usr/local/nagios/etc/ndo2db.cfg -f Sep 05 20:55:30 ngelinux01 systemd[1]: Started Nagios Data Out Daemon. [root@ngelinux01 ~]#
As we can see above the service is now started and working fine as the socket is free now.