line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Inventory::Linux::Uptime; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
35952775
|
use strict; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
51
|
|
4
|
1
|
|
|
1
|
|
9
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
67
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use English qw(-no_match_vars); |
|
1
|
|
|
|
|
43
|
|
|
1
|
|
|
|
|
23
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
1063
|
use FusionInventory::Agent::Tools; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
286
|
|
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; |