Page 1 of 1

service nagios start failed

Posted: Wed Jun 14, 2017 9:09 am
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.

Re: service nagios start failed

Posted: Thu Jun 15, 2017 12:33 pm
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