/usr/sbin/sitesummary-update-nagios is in sitesummary 0.1.20.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | #!/bin/sh
#
# Author: Petter Reinholdtsen
set -e
nodes=/usr/sbin/sitesummary-nodes
nagiosopts=""
# Specifies where to save the automatically generated nagios
# configuration. Add NAGIOSCFG="/etc/nagios3/sitesummary.cfg" to
# /etc/default/nagios3 to get Nagios to use this automatically
# generated configuration
NAGIOSDIR=/var/lib/sitesummary
if [ -f /etc/sitesummary/collector.cfg ] ; then
. /etc/sitesummary/collector.cfg
fi
# The storage area is not configurable, because too many scripts have
# it hardcoded
entriesdir=/var/lib/sitesummary/entries
generate_nagios_config() {
(
$nodes -n $nagiosopts
if [ -f $NAGIOSDIR/nagios-generated.cfg.post ] ; then
cat $NAGIOSDIR/nagios-generated.cfg.post
fi
true
) > $NAGIOSDIR/nagios-generated.cfg.new && \
chmod a+r $NAGIOSDIR/nagios-generated.cfg.new
if [ ! -s $NAGIOSDIR/nagios-generated.cfg.new ] || \
cmp -s $NAGIOSDIR/nagios-generated.cfg.new \
$NAGIOSDIR/nagios-generated.cfg
then
rm $NAGIOSDIR/nagios-generated.cfg.new
false
else
mv $NAGIOSDIR/nagios-generated.cfg.new $NAGIOSDIR/nagios-generated.cfg
true
fi
}
# Only enable if nagios v3 and sitesummary is installed.
if [ -f /etc/init.d/nagios3 ] && [ -x $nodes ]; then
# Only reload nagios if the configuration changed
if generate_nagios_config ; then
# subshell to avoid passing all variables from
# /etc/default/nagios3 to other parts of this script
(
if [ -r /etc/default/nagios3 ] ; then
. /etc/default/nagios3
fi
# Only reload nagios if the sitesummary config is the active
# one and nagios3 is currently running.
if [ /etc/nagios3/sitesummary.cfg = "$NAGIOSCFG" ] && \
invoke-rc.d nagios3 status >/dev/null ; then
invoke-rc.d nagios3 reload >/dev/null
fi
)
fi
fi
|