File: hostclass-summary

package info (click to toggle)
sitesummary 0.1.17+deb8u3
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 468 kB
  • ctags: 103
  • sloc: perl: 1,742; sh: 787; makefile: 84
file content (28 lines) | stat: -rwxr-xr-x 539 bytes parent folder | download | duplicates (8)
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 %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});
    }
}