#!/usr/bin/perl use strict; use warnings; use SiteSummary; use Getopt::Std; my %agegroup = ( 0 => '>0 days', 3 => '>3 days', 7 => '>one week', 14 => '>14 days', 30 => '>30 days', 90 => '>90 days', 180 => '>180 days', ); my %agedist; my %opts; sub usage { my $retval = shift; print < $b; } keys %agegroup) { if ($age > $group) { $thisgroup = $group; } } if (defined $thisgroup) { if (exists $agedist{$thisgroup}) { push @{$agedist{$thisgroup}}, $hostid ; } else { $agedist{$thisgroup} = [$hostid]; } } } sub print_summary { printf(" %-20s %5s\n", "age", "count"); for my $group (sort { $a <=> $b; } keys %agedist) { printf(" %-20s %5d\n", $agegroup{$group}, scalar @{$agedist{$group}}); if (exists $opts{l}) { for my $hostid (sort @{$agedist{$group}}) { my $hostname = get_hostname($hostid); my $site = get_site($hostid) || ""; my $sitegroup = get_sitegroup($hostid) || ""; printf " %s %s/%s %s\n", $hostname, $site, $sitegroup, $hostid; } print "\n"; } } }