Page 1 of 2

Nagios Service Not Starting

Posted: Mon Feb 10, 2020 8:11 am
by amitgupta19
I have installed Nagios Core 4.4.5 on OEL 7.

and Planning to Migrate my Previous Nagios(Which is installed on the Centos) to above OEL7.

I have Copied the following files from the previous Nagios:

Folder---/usr/local/nagios/etc
linux-hosts.cfg--for defining the Linux Hosts
nagios.cfg
resource.cfg
windows-hosts.cfg--for defining the Windows Hosts

Folder---/usr/local/nagios/etc/objects
commands.cfg
contacts.cfg
host-groups.cfg
services.cfg
templates.cfg

Pre Flight Check is running without any errors.

But nagios Service is not able to able to start and giving the following error:
======================================================================================
[amgupta@xxxnagios3 objects]$ sudo 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 Mon 2020-02-10 07:44:44 EST; 4min 41s ago
Docs: https://www.nagios.org/documentation
Process: 10506 ExecStopPost=/bin/rm -f /usr/local/nagios/var/rw/nagios.cmd (code=exited, status=0/SUCCESS)
Process: 10501 ExecStop=/bin/kill -s TERM ${MAINPID} (code=exited, status=1/FAILURE)
Process: 10489 ExecStart=/usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg (code=exited, status=0/SUCCESS)
Process: 10486 ExecStartPre=/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg (code=exited, status=0/SUCCESS)
Main PID: 10491 (code=exited, status=1/FAILURE)

Feb 10 07:44:42 xxxnagios3 nagios[10491]: Local time is Mon Feb 10 07:44:42 EST 2020
Feb 10 07:44:42 xxxnagios3 nagios[10491]: LOG VERSION: 2.0
Feb 10 07:44:42 xxxnagios3 nagios[10491]: qh: Socket '/usr/local/nagios/var/rw/nagios.qh' successfully initialized
Feb 10 07:44:42 xxxnagios3 nagios[10491]: qh: core query handler registered
Feb 10 07:44:42 xxxnagios3 nagios[10491]: qh: echo service query handler registered
Feb 10 07:44:42 xxxnagios3 systemd[1]: nagios.service: main process exited, code=exited, status=1/FAILURE
Feb 10 07:44:42 xxxnagios3 kill[10501]: kill: cannot find process ""
Feb 10 07:44:42 xxxnagios3 systemd[1]: nagios.service: control process exited, code=exited status=1
Feb 10 07:44:44 xxxnagios3 systemd[1]: Unit nagios.service entered failed state.
Feb 10 07:44:44 xxxnagios3 systemd[1]: nagios.service failed.
========================================================================================================

Re: Nagios Service Not Starting

Posted: Mon Feb 10, 2020 7:07 pm
by Box293
I suspect this KB article may fix your issue:
https://support.nagios.com/kb/article/n ... s-796.html

Re: Nagios Service Not Starting

Posted: Tue Feb 11, 2020 7:22 am
by amitgupta19
KB Article is talking about the following error:
nagios.lock

But above error is not in my Logs.

As a solution it is asking to install the Nagios from the Source. Which i have already done.

Can you please look into it and suggest something else?

Re: Nagios Service Not Starting

Posted: Tue Feb 11, 2020 9:09 am
by scottwilkerson
Can you share the output of the following

Code: Select all

tail -50 /usr/local/nagios/var/nagios.log

Re: Nagios Service Not Starting

Posted: Tue Feb 11, 2020 9:58 am
by amitgupta19
Please find here with the Logs:

