aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetter Reinholdtsen <pere@hungry.com>2008-06-07 10:10:22 +0000
committerPetter Reinholdtsen <pere@hungry.com>2008-06-07 10:10:22 +0000
commit72de6a9cfbbe42e785cf817be2aa207a5b45cca6 (patch)
tree2858af6738fd9e993ccb51d96ed72ae7d9e5f909
parent00d16d08cc735c3f4a2f00ba3a10b9d84d607410 (diff)
downloadsitesummary-72de6a9cfbbe42e785cf817be2aa207a5b45cca6.tar.gz
sitesummary-72de6a9cfbbe42e785cf817be2aa207a5b45cca6.tar.bz2
sitesummary-72de6a9cfbbe42e785cf817be2aa207a5b45cca6.tar.xz
* Add munin plugin to graph sites based on an idea from Narvik.
-rw-r--r--Makefile3
-rw-r--r--debian/changelog1
-rw-r--r--debian/sitesummary.install1
-rwxr-xr-xmunin-plugin53
4 files changed, 58 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 026d0fc..d384b57 100644
--- a/Makefile
+++ b/Makefile
@@ -51,6 +51,9 @@ install-server:
$(INSTALL) -o www-data -d $(DESTDIR)$(pkgvardir)/tmpstorage
$(INSTALL) -d $(DESTDIR)$(pkgvardir)/www
+ $(INSTALL) -d $(DESTDIR)/usr/share/munin/plugins/.
+ $(INSTALL) munin-plugin $(DESTDIR)/usr/share/munin/plugins/sitesummary-sites
+
install-client:
$(INSTALL) -d $(DESTDIR)$(sbindir)
$(INSTALL) sitesummary-client sitesummary-upload $(DESTDIR)$(sbindir)
diff --git a/debian/changelog b/debian/changelog
index 3cbb4e3..7820cc0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -11,6 +11,7 @@ sitesummary (0.0.38) UNRELEASED; urgency=low
when generating nagios checks.
- More automatically configured Nagios checks based on the
old Debian Edu configuration.
+ * Add munin plugin to graph sites based on an idea from Narvik.
-- Petter Reinholdtsen <pere@debian.org> Sun, 1 Jun 2008 01:19:50 +0200
diff --git a/debian/sitesummary.install b/debian/sitesummary.install
index 1ac7e58..60673d2 100644
--- a/debian/sitesummary.install
+++ b/debian/sitesummary.install
@@ -3,5 +3,6 @@ debian/tmp/usr/lib/cgi-bin
debian/tmp/usr/lib/sitesummary/*-summary
debian/tmp/usr/sbin/sitesummary-makewebreport
debian/tmp/usr/sbin/sitesummary-nodes
+debian/tmp/usr/share/munin/plugins
debian/tmp/usr/share/perl5
debian/tmp/var/lib/sitesummary
diff --git a/munin-plugin b/munin-plugin
new file mode 100755
index 0000000..0034e20
--- /dev/null
+++ b/munin-plugin
@@ -0,0 +1,53 @@
+#!/usr/bin/perl
+#
+# Generate list of nodes to load from /etc/munin/munin.conf to check
+# all the machines reporting to sitesummary.
+
+use strict;
+use warnings;
+
+use SiteSummary;
+
+my %sitelabels;
+
+if (!defined $ARGV[0]) {
+ for_all_hosts(\&handle_host);
+ for my $sitelabel (sort keys %sitelabels) {
+ print "$sitelabel.value ", $sitelabels{$sitelabel}, "\n";
+ }
+} elsif ($ARGV[0] eq "config") {
+ for_all_hosts(\&handle_host);
+ print "graph_title SiteSummary History\n";
+ print "graph_order " . join(" ", sort keys %sitelabels), "\n";
+ print "graph_vlabel count\n";
+ print "graph_scale yes\n";
+ print "graph_height 400\n";
+ print "graph_category SiteSummary\n";
+
+ my $first = 1;
+ for my $sitelabel (sort keys %sitelabels) {
+ print "$sitelabel.label $sitelabel\n";
+ if ($first) {
+ print "$sitelabel.draw AREA\n"
+ } else {
+ print "$sitelabel.draw STACK\n"
+ }
+ $first = 0;
+ }
+} elsif ($ARGV[0] eq "autoconf") {
+ # This module is only available when the sitesummary collector is
+ # installed too, thus we always answer yes.
+ print "yes\n";
+ exit 0;
+}
+
+sub handle_host {
+ my $hostid = shift;
+ for my $site (get_site($hostid)) {
+ $site = "NoSite" unless defined $site;
+ $site =~ s/[^a-zA-Z_]/_/g;
+ $sitelabels{$site}++;
+ }
+}
+
+exit 0;