line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Inventory::AIX; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
31780149
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
64
|
|
4
|
1
|
|
|
1
|
|
11
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
94
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use English qw(-no_match_vars); |
|
1
|
|
|
|
|
68
|
|
|
1
|
|
|
|
|
24
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
970
|
use List::Util qw(first); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
233
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
651
|
use FusionInventory::Agent::Tools; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
189
|
|
11
|
1
|
|
|
1
|
|
595
|
use FusionInventory::Agent::Tools::AIX; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
608
|
|
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
|
|
|
|
|
|
$vmname = $2; |
69
|
0
|
|
|
|
|
|
$vmhostserial = $vpd->{SE}; |
70
|
0
|
|
|
|
|
|
$ssn = "aixlpar-$vmhostserial-$vmid"; |
71
|
|
|
|
|
|
|
} else { |
72
|
0
|
|
|
|
|
|
$ssn = $vpd->{SE}; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
0
|
|
|
|
|
|
$inventory->setHardware({ |
76
|
|
|
|
|
|
|
OSNAME => "$kernelName $version", |
77
|
|
|
|
|
|
|
OSVERSION => $OSLevel, |
78
|
|
|
|
|
|
|
OSCOMMENTS => "Maintenance Level: $OSLevelParts[1]", |
79
|
|
|
|
|
|
|
VMNAME => $vmname, |
80
|
|
|
|
|
|
|
VMSYSTEM => $vmsystem, |
81
|
|
|
|
|
|
|
VMHOSTSERIAL => $vmhostserial |
82
|
|
|
|
|
|
|
}); |
83
|
|
|
|
|
|
|
|
84
|
0
|
|
|
|
|
|
$inventory->setOperatingSystem({ |
85
|
|
|
|
|
|
|
NAME => 'AIX', |
86
|
|
|
|
|
|
|
FULL_NAME => "$kernelName $version", |
87
|
|
|
|
|
|
|
VERSION => $version, |
88
|
|
|
|
|
|
|
SERVICE_PACK => "$RevisionParts[2]-$RevisionParts[3]", |
89
|
|
|
|
|
|
|
}); |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
$inventory->setBios({ |
92
|
|
|
|
|
|
|
BMANUFACTURER => 'IBM', |
93
|
|
|
|
|
|
|
SMANUFACTURER => 'IBM', |
94
|
|
|
|
|
|
|
SMODEL => $vpd->{TM}, |
95
|
0
|
|
|
|
|
|
SSN => $ssn, |
96
|
|
|
|
|
|
|
BVERSION => $bios_version, |
97
|
|
|
|
|
|
|
}); |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
1; |