1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
package Ocsinventory::Agent::Backend::OS::AIX::Hardware;
use strict;
sub check { 1 }
# NOTE:
# Q: SSN can also use `uname -n`? What is the best?
# A: uname -n since it doesn't need root priv
sub run {
my $params = shift;
my $common = $params->{common};
# Using "type 0" section
my( $SystemSerial , $SystemModel, $SystemManufacturer, $BiosManufacturer,
$BiosVersion, $BiosDate);
#lsvpd
my @lsvpd = `lsvpd`;
# Remove * (star) at the beginning of lines
s/^\*// for (@lsvpd);
#Search Firmware Hard
my $flag=0;
my $fw;
for (@lsvpd){
if (/^DS Platform Firmware/) { $flag=1 };
if ( ($flag) && /^RM (.+)/) {$fw=$1;chomp($fw);$fw =~ s/(\s+)$//g;last};
}
$flag=0;
for (@lsvpd){
if (/^DS System Firmware/) { $flag=1 };
if ( ($flag) && /^RM (.+)/) {$BiosVersion=$1;chomp($BiosVersion);$BiosVersion =~ s/(\s+)$//g;last};
}
$flag=0;
for (@lsvpd){
if (/^DS System VPD/) { $flag=1 };
if ( ($flag) && /^TM (.+)/) {$SystemModel=$1;chomp($SystemModel);$SystemModel =~ s/(\s+)$//g;};
if ( ($flag) && /^SE (.+)/) {$SystemSerial=$1;chomp($SystemSerial);$SystemSerial =~ s/(\s+)$//g;};
if ( ($flag) && /^FC .+/) {$flag=0;last}
}
# Fetch the serial number like prtconf do
if (! $SystemSerial) {
$flag=0;
foreach (`lscfg -vpl sysplana00`) {
if ($flag) {
if (/\.+(\S*?)$/) {
$SystemSerial = $1;
}
last;
} else {
$flag = 1 if /\s+System\ VPD/;
}
}
}
$BiosManufacturer='IBM';
$SystemManufacturer='IBM';
$BiosVersion .= "(Firmware :".$fw.")";
# Writing data
$common->setBios ({
SMANUFACTURER => $SystemManufacturer,
SMODEL => $SystemModel,
SSN => $SystemSerial,
BMANUFACTURER => $BiosManufacturer,
BVERSION => $BiosVersion,
BDATE => $BiosDate,
});
}
1;
|