aboutsummaryrefslogtreecommitdiffstats
path: root/sitecontact-summary
blob: 2639b0000f5ad3fc089d404ba786472cc05a50ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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});
    }
}