I've had several people ask for the script that I currently use, so here it
is.
I did NOT write this script. I pulled it from one of the perl archives, but
don't remember where.
xlvm is close to what I'm looking for, but I can't print the entire
configuration. Again, I don't have it clearly defined in my head what I'm
looking for, but if anyone has anything they use, I'd appreciate hearing
about it.
Thanks for the replies.
==============================================
#! /usr/local/bin/perl
#
# volinfo - display AIX volume group & logical volume info
#
sub usage { die "\nUsage: $0\n\n$0 - display AIX volume group & logical
volume info\n" }
$Unit = 1e6; # some may prefer 1024*1024 for megabyte
$host =`hostname`;
chomp($host);
$currenttime = localtime;
print("Volume Info for $host $currenttime\n\n");
printf("%-24s %-6s %-6s %-30s\n", 'Vg|Lv-----------', 'MBytes',
'Free--', 'Pv/Mount/Type----------');
open(LsPv, "lspv |") or die("Error: Unable to lspv\n");
while(<LsPv>) {
chop;
($pv, $id, $vg) = split;
$Pv{$vg} = ($Pv{$vg}) ? "$Pv{$vg},$pv" : $pv;
}
for $vg(keys(%Pv)) {
open(LsVg, "lsvg $vg|") or die("Error: Unable to lsvg $vg\n");
while(<LsVg>) {
if (/\sPP SIZE:\s*(\d+)\s/) {
$Sz{$vg} = $1*1024*1024;
}
elsif (/\s+TOTAL PPs:\s*(\d+)\s/) {
$Total{$vg} = $1 * $Sz{$vg};
$TotalMB += $Total{$vg};
}
elsif (/\s+FREE PPs:\s*(\d+)\s/) {
$Free{$vg} = $1 * $Sz{$vg};
$TotalFree += $Free{$vg};
}
}
}
open(Df, "df -k 2>/dev/null |") or die("Error: Unable to df\n");
while(<Df>) {
next unless m|^/|;
chop;
($fs, $total, $free, $pctu, $iused, $pctiu, $mount) = split;
($x,$x,$lv) = split(m|/|, $fs);
$Free{$lv} = $free * 1024;
$TotalFree += $Free{$lv};
}
for $vg(keys(%Pv)) {
open(LsVg, "lsvg -l $vg|") or die("Error: Unable to lsvg -l $vg\n");
<LsVg>; <LsVg>;
while(<LsVg>) {
chop;
($lv,$type,$lp,$pp,$pv,$state,$mount) = split;
$Vg{$lv} = $vg;
$Mount{$lv} = ($type eq 'jfs') ? $mount : $type;
$Mb{$lv} = $pp * $Sz{$vg};
}
}
for $vg(sort(keys(%Pv))) {
printf("%-24s %6.0f %6.0f %-30s\n",
$vg, $Total{$vg}/$Unit, $Free{$vg}/$Unit, "<$Pv{$vg}>");
for $lv(sort(split(/\s/, $Lvs{$vg}))) {
printf(" | %-21s %6.0f %6.0f %-30s\n",
$lv, $Mb{$lv}/$Unit, $Free{$lv}/$Unit, $Mount{$lv});
}
printf("%s\n", '_'x79);
}
printf("%-24s %6.0f %6.0f\n", 'Total', $TotalMB/$Unit, $TotalFree/$Unit);