aboutsummaryrefslogtreecommitdiffstats
path: root/hardware-models
diff options
context:
space:
mode:
authorPetter Reinholdtsen <pere@hungry.com>2008-07-25 17:29:44 +0000
committerPetter Reinholdtsen <pere@hungry.com>2008-07-25 17:29:44 +0000
commit87aa92808aaf76340c00577657e15b588b9618c8 (patch)
treebf8f0c38abcff1007a4c8b7ec3264e9d5f4a1f3d /hardware-models
parent7475f92516def93743800968da3baf8ddc475b2f (diff)
downloadsitesummary-87aa92808aaf76340c00577657e15b588b9618c8.tar.gz
sitesummary-87aa92808aaf76340c00577657e15b588b9618c8.tar.bz2
sitesummary-87aa92808aaf76340c00577657e15b588b9618c8.tar.xz
Use old name standard for new hardware symmary script.
Diffstat (limited to 'hardware-models')
-rwxr-xr-xhardware-models78
1 files changed, 0 insertions, 78 deletions
diff --git a/hardware-models b/hardware-models
deleted file mode 100755
index ebdc390..0000000
--- a/hardware-models
+++ /dev/null
@@ -1,78 +0,0 @@
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-
-use SiteSummary;
-use Getopt::Std;
-
-my %vendors;
-my %models;
-my %hostmap;
-my %modelmap;
-my %opts;
-
-sub usage {
- my $retval = shift;
- print <<EOF;
-Usage: $0 [-l]
- -l list hosts with the given vendor/model
-EOF
- exit $retval;
-}
-
-getopt("l", \%opts) || usage(1);
-
-for_all_hosts(\&handle_host);
-
-print_summary();
-
-sub handle_host {
- my $hostid = shift;
- #print "$hostid\n";
- my ($vendor, $model, undef) = get_hardware_info($hostid);
- $vendor = "[unknown]" unless defined $vendor;
- $vendors{$vendor}++;
- if ($model) {
- $models{$vendor}{$model}++;
- if (exists $modelmap{$vendor} && exists $modelmap{$vendor}{$model}) {
- push @{$modelmap{$vendor}{$model}}, $hostid ;
- } else {
- $modelmap{$vendor}{$model} = [$hostid];
- }
- } else {
- if (exists $hostmap{$vendor}) {
- push @{$hostmap{$vendor}}, $hostid ;
- } else {
- $hostmap{$vendor} = [$hostid];
- }
- }
-}
-
-sub print_summary {
- printf(" %-25s %5s\n", "vendor", "count");
- for my $vendor (sort keys %vendors) {
- printf(" %-25s %5d\n", $vendor, $vendors{$vendor});
- if (exists $opts{l}) {
- if (exists $hostmap{$vendor}) {
- for my $hostid (sort @{$hostmap{$vendor}}) {
- my $hostname = get_hostname($hostid);
- my ($vendor, $model, undef) = get_hardware_info($hostid);
- $vendor = "[unknown]" unless defined $vendor;
- $model = "" unless defined $model;
- printf " %s %s/%s %s\n", $hostname, $vendor, $model, $hostid;
- }
- }
- }
- for my $model (sort keys %{$models{$vendor}}) {
- printf(" %-23s %5d\n", $model, $models{$vendor}{$model});
- if (exists $opts{l}) {
- for my $hostid (sort @{$modelmap{$vendor}{$model}}) {
- my $hostname = get_hostname($hostid);
- my ($vendor, $model, undef) = get_hardware_info($hostid);
- printf " %s %s/%s %s\n", $hostname, $vendor, $model, $hostid;
- }
- }
- }
- }
-}