#! /bin/sh # modify this to point to your installed SEC binary SEC=/tools/sec/bin/sec # modify this to point to your nagios log file NAGLOG=/var/log/nagios/nagios.log # set this to the argument to the --file option passed to the NEB module # in nagios.cfg. EVENTFILE=/tmp/sec # set this to a nagios owned directory to contain log files and rules files. WORKDIR=/var/log/nagios/sec PATH=/usr/bin:/usr/sbin:/bin # if workdir exists use it else use the current directory [ -d $WORKDIR ] && cd $WORKDIR # run the sec process as nagios # use su if we are running as root, sudo otherwise. if [ `id -un` != "nagios" ]; then if [ `id -u` -ne 0 ]; then exec sudo -u nagios $0 "$@"; else # This isn't quite exactly the same as above but it will work. exec su nagios -c "$0 $@"; fi fi case $1 in start) $SEC --input ${EVENTFILE} \ --input ${NAGLOG}=NAG_LOG \ --conf corr.sr \ --conf nagios_log.sr \ --dump sec_dump.txt \ --log sec_log.txt \ --pid sec_pid.txt \ --intevents \ --intcontexts \ $TEST > /dev/null 2>&1 < /dev/null & ;; stop) kill `cat sec_pid.txt`;; relog) kill -USR2 `cat sec_pid.txt`; ;; init) kill -HUP `cat sec_pid.txt`; ;; dump) rm sec_dump.txt kill -USR1 `cat sec_pid.txt`; sleep 1 less sec_dump.txt ;; test) $SEC --testonly --conf forward.sr --conf nagios_log.sr ;; reload) kill -ABRT `cat sec_pid.txt` ;; pid) cat sec_pid.txt ;; *) echo "$0: " esac