diff options
author | Petter Reinholdtsen <pere@hungry.com> | 2007-10-12 17:26:49 +0000 |
---|---|---|
committer | Petter Reinholdtsen <pere@hungry.com> | 2007-10-12 17:26:49 +0000 |
commit | f98f9e310682cd77180ef49e5fda0994d973336e (patch) | |
tree | dac9403cd49066d4bcc58fdeef88bce1c50281cf /hostclass-summary | |
parent | d39cfeb90a670a5a7006602e56cd26501ad1343d (diff) | |
download | sitesummary-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.
Diffstat (limited to 'hostclass-summary')
-rwxr-xr-x | hostclass-summary | 28 |
1 files changed, 28 insertions, 0 deletions
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}); + } +} |