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 # Check if the service is already running?
40 if [ ! -f /var/lock/subsys/nagios ]; then
44 # remove stale cmd pipe (or nagios won't start if it exists)
45 rm -f /var/lib/nagios/rw/nagios.cmd
46 daemon /usr/sbin/nagios -d /etc/nagios/nagios.cfg </dev/null
48 if [ $RETVAL -eq 0 ]; then
49 touch /var/lock/subsys/nagios
52 msg_already_running Nagios
58 if [ -f /var/lock/subsys/nagios ]; then
61 rm -f /var/lock/subsys/nagios > /dev/null 2>&1
63 msg_not_running Nagios
68 # See how we were called.
76 checkconfig|check|configtest)
77 /usr/sbin/nagios -v /etc/nagios/nagios.cfg
81 if [ -f /var/lock/subsys/nagios ]; then
88 msg_not_running Nagios
94 checkconfig || exit && started
103 msg_usage "$0 {start|stop|restart|reload|force-reload|status|checkconfig}"