line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# (c) Jan Gehring |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Rex::Helper::System; |
6
|
|
|
|
|
|
|
|
7
|
90
|
|
|
90
|
|
1218
|
use v5.12.5; |
|
90
|
|
|
|
|
317
|
|
8
|
90
|
|
|
90
|
|
644
|
use warnings; |
|
90
|
|
|
|
|
241
|
|
|
90
|
|
|
|
|
3968
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '1.14.2.3'; # TRIAL VERSION |
11
|
|
|
|
|
|
|
|
12
|
90
|
|
|
90
|
|
2246
|
use Rex::Helper::Hash; |
|
90
|
|
|
|
|
212
|
|
|
90
|
|
|
|
|
21603
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub info { |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
return ( |
17
|
13
|
|
|
13
|
0
|
35
|
eval { |
18
|
13
|
|
|
|
|
37
|
my %merge1 = (); |
19
|
13
|
|
|
|
|
204
|
my %merge2 = Rex::Hardware->get(qw/ All /); |
20
|
9
|
|
|
|
|
127
|
my %template_vars = ( %merge1, %merge2 ); |
21
|
|
|
|
|
|
|
|
22
|
9
|
|
|
|
|
147
|
for my $info_key (qw(Network Host Kernel Memory Swap)) { |
23
|
|
|
|
|
|
|
|
24
|
45
|
|
|
|
|
111
|
my $flatten_info = {}; |
25
|
|
|
|
|
|
|
|
26
|
45
|
100
|
|
|
|
260
|
if ( $info_key eq "Memory" ) { |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
27
|
9
|
|
|
|
|
82
|
hash_flatten( $merge2{$info_key}, $flatten_info, "_", "memory" ); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
elsif ( $info_key eq "Swap" ) { |
30
|
9
|
|
|
|
|
71
|
hash_flatten( $merge2{$info_key}, $flatten_info, "_", "swap" ); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
elsif ( $info_key eq "Network" ) { |
33
|
9
|
|
|
|
|
202
|
hash_flatten( $merge2{$info_key}->{"networkconfiguration"}, |
34
|
|
|
|
|
|
|
$flatten_info, "_" ); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
else { |
37
|
18
|
|
|
|
|
98
|
hash_flatten( $merge2{$info_key}, $flatten_info, "_" ); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
45
|
|
|
|
|
91
|
for my $key ( keys %{$flatten_info} ) { |
|
45
|
|
|
|
|
198
|
|
41
|
324
|
|
|
|
|
690
|
$template_vars{$key} = $flatten_info->{$key}; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
9
|
|
|
|
|
423
|
return %template_vars; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |