|
|
|
|
#!@l_prefix@/lib/openpkg/bash @l_prefix@/etc/rc
|
|
|
|
|
##
|
|
|
|
|
## rc.nagios -- Run-Commands
|
|
|
|
|
##
|
|
|
|
|
|
|
|
|
|
%config
|
|
|
|
|
nagios_enable="$openpkg_rc_def"
|
|
|
|
|
nagios_cfg="nagios.cfg"
|
|
|
|
|
nagios_comment_file="@l_prefix@/var/nagios/comment.log"
|
|
|
|
|
nagios_comment_prolog="true"
|
|
|
|
|
nagios_comment_epilog="true"
|
|
|
|
|
nagios_comment_numfiles="10"
|
|
|
|
|
nagios_comment_minsize="1M"
|
|
|
|
|
nagios_comment_complevel="9"
|
|
|
|
|
nagios_downtime_file="@l_prefix@/var/nagios/downtime.log"
|
|
|
|
|
nagios_downtime_prolog="true"
|
|
|
|
|
nagios_downtime_epilog="true"
|
|
|
|
|
nagios_downtime_numfiles="10"
|
|
|
|
|
nagios_downtime_minsize="1M"
|
|
|
|
|
nagios_downtime_complevel="9"
|
|
|
|
|
nagios_nagios_file="@l_prefix@/var/nagios/nagios.log"
|
|
|
|
|
nagios_nagios_prolog="true"
|
|
|
|
|
nagios_nagios_epilog="true"
|
|
|
|
|
nagios_nagios_numfiles="10"
|
|
|
|
|
nagios_nagios_minsize="1M"
|
|
|
|
|
nagios_nagios_complevel="9"
|
|
|
|
|
|
|
|
|
|
%common
|
|
|
|
|
nagios_pidfile="@l_prefix@/var/nagios/nagios.lock"
|
|
|
|
|
nagios_signal () {
|
|
|
|
|
[ -f $nagios_pidfile ] && kill -$1 `cat $nagios_pidfile`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
%status -u @l_musr@ -o
|
|
|
|
|
nagios_usable="unknown"
|
|
|
|
|
nagios_active="no"
|
|
|
|
|
rcService nagios enable yes && \
|
|
|
|
|
nagios_signal 0 && nagios_active="yes"
|
|
|
|
|
echo "nagios_enable=\"$nagios_enable\""
|
|
|
|
|
echo "nagios_usable=\"$nagios_usable\""
|
|
|
|
|
echo "nagios_active=\"$nagios_active\""
|
|
|
|
|
|
|
|
|
|
%start -u @l_musr@
|
|
|
|
|
rcService nagios enable yes || exit 0
|
|
|
|
|
rcService nagios active yes && exit 0
|
|
|
|
|
@l_prefix@/sbin/nagios -d @l_prefix@/etc/nagios/$nagios_cfg >/dev/null 2>&1
|
|
|
|
|
|
|
|
|
|
%stop -u @l_musr@
|
|
|
|
|
rcService nagios enable yes || exit 0
|
|
|
|
|
rcService nagios active no && exit 0
|
|
|
|
|
nagios_signal TERM
|
|
|
|
|
rm -f $nagios_pidfile 2>/dev/null || true
|
|
|
|
|
|
|
|
|
|
%restart -u @l_musr@
|
|
|
|
|
rcService nagios enable yes || exit 0
|
|
|
|
|
rcService nagios active no && exit 0
|
|
|
|
|
rc nagios stop
|
|
|
|
|
sleep 2
|
|
|
|
|
rc nagios start
|
|
|
|
|
|
|
|
|
|
%reload -u @l_musr@
|
|
|
|
|
rcService nagios enable yes || exit 0
|
|
|
|
|
rcService nagios active no && exit 0
|
|
|
|
|
nagios_signal HUP
|
|
|
|
|
|
|
|
|
|
%daily -u @l_musr@
|
|
|
|
|
rcService nagios enable yes || exit 0
|
|
|
|
|
|
|
|
|
|
# rotate logfiles
|
|
|
|
|
shtool rotate -f \
|
|
|
|
|
-n ${nagios_nagios_numfiles} -s ${nagios_nagios_minsize} -d \
|
|
|
|
|
-z ${nagios_nagios_complevel} -o @l_musr@ -g @l_mgrp@ -m 644 \
|
|
|
|
|
-P "${nagios_nagios_prolog}" \
|
|
|
|
|
-E "${nagios_nagios_epilog}" \
|
|
|
|
|
${nagios_nagios_file}
|
|
|
|
|
shtool rotate -f \
|
|
|
|
|
-n ${nagios_comment_numfiles} -s ${nagios_comment_minsize} -d \
|
|
|
|
|
-z ${nagios_comment_complevel} -o @l_musr@ -g @l_mgrp@ -m 664 \
|
|
|
|
|
-P "${nagios_comment_prolog}" \
|
|
|
|
|
-E "${nagios_comment_epilog}" \
|
|
|
|
|
${nagios_comment_file}
|
|
|
|
|
shtool rotate -f \
|
|
|
|
|
-n ${nagios_downtime_numfiles} -s ${nagios_downtime_minsize} -d \
|
|
|
|
|
-z ${nagios_downtime_complevel} -o @l_musr@ -g @l_mgrp@ -m 664 \
|
|
|
|
|
-P "${nagios_downtime_prolog}" \
|
|
|
|
|
-E "${nagios_downtime_epilog}" \
|
|
|
|
|
${nagios_downtime_file}
|
|
|
|
|
|