diff options
-rw-r--r-- | Makefile | 1 | ||||
-rw-r--r-- | SiteSummary.pm | 9 | ||||
-rw-r--r-- | debian/changelog | 9 | ||||
-rwxr-xr-x | hostclass-summary | 28 | ||||
-rwxr-xr-x | sitesummary-makewebreport | 2 |
5 files changed, 48 insertions, 1 deletions
@@ -22,6 +22,7 @@ COLLECTORS = \ SUMMARYSCRIPTS = \ site-summary \ + hostclass-summary \ kernelversion-summary \ debian_edu-summary diff --git a/SiteSummary.pm b/SiteSummary.pm index fec7b09..b6b449a 100644 --- a/SiteSummary.pm +++ b/SiteSummary.pm @@ -10,6 +10,7 @@ our @ISA = qw(Exporter); our @EXPORT = qw( for_all_hosts get_filepath_current + get_hostclass get_site get_sitegroup get_hostname @@ -66,6 +67,14 @@ sub get_sitegroup { } # +# Return the hostclass string +# +sub get_hostclass { + my $hostid = shift; + return get_file_string($hostid, "/siteinfo/hostclass"); +} + +# # Return the hostname string # sub get_hostname { diff --git a/debian/changelog b/debian/changelog index e96419f..d8a4108 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +sitesummary (0.0.29) unstable; urgency=low + + * UNRELEASED + + * Add get_hostclass() to the SiteSummary perl module API. + * Add host class summary to the default list of web reports. + + -- Petter Reinholdtsen <pere@debian.org> Fri, 12 Oct 2007 19:14:29 +0200 + sitesummary (0.0.28) unstable; urgency=low [ Luk Claes ] diff --git a/hostclass-summary b/hostclass-summary new file mode 100755 index 0000000..c62615c --- /dev/null +++ b/hostclass-summary @@ -0,0 +1,28 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use SiteSummary; + +my %hostclasses; + +for_all_hosts(\&handle_host); + +print_summary(); + +sub handle_host { + my $hostid = shift; + #print "$hostid\n"; + for my $hostclass (get_hostclass($hostid)) { + $hostclass = "" unless defined $hostclass; + $hostclasses{$hostclass}++; + } +} + +sub print_summary { + printf(" %-20s %5s\n", "hostclass", "count"); + for my $hostclass (sort keys %hostclasses) { + printf(" %-20s %5d\n", $hostclass, $hostclasses{$hostclass}); + } +} diff --git a/sitesummary-makewebreport b/sitesummary-makewebreport index 43afc8e..47155e9 100755 --- a/sitesummary-makewebreport +++ b/sitesummary-makewebreport @@ -15,7 +15,7 @@ cat <<EOF <pre> EOF -for f in site-summary kernelversion-summary debian_edu-summary ; do +for f in hostclass-summary site-summary kernelversion-summary debian_edu-summary ; do /usr/lib/sitesummary/$f echo done |