line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Nagios::Plugin::CheckHost::Result; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
1
|
|
|
2
|
|
|
|
|
41
|
|
4
|
2
|
|
|
2
|
|
5
|
use warnings; |
|
2
|
|
|
|
|
1
|
|
|
2
|
|
|
|
|
469
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub new { |
7
|
8
|
|
|
8
|
0
|
11563
|
my ($class, %args) = @_; |
8
|
|
|
|
|
|
|
|
9
|
8
|
50
|
|
|
|
24
|
my $nodes = delete $args{nodes} or die "Missed nodes information"; |
10
|
8
|
|
|
|
|
10
|
my %nodes = map {$_->identifier => $_} @$nodes; |
|
24
|
|
|
|
|
41
|
|
11
|
8
|
|
|
|
|
53
|
bless {%args, nodes => \%nodes, results => {}}, $class; |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub store_result { |
15
|
8
|
|
|
8
|
0
|
10
|
my ($self, $results) = @_; |
16
|
8
|
|
|
|
|
27
|
foreach my $node (keys %$results) { |
17
|
24
|
50
|
|
|
|
45
|
my $node_c = $self->{nodes}{$node} or next; |
18
|
|
|
|
|
|
|
|
19
|
24
|
|
|
|
|
18
|
my $r = $results->{$node}; |
20
|
|
|
|
|
|
|
|
21
|
24
|
50
|
|
|
|
31
|
next unless defined $r; |
22
|
24
|
100
|
|
|
|
29
|
if (defined $r->[0]) { |
23
|
22
|
|
|
|
|
50
|
$self->{results}{$node_c} = $r; |
24
|
|
|
|
|
|
|
} else { |
25
|
2
|
|
|
|
|
5
|
delete $self->{nodes}{$node}; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub unfinished_nodes { |
31
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
32
|
0
|
|
|
|
|
0
|
my @nodes; |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
0
|
foreach my $node (values %{$self->{nodes}}) { |
|
0
|
|
|
|
|
0
|
|
35
|
0
|
0
|
|
|
|
0
|
push @nodes, $node unless exists $self->{results}{$node}; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
0
|
@nodes; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub remove_unfinished_nodes { |
42
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
0
|
foreach my $node ($self->unfinished_nodes) { |
45
|
0
|
|
|
|
|
0
|
delete $self->{nodes}{$node->identifier}; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub nodes { |
51
|
8
|
|
|
8
|
0
|
8
|
values %{$_[0]->{nodes}}; |
|
8
|
|
|
|
|
28
|
|
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
1; |