line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Inventory::Linux::Uptime; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
32687776
|
use strict; |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
64
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
80
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
9
|
use English qw(-no_match_vars); |
|
1
|
|
|
|
|
39
|
|
|
1
|
|
|
|
|
24
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
1208
|
use FusionInventory::Agent::Tools; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
277
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub isEnabled { |
11
|
0
|
|
|
0
|
0
|
|
return -r '/proc/uptime'; |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub doInventory { |
15
|
0
|
|
|
0
|
0
|
|
my (%params) = @_; |
16
|
|
|
|
|
|
|
|
17
|
0
|
|
|
|
|
|
my $inventory = $params{inventory}; |
18
|
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
|
my $uptime = _getUptime(file => '/proc/uptime'); |
20
|
0
|
|
|
|
|
|
$inventory->setOperatingSystem({ |
21
|
|
|
|
|
|
|
BOOT_TIME => $uptime |
22
|
|
|
|
|
|
|
}); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub _getUptime { |
26
|
0
|
|
|
0
|
|
|
my $uptime = getFirstMatch( |
27
|
|
|
|
|
|
|
pattern => qr/^(\S+)/, |
28
|
|
|
|
|
|
|
@_ |
29
|
|
|
|
|
|
|
); |
30
|
0
|
0
|
|
|
|
|
return unless $uptime; |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
return getFormatedLocalTime(int(time - $uptime)); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |