#!/usr/bin/perl # # Display the DIMM slots in use on a system, provide a total # slot count, memory count. This script uses the lscfg -vp # command to provide the data. Output parsing depends on the # order of the output of the lscfg command. This script # was tested under AIX 5.3 and 6.1, on Power5 P520, P550, P570, # Power6 P570 systems and power7 p770s. Your mileage may vary. # # This script should report correctly for the whole system even # in LPARed environments. # # Andy Welter # V1.0 - 2008 # open (LSCFG, "lscfg -vp |") || die "cannot run lscfg\n"; # # Scan for Memory DIMM lines, then get the location and size. # break out of the inner loop when you get the size. $totsize=0; $count=0; print "Location FRU SIZE\n"; print "-----------------------------------------------------\n"; while ($_=) { chomp; if (m/memory dimm/i) { $count++; # # Get the location and size for the DIMM; while ( $_ = ) { chomp; if (m/fru number/i) { @list=split/\./; $index=@list; $fru=$list[$index-1]; } elsif (m/size/i) { @list=split /\./,$_; $index=@list; $size=$list[$index-1]; $totsize+=$size; } elsif (m/physical location/i) { @list=split/:/,$_; $location=$list[1]; @list=split/-/,$location; $cec=$list[0]; if ($cec eq $prevcec) { $cecmb+=$size; } else { if ( $prevcec ne "" ) { print "CEC Total: $cectotal $cecmb MB\n"; }; $cectotal=0; $cecmb=$size; $prevcec=$cec; }; $cectotal++; print "$location\t$fru\t$size\n"; last; }; }; }; }; print "CEC Total: $cectotal DIMMs $cecmb MB\n"; print "\nSystem Total: $count DIMMs $totsize MB\n";