aboutsummaryrefslogtreecommitdiffstats
path: root/debian
diff options
context:
space:
mode:
Diffstat (limited to 'debian')
-rw-r--r--debian/changelog1
-rwxr-xr-xdebian/sitesummary.cron.daily30
-rw-r--r--debian/sitesummary.install1
3 files changed, 31 insertions, 1 deletions
diff --git a/debian/changelog b/debian/changelog
index bdadf3f..b3aa29d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -10,6 +10,7 @@ sitesummary (0.0.51) UNRELASED; urgency=low
* Make sure the generated Nagios host entries uses a template.
* Make sure cron job exit imediately and without an error code if
the sitesummary package is removed but not purged (Closes: #563066).
+ * Implement draft Nagios autoconfiguration.
-- Finn-Arne Johansen <finnarne@debian> Wed, 18 Nov 2009 08:21:12 +0100
diff --git a/debian/sitesummary.cron.daily b/debian/sitesummary.cron.daily
index 9f0c5b6..777ef03 100755
--- a/debian/sitesummary.cron.daily
+++ b/debian/sitesummary.cron.daily
@@ -12,6 +12,12 @@ nodes=/usr/sbin/sitesummary-nodes
# the default munin configuration.
MUNINDIR=/var/lib/sitesummary
+# Specifies where to save the automatically generated nagios
+# configuration. Add NAGIOSCFG="/etc/nagios3/sitesummary.cfg" to
+# /etc/default/nagios3 toget Nagios to use this automatically
+# generated configuration
+NAGIOSDIR=/var/lib/sitesummary
+
[ -f /etc/sitesummary/collector.cfg ] && . /etc/sitesummary/collector.cfg
# Exit imediately if the package is removed but nor purged
@@ -66,11 +72,33 @@ EOF
mv $MUNINDIR/munin.conf.new $MUNINDIR/munin.conf
}
-# Only enable if munin is installed.
+generate_nagios_config() {
+ (
+ printf "# Generated "; date
+
+ sitesummary-nodes -n
+
+ 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 && \
+ mv $NAGIOSDIR/nagios-generated.cfg.new $NAGIOSDIR/nagios-generated.cfg
+}
+
+# Only enable if munin and sitesummary is installed.
if [ -f /etc/munin/munin.conf ] && [ -x /usr/sbin/sitesummary-nodes ]; then
generate_munin_config
fi
+# Only enable if nagios v3 and sitesummary is installed.
+if [ -f /etc/init.d/nagios3 ] && [ -x /usr/sbin/sitesummary-nodes ]; then
+ generate_nagios_config
+ invoke-rc.d nagios3 reload
+fi
+
[ -d $entriesdir ] && remove_old_entries
# Update the web report once a day
diff --git a/debian/sitesummary.install b/debian/sitesummary.install
index 60673d2..1d9d629 100644
--- a/debian/sitesummary.install
+++ b/debian/sitesummary.install
@@ -1,4 +1,5 @@
debian/tmp/etc/apache2
+debian/tmp/etc/nagios3
debian/tmp/usr/lib/cgi-bin
debian/tmp/usr/lib/sitesummary/*-summary
debian/tmp/usr/sbin/sitesummary-makewebreport