3 # nagios Host/service/network monitoring daemon
6 # description: Host/service/network monitoring daemon which uses snort as NIDS
9 # Source function library
10 . /etc/rc.d/init.d/functions
13 . /etc/sysconfig/network
16 [ -f /etc/sysconfig/nagios ] && . /etc/sysconfig/nagios
18 # Check that networking is up.
19 if is_yes "${NETWORKING}"; then
20 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
21 msg_network_down nagios
29 /usr/sbin/nagios -v /etc/nagios/nagios.cfg > /dev/null
31 if [ $rc -gt 0 ]; then
33 nls 'The configuration is broken. See details with %s "checkconfig"' /etc/rc.d/init.d/nagios
39 # See how we were called.
42 # Check if the service is already running?
43 if [ ! -f /var/lock/subsys/nagios ]; then
47 # remove stale cmd pipe (or nagios won't start if it exists)
48 rm -f /var/lib/nagios/rw/nagios.cmd
49 daemon /usr/sbin/nagios -d /etc/nagios/nagios.cfg </dev/null
51 if [ $RETVAL -eq 0 ]; then
52 touch /var/lock/subsys/nagios
55 msg_already_running nagios
60 if [ -f /var/lock/subsys/nagios ]; then
63 rm -f /var/lock/subsys/nagios > /dev/null 2>&1
65 msg_not_running nagios
72 checkconfig|check|configtest)
73 /usr/sbin/nagios -v /etc/nagios/nagios.cfg
77 if [ -f /var/lock/subsys/nagios ]; then
84 msg_not_running nagios >&2
90 checkconfig || exit && started
96 msg_usage "$0 {start|stop|restart|reload|force-reload|status|checkconfig}"