Page 1 of 2

Nagios Core 4.4.5 Just not Starting

Posted: Thu Apr 04, 2024 5:17 am
by ATIAdmin
Hi all, first time poster here, hope I have the right part of the forum.

I am running Red Hat 8 (on AWS) and installed Nagios following the steps here (https://access.redhat.com/documentation ... figuration) and the installation went smoothly. Although, when I get to "2.2. Starting the Nagios Core service" I am unable to get the Nagios service to start and seemingly there are no errors being reported.

When I run the "pre-flight check" I get the following;

Nagios Core 4.4.5
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 2019-08-20
License: GPL

Website: https://www.nagios.org
Reading configuration data...
Read main config file okay...
Read object config files okay...

Running pre-flight check on configuration data...

Checking objects...
Checked 8 services.
Checked 1 hosts.
Checked 1 host groups.
Checked 0 service groups.
Checked 1 contacts.
Checked 1 contact groups.
Checked 24 commands.
Checked 5 time periods.
Checked 0 host escalations.
Checked 0 service escalations.
Checking for circular paths...
Checked 1 hosts
Checked 0 service dependencies
Checked 0 host dependencies
Checked 5 timeperiods
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 0
Total Errors: 0

Things look okay - No serious problems were detected during the pre-flight check


Then I try and start Nagios service and I get the following;

systemctl start nagios.serviceex
service nagios status
Redirecting to /bin/systemctl status nagios.service
● nagios.service - Nagios Core 4.4.5
Loaded: loaded (/usr/lib/systemd/system/nagios.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Thu 2024-04-04 10:11:22 UTC; 10s ago
Docs: https://www.nagios.org/documentation
Process: 5221 ExecStopPost=/bin/rm -f /usr/local/nagios/var/rw/nagios.cmd (code=exited, status=0/SUCCESS)
Process: 5217 ExecStart=/usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg (code=exited, status=0/SUCCESS)
Process: 5216 ExecStartPre=/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg (code=exited, status=0/SUCCESS)
Main PID: 5219 (code=exited, status=1/FAILURE)

Apr 04 10:11:22 ip-172-30-0-105.eu-west-1.compute.internal nagios[5216]: Checked 5 timeperiods
Apr 04 10:11:22 ip-172-30-0-105.eu-west-1.compute.internal nagios[5216]: Checking global event handlers...
Apr 04 10:11:22 ip-172-30-0-105.eu-west-1.compute.internal nagios[5216]: Checking obsessive compulsive processor commands...
Apr 04 10:11:22 ip-172-30-0-105.eu-west-1.compute.internal nagios[5216]: Checking misc settings...
Apr 04 10:11:22 ip-172-30-0-105.eu-west-1.compute.internal nagios[5216]: Total Warnings: 0
Apr 04 10:11:22 ip-172-30-0-105.eu-west-1.compute.internal nagios[5216]: Total Errors: 0
Apr 04 10:11:22 ip-172-30-0-105.eu-west-1.compute.internal nagios[5216]: Things look okay - No serious problems were detected during the pre-flight check
Apr 04 10:11:22 ip-172-30-0-105.eu-west-1.compute.internal systemd[1]: Started Nagios Core 4.4.5.
Apr 04 10:11:22 ip-172-30-0-105.eu-west-1.compute.internal systemd[1]: nagios.service: Main process exited, code=exited, status=1/FAILURE
Apr 04 10:11:22 ip-172-30-0-105.eu-west-1.compute.internal systemd[1]: nagios.service: Failed with result 'exit-code'.


I am doing all the above as su.

My Linux/Red Hat knowledge is limited and I am really banging my head against a wall here, any help would be greatly apricated.

Re: Nagios Core 4.4.5 Just not Starting

Posted: Fri Apr 05, 2024 9:16 am
by gwesterman
Hi @ATIAdmin,

Could you run "systemctl status nagios.service" and "journalctl -n" after trying to start the service and provide us the output?

Thank you!

Re: Nagios Core 4.4.5 Just not Starting

Posted: Fri Apr 05, 2024 10:23 am
by ATIAdmin
Please see below;

systemctl status nagios.service
● nagios.service - Nagios Core 4.4.5
Loaded: loaded (/usr/lib/systemd/system/nagios.service; enabled; vendor pres>
Active: failed (Result: exit-code) since Fri 2024-04-05 15:18:59 UTC; 13s ago
Docs: https://www.nagios.org/documentation
Process: 37140 ExecStopPost=/bin/rm -f /usr/local/nagios/var/rw/nagios.cmd (c>
Process: 37136 ExecStart=/usr/local/nagios/bin/nagios -d /usr/local/nagios/et>
Process: 37135 ExecStartPre=/usr/local/nagios/bin/nagios -v /usr/local/nagios>
Main PID: 37138 (code=exited, status=1/FAILURE)

nagios[37135]: Total>
Thing>
systemd[1]: Started >
Nagio>
Local>
LOG V>
qh: F>
Error>
nagios.s>
nagios.s>
lines 1-19/19 (END)...skipping...
● nagios.service - Nagios Core 4.4.5
Loaded: loaded (/usr/lib/systemd/system/nagios.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Fri 2024-04-05 15:18:59 UTC; 13s ago
Docs: https://www.nagios.org/documentation
Process: 37140 ExecStopPost=/bin/rm -f /usr/local/nagios/var/rw/nagios.cmd (code=exited, status=0/SUCCESS)
Process: 37136 ExecStart=/usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg (code=exited, status=0/SUCCESS)
Process: 37135 ExecStartPre=/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg (code=exited, status=0/SUCCESS)
Main PID: 37138 (code=exited, status=1/FAILURE)

Total Errors: 0
Things look okay - No serious problems were detected during the pre-flight check
Started Nagios Core 4.4.5.
Nagios 4.4.5 starting... (PID=37138)
Local time is Fri Apr 05 15:18:59 UTC 2024
LOG VERSION: 2.0
qh: Failed to init socket '/usr/local/nagios/var/rw/nagios.qh'. bind() failed: No such file or directory
Error: Failed to initialize query handler. Aborting
nagios.service: Main process exited, code=exited, status=1/FAILURE
nagios.service: Failed with result 'exit-code'.


journalctl -n
-- Logs begin at Thu 2024-04-04 07:39:37 UTC, end at Fri 2024-04-05 15:19:02 UTC. --
nagios[37138]: qh: Failed to init socket '/usr/local/nagios/var/rw/nagios.qh'. bind() failed: No such file or directory
nagios[37138]: Error: Failed to initialize query handler. Aborting
systemd[1]: nagios.service: Main process exited, code=exited, status=1/FAILURE
systemd[1]: nagios.service: Failed with result 'exit-code'.
systemd[1]: Started Session 3821 of user ec2-user.
systemd[1]: Started Session 3822 of user root.
CROND[37146]: (root) CMD (/usr/bin/php /var/www/atiprod/moodle/admin/cli/cron.php >/dev/null)
CROND[37147]: (ec2-user) CMD (/usr/bin/php /var/www/atiprod/moodle/admin/cli/cron.php >/dev/null)
systemd[1]: session-3814.scope: Succeeded.
systemd[1]: session-3815.scope: Succeeded.

Re: Nagios Core 4.4.5 Just not Starting

Posted: Mon Apr 08, 2024 9:26 am
by gwesterman
Hi @ATIAdmin,

It looks like the issue is with this file:

Code: Select all

/usr/local/nagios/var/rw/nagios.qh
Check if it exists and verify whether or not it is owned but nagios:nagcmd. There are also a number of potential solutions if you search the error that includes that file (from this forum even!), but I recommend snapshotting your server before trying them.

Re: Nagios Core 4.4.5 Just not Starting

Posted: Mon Apr 15, 2024 10:37 am
by ATIAdmin
Apologies for the delay in replying I was away.

The file you have stated does not exist.

Re: Nagios Core 4.4.5 Just not Starting

Posted: Thu Apr 18, 2024 8:32 am
by ATIAdmin
I have upgraded to Nagios Core 4.5.1 and still getting the same messages and the same file is missing

Re: Nagios Core 4.4.5 Just not Starting

Posted: Thu Apr 18, 2024 10:14 am
by bbahn
@ATIAdmin,

Have you ran

Code: Select all

cd /
find -name "nagios.qh"
It seems at some point several configuration files moved locations for Nagios Core and this may have something to do with your current issues. If you do find it somewhere else, you can move or copy it over to the /usr/local/nagios/var/rw/ location.

Re: Nagios Core 4.4.5 Just not Starting

Posted: Mon Apr 22, 2024 4:40 am
by ATIAdmin
I have been unable to find "nagios.qh" so somehow it seems like it did not get installed at all

Re: Nagios Core 4.4.5 Just not Starting

Posted: Mon Apr 22, 2024 9:15 am
by gwesterman
Do you have the folder /usr/local/nagios/var/rw/?

If not, you might be able to just make it and set the permissions.

Start by snapshotting your server. Then run:

Code: Select all

mkdir -p  /usr/local/nagios/var/rw/

Code: Select all

chmown nagios:nagcmd /usr/local/nagios/var/rw/

Code: Select all

systemctl restart nagios
Let us know if this works and if you need help with anything else.

Thank you!

Re: Nagios Core 4.4.5 Just not Starting

Posted: Wed Apr 24, 2024 2:33 am
by ATIAdmin
IT WORKED gwesterman! The Nagios service is running, I did have to modify one of the command:

Code: Select all

chown nagios:nagcmd /usr/local/nagios/var/rw/
As I got the error message; chown: invalid group: ‘nagios:nagcmd’

I just ran this command instead:

Code: Select all

chown nagios:nagios /usr/local/nagios/var/rw/