lib/Monitoring/Reporter/Backend.pm

filter: Statementstmt 34.6% 17 / 49 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 30.7% 4 / 13 Podpod 100% 8 / 8 totaltotal 35.8% 29 / 81 CC 5 SCAR 15.0
CC
5
Cov
30%
history
12.0
fetch_n_store
6.0
unattended_alarms
6.0
CRAP 4.5
« lib/Monitoring/Reporter/Backend/NagiosLivestatus.pm ↑ Summary lib/Monitoring/Reporter/Web/Plugin/List.pm »
1 package Monitoring::Reporter::Backend;
2 {
3 1 $Monitoring::Reporter::Backend::VERSION = '0.01';
4 }
5 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 $Monitoring::Reporter::Backend::AUTHORITY = 'cpan:TEX';
7 }
8 # ABSTRACT: Monitoring dashboard backend
9  
10 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 1 ▶use Cache::MemoryCache;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 1 has 'cache' => (
16 'is' => 'rw',
17 'isa' => 'Cache::Cache',
18 'lazy' => 1,
19 'builder' => '_init_cache',
20 );
21  
22 1 has 'name' => (
23 'is' => 'ro',
24 'isa' => 'Str',
25 'required' => 1,
26 );
27  
28 1 with qw(Config::Yak::RequiredConfig Log::Tree::RequiredLogger);
29  
30 0 ▶sub _init_cache {
Subroutine _init_cache: not called CC=1 SCAR=6.9
31 0 my $self = shift;
32  
33 0 my $Cache = Cache::MemoryCache::->new({
34 'namespace' => 'MonitoringReporter',
35 'default_expires_in' => 600,
36 });
37  
38 0 return $Cache;
39 }
40  
41 0 ▶sub fetch_n_store {
Subroutine fetch_n_store: not called CC=2 SCAR=17.9
Pod documented
42 0 my $self = shift;
43 0 my $query = shift;
44 0 my $timeout = shift;
45 0 my @args = @_;
46  
47 0 my $key = $query.join(',',@args);
48  
49 0 my $result = $self->cache()->get($key);
50  
51 0 ▶ if( ! defined($result) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $result) 0 0 0
52 0 $result = $self->fetch($query,@args);
53 0 $self->cache()->set($key,$result,$timeout);
54 }
55  
56 0 return $result;
57 }
58  
59 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
Pod documented
60 0 my $self = shift;
61 0 my $query = shift;
62 0 my @args = @_;
63  
64 0 die('Not implemented!');
65 }
66  
67 0 ▶sub triggers {
Subroutine triggers: not called CC=1 SCAR=6.9
Pod documented
68 0 my $self = shift;
69  
70 0 die('Not implemented');
71 }
72  
73 0 ▶sub disabled_actions {
Subroutine disabled_actions: not called CC=1 SCAR=6.9
Pod documented
74 0 my $self = shift;
75  
76 0 die('Not implemented');
77 }
78  
79 0 ▶sub enable_actions {
Subroutine enable_actions: not called CC=1 SCAR=6.9
Pod documented
80 0 my $self = shift;
81
82 0 die('Not implemented');
83 }
84  
85 0 ▶sub unsupported_items {
Subroutine unsupported_items: not called CC=1 SCAR=6.9
Pod documented
86 0 my $self = shift;
87  
88 0 die('Not implemented');
89 }
90  
91 0 ▶sub unattended_alarms {
Subroutine unattended_alarms: not called CC=2 SCAR=17.9
Pod documented
92 0 my $self = shift;
93 0 ▶ my $time = shift || 3600;
Condition0%0/2
shift() || 3600
l!l
00
MC/DC0%0/1
shift() || 3600
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
94
95 0 die('Not implemented');
96 }
97  
98 0 ▶sub history {
Subroutine history: not called CC=3 SCAR=24.8
Pod documented
99 0 my $self = shift;
100 0 ▶ my $max_age = shift // 30;
Condition0%0/2
shift() // 30
l!l
00
MC/DC0%0/1
shift() // 30
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
101 0 ▶ my $max_num = shift // 100;
Condition0%0/2
shift() // 100
l!l
00
MC/DC0%0/1
shift() // 100
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
102  
103 0 die('Not implemented');
104 }
105  
106 1 __PACKAGE__->meta->make_immutable;
107  
108 1 1; # End of Monitoring::Reporter::Backend
109  
110 __END__
« lib/Monitoring/Reporter/Backend/NagiosLivestatus.pm ↑ Summary lib/Monitoring/Reporter/Web/Plugin/List.pm »