/usr/sbin/sitesummary-update-nagios is in sitesummary 0.1.28+deb9u1.
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/icinga/sitesummary.cfg" to
# /etc/default/icinga to get Icinga 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 icinga and sitesummary is installed.
if [ -f /etc/init.d/icinga ] && [ -x $nodes ]; then
# Only reload icinga if the configuration changed
if generate_nagios_config ; then
# subshell to avoid passing all variables from
# /etc/default/icinga to other parts of this script
(
if [ -r /etc/default/icinga ] ; then
. /etc/default/icinga
fi
# Only reload icinga if the sitesummary config is the active
# one and icinga is currently running.
if [ /etc/icinga/objects/sitesummary.cfg = "$NAGIOSCFG" ] && \
invoke-rc.d icinga status >/dev/null ; then
invoke-rc.d icinga reload >/dev/null
fi
)
fi
fi
|