++++++++++++++++++++++++++++++++++++++++++++++++++++
[amgupta@xxxnagios3 ~]$ tail -50 /usr/local/nagios/var/nagios.log
[1580986731] Auto-save of retention data completed successfully.
[1580990331] Auto-save of retention data completed successfully.
[1580993931] Auto-save of retention data completed successfully.
[1580997531] Auto-save of retention data completed successfully.
[1581001131] Auto-save of retention data completed successfully.
[1581004731] Auto-save of retention data completed successfully.
[1581008331] Auto-save of retention data completed successfully.
[1581010613] Caught SIGTERM, shutting down...
[1581010613] Caught SIGTERM, shutting down...
[1581010613] Successfully shutdown... (PID=1661)
[1581338421] Nagios 4.4.5 starting... (PID=10236)
[1581338421] Local time is Mon Feb 10 07:40:21 EST 2020
[1581338421] LOG VERSION: 2.0
[1581338421] qh: Socket '/usr/local/nagios/var/rw/nagios.qh' successfully initialized
[1581338421] qh: core query handler registered
[1581338421] qh: echo service query handler registered
[1581338421] qh: help for the query handler registered
[1581338421] wproc: Successfully registered manager as @wproc with query handler
[1581338421] wproc: Registry request: name=Core Worker 10237;pid=10237
[1581338421] wproc: Registry request: name=Core Worker 10238;pid=10238
[1581338421] wproc: Registry request: name=Core Worker 10239;pid=10239
[1581338421] wproc: Registry request: name=Core Worker 10242;pid=10242
[1581338421] wproc: Registry request: name=Core Worker 10244;pid=10244
[1581338421] wproc: Registry request: name=Core Worker 10243;pid=10243
[1581338421] wproc: Registry request: name=Core Worker 10241;pid=10241
[1581338421] wproc: Registry request: name=Core Worker 10245;pid=10245
[1581338421] wproc: Registry request: name=Core Worker 10240;pid=10240
[1581338421] Error: Could not load module '/usr/local/nagios/bin/ndomod.o' -> /usr/local/nagios/bin/ndomod.o: cannot open shared object file: No such file or directory
[1581338421] Error: Failed to load module '/usr/local/nagios/bin/ndomod.o'.
[1581338421] Error: Module loading failed. Aborting.
[1581338682] Nagios 4.4.5 starting... (PID=10491)
[1581338682] Local time is Mon Feb 10 07:44:42 EST 2020
[1581338682] LOG VERSION: 2.0
[1581338682] qh: Socket '/usr/local/nagios/var/rw/nagios.qh' successfully initialized
[1581338682] qh: core query handler registered
[1581338682] qh: echo service query handler registered
[1581338682] qh: help for the query handler registered
[1581338682] wproc: Successfully registered manager as @wproc with query handler
[1581338682] wproc: Registry request: name=Core Worker 10492;pid=10492
[1581338682] wproc: Registry request: name=Core Worker 10493;pid=10493
[1581338682] wproc: Registry request: name=Core Worker 10496;pid=10496
[1581338682] wproc: Registry request: name=Core Worker 10494;pid=10494
[1581338682] wproc: Registry request: name=Core Worker 10498;pid=10498
[1581338682] wproc: Registry request: name=Core Worker 10495;pid=10495
[1581338682] wproc: Registry request: name=Core Worker 10497;pid=10497
[1581338682] wproc: Registry request: name=Core Worker 10499;pid=10499
[1581338682] wproc: Registry request: name=Core Worker 10500;pid=10500
[1581338682] Error: Could not load module '/usr/local/nagios/bin/ndomod.o' -> /usr/local/nagios/bin/ndomod.o: cannot open shared object file: No such file or directory
[1581338682] Error: Failed to load module '/usr/local/nagios/bin/ndomod.o'.
[1581338682] Error: Module loading failed. Aborting.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Re: Nagios Service Not Starting

Posted: Tue Feb 11, 2020 10:12 am
by scottwilkerson
Ok, it looks like your nagios.cfg has a like to add the ndo neb module, but the file doesn't exist.

It this was unintentional edit the nagios.cfg and comment out the line that looks like this

Code: Select all

broker_module=/usr/local/nagios/bin/ndomod.o config_file=/usr/local/nagios/etc/ndomod.cfg
changing to

Code: Select all

#broker_module=/usr/local/nagios/bin/ndomod.o config_file=/usr/local/nagios/etc/ndomod.cfg
Then try to start Nagios

Re: Nagios Service Not Starting

Posted: Tue Feb 11, 2020 11:11 am
by amitgupta19
Thanks Scott.

After commenting the line. Nagios Service is started.

I hope that it was due to the reason that i copied the nagios.cfg file from my old nagios server and that server has ndo2db installed, but this does not have.

Can you put some light on if ndo2db is really helpful or not?

Re: Nagios Service Not Starting

Posted: Tue Feb 11, 2020 12:10 pm
by scottwilkerson
amitgupta19 wrote:Thanks Scott.

After commenting the line. Nagios Service is started.

I hope that it was due to the reason that i copied the nagios.cfg file from my old nagios server and that server has ndo2db installed, but this does not have.

Can you put some light on if ndo2db is really helpful or not?
That would do it.

ndo2db takes Nagios information and puts it in a database. It can be helpful if you have something that is going to make calls to the database to retrieve the information (such as a custom created interface), however if you do not it actually is of no use.

Re: Nagios Service Not Starting

Posted: Tue Feb 11, 2020 12:22 pm
by amitgupta19
Thanks Scott.

I am Planning to Integrate the Nagios with Service Now using the Plugin NSNT. Where the pre-requisite is to have the MYSQL DB.

I have a query...

Can i install the MYSQL DB at any any point of time ?

or it has to be installed while i was installing the Nagios ?

Any ideas...

Re: Nagios Service Not Starting

Posted: Tue Feb 11, 2020 12:24 pm
by scottwilkerson
amitgupta19 wrote:Can i install the MYSQL DB at any any point of time ?
yes
amitgupta19 wrote:or it has to be installed while i was installing the Nagios ?
No, Nagios itself doesn't use a database at all and doesn't even have an option to do so, you can only use a database with Nagios through an addon module such as ndo2db that can be added at any time.