Automatic Startup
Primary tabs
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 onVerify your initial Nagios configuration:
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfgAnd 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/nagiosCreate 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 runOur 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 runFinally, add the service to daemontools by creating the symbolic link in /service
ln -s /var/service/nagios /service/nagiosConfirm that the service is running:
svstat /service/nagios /service/nagios/log- Log in to post comments