line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Inventory::AIX; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
24160724
|
use strict; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
76
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
63
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
3
|
use English qw(-no_match_vars); |
|
1
|
|
|
|
|
42
|
|
|
1
|
|
|
|
|
28
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
703
|
use List::Util qw(first); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
183
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
500
|
use FusionInventory::Agent::Tools; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
173
|
|
11
|
1
|
|
|
1
|
|
410
|
use FusionInventory::Agent::Tools::AIX; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
516
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $runAfter = ["FusionInventory::Agent::Task::Inventory::Generic"]; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub isEnabled { |
16
|
0
|
|
|
0
|
0
|
|
return $OSNAME eq 'aix'; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub doInventory { |
20
|
0
|
|
|
0
|
0
|
|
my (%params) = @_; |
21
|
|
|
|
|
|
|
|
22
|
0
|
|
|
|
|
|
my $inventory = $params{inventory}; |
23
|
0
|
|
|
|
|
|
my $logger = $params{logger}; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# Operating system informations |
26
|
0
|
|
|
|
|
|
my $kernelName = getFirstLine(command => 'uname -s'); |
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
my $version = getFirstLine(command => 'oslevel'); |
29
|
0
|
|
|
|
|
|
$version =~ s/(.0)*$//; |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
my $OSLevel = getFirstLine(command => 'oslevel -r'); |
32
|
0
|
|
|
|
|
|
my @OSLevelParts = split(/-/, $OSLevel); |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
my $Revision = getFirstLine(command => 'oslevel -s'); |
35
|
0
|
|
|
|
|
|
my @RevisionParts = split(/-/, $Revision); |
36
|
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
|
my $ssn; |
38
|
|
|
|
|
|
|
my $vmsystem; |
39
|
0
|
|
|
|
|
|
my $vmid; |
40
|
0
|
|
|
|
|
|
my $vmname; |
41
|
0
|
|
|
|
|
|
my $vmhostserial; |
42
|
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
|
my @infos = getLsvpdInfos(logger => $logger); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# Get the BIOS version from the System Microcode Image (MI) version, in |
46
|
|
|
|
|
|
|
# 'System Firmware' section of VPD, containing three space separated values: |
47
|
|
|
|
|
|
|
# - the microcode image the system currently runs |
48
|
|
|
|
|
|
|
# - the 'permanent' microcode image |
49
|
|
|
|
|
|
|
# - the 'temporary' microcode image |
50
|
|
|
|
|
|
|
# See http://www.systemscanaix.com/sample_reports/aix61/hardware_configuration.html |
51
|
0
|
|
|
|
|
|
my $bios_version; |
52
|
|
|
|
|
|
|
|
53
|
0
|
|
|
0
|
|
|
my $system = first { $_->{DS} eq 'System Firmware' } @infos; |
|
0
|
|
|
|
|
|
|
54
|
0
|
0
|
|
|
|
|
if ($system) { |
55
|
|
|
|
|
|
|
# we only return the currently booted firmware |
56
|
0
|
|
|
|
|
|
my @firmwares = split(' ', $system->{MI}); |
57
|
0
|
|
|
|
|
|
$bios_version = $firmwares[0]; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
0
|
|
|
0
|
|
|
my $vpd = first { $_->{DS} eq 'System VPD' } @infos; |
|
0
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
my $unameL = getFirstLine(command => 'uname -L'); |
63
|
|
|
|
|
|
|
# LPAR partition can access the serial number of the host computer |
64
|
|
|
|
|
|
|
# If we are such system, the serial number must be stored in the |
65
|
|
|
|
|
|
|
# VMHOSTSERIAL key. |
66
|
0
|
0
|
0
|
|
|
|
if ($unameL && $unameL =~ /^(\d+)\s+(\S+)/) { |
67
|
0
|
|
|
|
|
|
$vmsystem = "AIX_LPAR"; |
68
|
0
|
|
|
|
|
|
$vmid = $1; |
69
|
0
|
|
|
|
|
|
$vmname = $2; |
70
|
0
|
|
|
|
|
|
$vmhostserial = $vpd->{SE}; |
71
|
0
|
|
|
|
|
|
$ssn = "aixlpar-$vmhostserial-$vmid"; |
72
|
|
|
|
|
|
|
} else { |
73
|
0
|
|
|
|
|
|
$ssn = $vpd->{SE}; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
0
|
|
|
|
|
|
$inventory->setHardware({ |
77
|
|
|
|
|
|
|
OSNAME => "$kernelName $version", |
78
|
|
|
|
|
|
|
OSVERSION => $OSLevel, |
79
|
|
|
|
|
|
|
OSCOMMENTS => "Maintenance Level: $OSLevelParts[1]", |
80
|
|
|
|
|
|
|
VMID => $vmid, |
81
|
|
|
|
|
|
|
VMNAME => $vmname, |
82
|
|
|
|
|
|
|
VMSYSTEM => $vmsystem, |
83
|
|
|
|
|
|
|
VMHOSTSERIAL => $vmhostserial |
84
|
|
|
|
|
|
|
}); |
85
|
|
|
|
|
|
|
|
86
|
0
|
|
|
|
|
|
$inventory->setOperatingSystem({ |
87
|
|
|
|
|
|
|
NAME => 'AIX', |
88
|
|
|
|
|
|
|
FULL_NAME => "$kernelName $version", |
89
|
|
|
|
|
|
|
VERSION => $version, |
90
|
|
|
|
|
|
|
SERVICE_PACK => "$RevisionParts[2]-$RevisionParts[3]", |
91
|
|
|
|
|
|
|
}); |
92
|
|
|
|
|
|
|
|
93
|
0
|
|
|
|
|
|
$inventory->setBios({ |
94
|
|
|
|
|
|
|
BMANUFACTURER => 'IBM', |
95
|
|
|
|
|
|
|
SMANUFACTURER => 'IBM', |
96
|
|
|
|
|
|
|
SMODEL => $vpd->{TM}, |
97
|
|
|
|
|
|
|
SSN => $ssn, |
98
|
|
|
|
|
|
|
BVERSION => $bios_version, |
99
|
|
|
|
|
|
|
}); |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
1; |