| 1 | package Nagios::Plugin::CheckHost::Result::Ping; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use base "Nagios::Plugin::CheckHost::Result"; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 11 | ▶ | sub calc_rtt { | ||||||||||||||||||||||||||
|
Subroutine
calc_rtt: called CC=7 SCAR=19.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 9 | 11 | my ($self, $node) = @_; | |||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 11 | my $result = $self->{results}->{$node}; | |||||||||||||||||||||||||||
| 12 | 11 | ▶ | return unless $result; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 13 | 11 | $result = $result->[0]; | |||||||||||||||||||||||||||
| 14 | 11 | ▶ | return unless $result and $result->[0]; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$result and $result->[0]
MC/DC0%0/2
$result and $result->[0]
$result
$result->[0]
Truth table33%1/3
A and B
A= $resultB= $result->[0]
| |||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 11 | my $avg = 0; | |||||||||||||||||||||||||||
| 17 | 11 | my $total = 0; | |||||||||||||||||||||||||||
| 18 | 11 | foreach my $check (@$result) { | |||||||||||||||||||||||||||
| 19 | 44 | ▶ | if ($check->[0] eq "OK") { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 20 | 29 | $avg += $check->[1]; | |||||||||||||||||||||||||||
| 21 | 29 | $total += 1; | |||||||||||||||||||||||||||
| 22 | } | ||||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||
| 24 | 11 | ▶ | return unless $total; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 25 | 8 | $avg/$total; | |||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 20 | ▶ | sub calc_loss { | ||||||||||||||||||||||||||
|
Subroutine
calc_loss: called CC=6 SCAR=18.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 29 | 20 | my ($self, $node) = @_; | |||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 20 | my $result = $self->{results}->{$node}; | |||||||||||||||||||||||||||
| 32 | 20 | ▶ | return 1 unless $result; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 33 | 20 | $result = $result->[0]; | |||||||||||||||||||||||||||
| 34 | 20 | ▶ | return 1 unless $result and $result->[0]; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$result and $result->[0]
MC/DC0%0/2
$result and $result->[0]
$result
$result->[0]
Truth table33%1/3
A and B
A= $resultB= $result->[0]
| |||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | 20 | my ($success, $fail) = (0, 0); | |||||||||||||||||||||||||||
| 37 | 20 | foreach my $check (@$result) { | |||||||||||||||||||||||||||
| 38 | 80 | ▶ | if (uc $check->[0] eq "OK") { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 39 | 50 | $success++; | |||||||||||||||||||||||||||
| 40 | } else { | ||||||||||||||||||||||||||||
| 41 | 30 | $fail++; | |||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | 20 | $fail/($fail+$success); | |||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | 1 | 1; | |||||||||||||||||||||||||||