diff options
-rw-r--r-- | Makefile | 3 | ||||
-rw-r--r-- | debian/changelog | 1 | ||||
-rw-r--r-- | debian/sitesummary.install | 1 | ||||
-rwxr-xr-x | munin-plugin | 53 |
4 files changed, 58 insertions, 0 deletions
@@ -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; |