examples/ex5_comp_by_max_downtime_down

filter: Statementstmt 100% 25 / 25 Branchbran 50.0% 2 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 94.1% 32 / 34 CC 2 SCAR 2.9
CC
2
Cov
93%
from_data_handle
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
« examples/ex5_comp_by_hostname_up ↑ Summary examples/ex5_comp_by_max_downtime_up »
1 #!/usr/bin/perl
2  
3  
4 1 ▶use strict ;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use Nagios::Report ;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶my $x = Nagios::Report->new(q<dev_debug from_data_handle>, [q<24x7>])
Branch: 1 branch
BranchTrueFalseTotal
my $x = "Nagios::Report"->new("dev_debug from_data_handle", ["24x7"]) or die "Can't construct Nagios::Report object." 1 0 1
9 or die "Can't construct Nagios::Report object." ;
10  
11 $x->mkreport(
12 [ qw(
13 HOST_NAME
14 PERCENT_TOTAL_TIME_UP
15 TOTAL_TIME_DOWN
16 TOTAL_TIME_DOWN_HMS
17 TOTAL_TIME_UNREACHABLE
18 TOTAL_TIME_UNREACHABLE_HMS
19 )
20 ],
21  
22 68 ▶ sub { 1 },
Subroutine __ANON__: called CC=1 SCAR=0.0
23  
24 &comp( alpha => 0, ascend => 0, fields => [qw(TOTAL_TIME_DOWN TOTAL_TIME_UNREACHABLE)] ),
25  
26 69 ▶ sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
27 # sub { $_ = shift @_;
28 69 my $F = shift @_;
29 # my %F = @_;
30 69 my $d = $F->{TOTAL_TIME_DOWN} ;
31 69 my $u = $F->{TOTAL_TIME_UNREACHABLE} ;
32 69 $F->{TOTAL_TIME_DOWN_HMS} = t2hms($d) ;
33 69 $F->{TOTAL_TIME_UNREACHABLE_HMS}= t2hms($u) ;
34 # my $d = $F{TOTAL_TIME_DOWN} ;
35 # my $u = $F{TOTAL_TIME_UNREACHABLE} ;
36 # push @$_,
37 # &t2hms($d),
38 # &t2hms($u) ;
39 69 qw(TOTAL_TIME_DOWN_HMS TOTAL_TIME_UNREACHABLE_HMS)
40 }
41 1 ) ;
42  
43  
44  
45 1 $x->debug_dump ;
46 # $x->excel_dump();
47 # $x->excel_dump("/mnt/dest_smb/coms/Comms Data/foo.xls");
48  
49 {
50 1 my $data ;
51  
52 1 ▶ sub from_data_handle {
Subroutine from_data_handle: called CC=2 SCAR=7.0
53  
54 1 my $rep_period = shift @_ ;
55  
56 1 my @avail_rep = () ;
57  
58 1 local $/ = undef ;
59 1 ▶ $data = <DATA>
Branch: 1 branch
BranchTrueFalseTotal
unless $data 1 0 1
60 unless $data ;
61  
62 1 my ($r) = $data =~ /^# $rep_period\n(.*?)^END_OF_FILE_MARKER/sm ;
63
64 1 @avail_rep = split /\n/, $r ;
65  
66 1 @avail_rep ;
67  
68 }
69 }
70  
71 1 __DATA__
« examples/ex5_comp_by_hostname_up ↑ Summary examples/ex5_comp_by_max_downtime_up »