aboutsummaryrefslogtreecommitdiffstats
path: root/sitecontact-summary
diff options
context:
space:
mode:
Diffstat (limited to 'sitecontact-summary')
-rwxr-xr-xsitecontact-summary28
1 files changed, 28 insertions, 0 deletions
diff --git a/sitecontact-summary b/sitecontact-summary
new file mode 100755
index 0000000..2639b00
--- /dev/null
+++ b/sitecontact-summary
@@ -0,0 +1,28 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use SiteSummary;
+
+my %sitecontacts;
+
+for_all_hosts(\&handle_host);
+
+print_summary();
+
+sub handle_host {
+ my $hostid = shift;
+ #print "$hostid\n";
+ for my $sitecontact (get_sitecontact($hostid)) {
+ $sitecontact = "" unless defined $sitecontact;
+ $sitecontacts{$sitecontact}++;
+ }
+}
+
+sub print_summary {
+ printf(" %-20s %5s\n", "contact", "count");
+ for my $sitecontact (sort keys %sitecontacts) {
+ printf(" %-20s %5d\n", $sitecontact, $sitecontacts{$sitecontact});
+ }
+}