Automatic Startup

Control the running of your Nagios server using init scripts or daemontools.

Init Script
If you installed the included startup scripts, add them to the system services and have it automatically start at system boot:

chkconfig --add nagios
chkconfig nagios on

Verify your initial Nagios configuration:

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

And if there are no errors, you can control Nagios with:

/etc/rc.d/init.d/nagios {start|stop|restart|reload|force-reload|status}

or

service nagios {start|stop|restart|reload|force-reload|status}

Daemontools
These instructions show how to use daemontools. If you just want to use an init script, read the Nagios documentation - init scripts are provided.
If you haven't already, install daemontools.
Then, create a directory for the Nagios service:

mkdir -m 1755 /var/service/nagios
cd /var/service/nagios

Create a run script and make it executable:

#!/bin/sh
nagiosDir=/usr/local/nagios

exec 2>&1
exec $nagiosDir/bin/nagios $nagiosDir/etc/nagios.cfg 2>&1

Then make the script executable:

chmod 755 run

Our log script comes from John Simpson's:

mkdir -m 755 log
cd log
wget http://qmail.jms1.net/scripts/service-any-log-run
mv service-any-log-run run
chmod 755 run

Finally, add the service to daemontools by creating the symbolic link in /service

ln -s /var/service/nagios /service/nagios

Confirm that the service is running:

svstat /service/nagios /service/nagios/log

Recent Updates

  • 2 years 1 week ago
  • 2 years 1 week ago
  • 2 years 2 weeks ago
    php 8.x
  • 2 years 2 weeks ago
    10.6.7
  • 2 years 2 weeks ago
    Drop Centos 5/6 stuff