service nagios start failed

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
donnyforbes
Posts: 357
Joined: Tue Jun 13, 2017 2:17 pm

service nagios start failed

Post by donnyforbes »

Moderator Edit: This thread has been split from another - https://support.nagios.com/forum/viewto ... =7&t=21721
In the future, please create a new thread and link to the old one instead of adding on.


I have done the the following script in the following /etc/systemd/system/nagios.service

[Unit]
Description=Nagios Core Monitoring Daemon
After=network.target

[Service]
User=nagios
Group=nagios
Type=forking
ExecStart=/usr/lib/systemd/scripts/nagios start
ExecStop=/usr/lib/systemd/scripts/nagios stop
ExecReload=/usr/lib/systemd/scripts/nagios reload

[Install]
WantedBy=multi-user.target

Then did the following:
[root@nag nagios]# systemctl stop nagios
[root@nag nagios]# systemctl start nagios
Job for nagios.service failed because the control process exited with error code. See "systemctl status nagios.service" and "journalctl -xe" for details.

Can you please assist me with this? I am running CentOS Linux release 7.0.1406 (Core) and nagios 4.3.2 core.
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: service nagios start failed

Post by tgriep »

Try using the following in the nagios.service file for starting / stoping the Nagios Daemon.
Adjust the paths as needed.

Code: Select all

[Unit]
Description=Nagios Network Monitoring
After=network.target
Documentation=https://www.nagios.org/documentation/

[Service]
Type=forking
User=nagios
Group=nagios
PIDFile=/var/run/nagios/nagios.pid
# Verify Nagios config before start as upstream suggested
ExecStartPre=/usr/sbin/nagios -v /etc/nagios/nagios.cfg
ExecStart=/usr/sbin/nagios -d /etc/nagios/nagios.cfg
ExecStopPost=/usr/bin/rm -f /var/spool/nagios/cmd/nagios.cmd


[Install]
WantedBy=multi-user.target
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked