File Coverage

blib/lib/System/Introspector/Probe/Nagios/CheckMkAgent.pm
Criterion Covered Total %
statement 18 19 94.7
branch 3 4 75.0
condition n/a
subroutine 4 5 80.0
pod 0 1 0.0
total 25 29 86.2


line stmt bran cond sub pod time code
1             package System::Introspector::Probe::Nagios::CheckMkAgent;
2 1     1   37001 use Moo;
  1         24552  
  1         7  
3              
4 1         376 use System::Introspector::Util qw(
5             lines_from_command
6             transform_exceptions
7 1     1   3445 );
  1         4  
8              
9             sub gather {
10 1     1 0 154 my ($self) = @_;
11             return transform_exceptions {
12 1     1   6 my @lines = $self->_get_check_mk_agent_output;
13 1         172 chomp @lines;
14 1         3 my %plugin;
15             my $current;
16 1         2158 for my $line (@lines) {
17 6 100       33 if ($line =~ m{^<<<(.+)>>>$}) {
18 3         12 $plugin{ $1 } = $current = [];
19 3         6 next;
20             }
21 3 50       8 next unless $current;
22 3         10 push @$current, $line;
23             }
24 1         8 return { nagios_check_mk_agent => \%plugin };
25 1         13 };
26             }
27              
28             sub _get_check_mk_agent_output {
29 0     0     return lines_from_command ['check_mk_agent'];
30             }
31              
32             1;
33              
34             __END__