Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
#! /usr/bin/env perl
use Data::Dumper;
my @DOM0 = (
'vengeance',
'tardis',
'ds9',
'prometheus',
'asimov',
'executor',
'durandel'
);
sub parseOutput {
my $output = shift;
my @lines = split( "\n", $output );
my %domu;
return ( 'noname' ) unless $lines[0] =~ m/^Name/;
return ( 'baddomu') unless $lines[1] =~ m/^Domain-0/;
for ( my $i = 2; $i < @lines; $i++ ) {
my ( $name,$id,$mem,$vcpu,$state,$time) = split( /\s+/, $lines[$i] );
$domu{$name}{'ID'} = $id;
$domu{$name}{'memory'} = $mem;
$domu{$name}{'CPUs'} = $vcpu;
}
return \%domu;
}
my %hier;
my $dom0;
foreach $dom0 ( @DOM0 ) {
# print STDOUT "Working on $dom0\n";
my $output = `ssh root\@$dom0 'xl list'`;
$heir{$dom0} = &parseOutput( $output );
}
print "DOM0\tDOMU\tMemory\tCPU\tID\n";
foreach $dom0 ( sort keys %heir ) {
print "$dom0\n";
my $thisOne = $heir{$dom0};
foreach my $domu ( sort keys %$thisOne ) {
print "\t" . join( "\t", ( $domu, $$thisOne{$domu}{'memory'}, $$thisOne{$domu}{'CPUs'}, $$thisOne{$domu}{'ID'} ) ) . "\n";
} # foreach
} # foreach
my $host = `hostname -f`;
chomp $host;
print "Generated by $0 running on $host\n";
1;