line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Inventory::Solaris::Drives; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
99667199
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
35
|
|
4
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
57
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
440
|
use FusionInventory::Agent::Tools; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
129
|
|
7
|
1
|
|
|
1
|
|
411
|
use FusionInventory::Agent::Tools::Unix; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
500
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub isEnabled { |
10
|
0
|
|
|
0
|
0
|
|
my (%params) = @_; |
11
|
0
|
0
|
|
|
|
|
return 0 if $params{no_category}->{drive}; |
12
|
0
|
|
|
|
|
|
return canRun('df'); |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub doInventory { |
16
|
0
|
|
|
0
|
0
|
|
my (%params) = @_; |
17
|
|
|
|
|
|
|
|
18
|
0
|
|
|
|
|
|
my $inventory = $params{inventory}; |
19
|
0
|
|
|
|
|
|
my $logger = $params{logger}; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# get filesystems list |
22
|
0
|
|
|
|
|
|
my $line = getFirstLine(logger => $logger, command => "df --version"); |
23
|
|
|
|
|
|
|
# df --help is on STDERR on some system, so $line may be undef |
24
|
0
|
0
|
0
|
|
|
|
my $command = $line && $line =~ /GNU/ ? "df -P -k" : "df -k"; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
my @filesystems = |
27
|
|
|
|
|
|
|
# exclude solaris 10 specific devices |
28
|
0
|
|
|
|
|
|
grep { $_->{VOLUMN} !~ /^\/(devices|platform)/ } |
29
|
|
|
|
|
|
|
# exclude cdrom mount |
30
|
0
|
|
|
|
|
|
grep { $_->{TYPE} !~ /cdrom/ } |
|
0
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# get all file systems |
32
|
|
|
|
|
|
|
getFilesystemsFromDf(logger => $logger, command => $command); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# get indexed list of filesystems types |
35
|
|
|
|
|
|
|
my %filesystems_types = |
36
|
0
|
|
|
|
|
|
map { /^(\S+) on \S+ type (\w+)/; $1 => $2 } |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
getAllLines(logger => $logger, command => '/usr/sbin/mount -v'); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# set filesystem type based on that information |
40
|
0
|
|
|
|
|
|
foreach my $filesystem (@filesystems) { |
41
|
0
|
0
|
|
|
|
|
if ($filesystem->{VOLUMN} eq 'swap') { |
42
|
0
|
|
|
|
|
|
$filesystem->{FILESYSTEM} = 'swap'; |
43
|
0
|
|
|
|
|
|
next; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
$filesystem->{FILESYSTEM} = $filesystems_types{$filesystem->{VOLUMN}}; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# add filesystems to the inventory |
50
|
0
|
|
|
|
|
|
foreach my $filesystem (@filesystems) { |
51
|
0
|
|
|
|
|
|
$inventory->addEntry( |
52
|
|
|
|
|
|
|
section => 'DRIVES', |
53
|
|
|
|
|
|
|
entry => $filesystem |
54
|
|
|
|
|
|
|
); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
1; |