aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetter Reinholdtsen <pere@hungry.com>2007-10-12 17:26:49 +0000
committerPetter Reinholdtsen <pere@hungry.com>2007-10-12 17:26:49 +0000
commitf98f9e310682cd77180ef49e5fda0994d973336e (patch)
treedac9403cd49066d4bcc58fdeef88bce1c50281cf
parentd39cfeb90a670a5a7006602e56cd26501ad1343d (diff)
downloadsitesummary-f98f9e310682cd77180ef49e5fda0994d973336e.tar.gz
sitesummary-f98f9e310682cd77180ef49e5fda0994d973336e.tar.bz2
sitesummary-f98f9e310682cd77180ef49e5fda0994d973336e.tar.xz
* UNRELEASED
* Add get_hostclass() to the SiteSummary perl module API. * Add host class summary to the default list of web reports.
-rw-r--r--Makefile1
-rw-r--r--SiteSummary.pm9
-rw-r--r--debian/changelog9
-rwxr-xr-xhostclass-summary28
-rwxr-xr-xsitesummary-makewebreport2
5 files changed, 48 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index c4f28af..e88ad73 100644
--- a/Makefile
+++ b/Makefile
@@ -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