line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package System::Introspector::Probe::Host; |
2
|
1
|
|
|
1
|
|
37696
|
use Moo; |
|
1
|
|
|
|
|
29845
|
|
|
1
|
|
|
|
|
6
|
|
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
|
|
465
|
use System::Introspector::Util qw( |
5
|
|
|
|
|
|
|
handle_from_command |
6
|
|
|
|
|
|
|
output_from_command |
7
|
|
|
|
|
|
|
output_from_file |
8
|
|
|
|
|
|
|
transform_exceptions |
9
|
1
|
|
|
1
|
|
2607
|
); |
|
1
|
|
|
|
|
4
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has hostname_file => (is => 'ro', default => sub {'/etc/hostname' }); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub gather { |
14
|
1
|
|
|
1
|
0
|
1507
|
my ($self) = @_; |
15
|
|
|
|
|
|
|
return transform_exceptions { |
16
|
|
|
|
|
|
|
return { |
17
|
1
|
|
|
1
|
|
6
|
hostname => $self->_gather_hostname, |
18
|
|
|
|
|
|
|
uname => $self->_gather_uname_info, |
19
|
|
|
|
|
|
|
}; |
20
|
1
|
|
|
|
|
10
|
}; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
my @UnameFields = qw( |
24
|
|
|
|
|
|
|
kernel_name |
25
|
|
|
|
|
|
|
kernel_release |
26
|
|
|
|
|
|
|
kernel_version |
27
|
|
|
|
|
|
|
nodename |
28
|
|
|
|
|
|
|
machine |
29
|
|
|
|
|
|
|
processor |
30
|
|
|
|
|
|
|
hardware_platform |
31
|
|
|
|
|
|
|
operating_system |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub _gather_uname_info { |
35
|
1
|
|
|
1
|
|
2
|
my ($self) = @_; |
36
|
1
|
|
|
|
|
2
|
my %uname; |
37
|
1
|
|
|
|
|
3
|
for my $field (@UnameFields) { |
38
|
8
|
|
|
|
|
81
|
(my $option = $field) =~ s{_}{-}g; |
39
|
8
|
|
|
|
|
94
|
my $value = output_from_command [uname => "--$option"]; |
40
|
8
|
|
|
|
|
57
|
chomp $value; |
41
|
8
|
|
|
|
|
83
|
$uname{ $field } = $value; |
42
|
|
|
|
|
|
|
} |
43
|
1
|
|
|
|
|
31
|
return \%uname; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub _gather_hostname { |
47
|
1
|
|
|
1
|
|
2
|
my ($self) = @_; |
48
|
1
|
|
|
|
|
10
|
my $hostname = output_from_file $self->hostname_file; |
49
|
1
|
|
|
|
|
4
|
chomp $hostname; |
50
|
1
|
|
|
|
|
23
|
$hostname =~ s{(?:^\s+|\s+$)}{}g; |
51
|
1
|
|
|
|
|
7
|
return $hostname; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
1; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
__END__ |