Branch Coverage

blib/lib/Monitoring/GLPlugin.pm
Criterion Covered Total %
branch 90 346 26.0


line true false branch
36 2 1 unless grep /BEGIN/, keys %Monitoring::GLPlugin::Commandline::
38 2 1 unless grep /BEGIN/, keys %Monitoring::GLPlugin::Item::
40 2 1 unless grep /BEGIN/, keys %Monitoring::GLPlugin::TableItem::
47 0 0 if ($self->opts->can('blacklist') and $self->opts->blacklist and -f $self->opts->blacklist)
257 3 72 if ($args{'help'} =~ /^--mode/)
284 0 1 if ($self->opts->mode =~ /^my-([^\-.]+)/) { }
0 1 elsif ($self->opts->mode eq 'encode') { }
0 1 elsif ($self->opts->mode eq 'decode') { }
0 1 elsif (not grep({$self->opts->mode eq $_;} map({$_->{'spec'};} @{$$Monitoring::GLPlugin::plugin{'modes'};})) || grep({$self->opts->mode eq $_;} map({defined $_->{'alias'} ? @{$_->{'alias'};} : ();} @{$$Monitoring::GLPlugin::plugin{'modes'};}))) { }
300 0 0 if (not -t STDIN) { }
307 0 0 if ($self->opts->name) { }
323 0 1 if ($self->opts->name and $self->opts->name =~ /(%22)|(%27)/)
332 0 1 unless $self->opts->mode eq $_->{'spec'}
335 0 1 if ($self->opts->multiline) { }
340 0 1 if ($self->opts->can('statefilesdir') and not $self->opts->statefilesdir)
341 0 0 if ($^O =~ /MSWin/) { }
0 0 elsif (exists $ENV{'OMD_ROOT'}) { }
342 0 0 if (defined $ENV{'TEMP'}) { }
0 0 elsif (defined $ENV{'TMP'}) { }
0 0 elsif (defined $ENV{'windir'}) { }
357 1 0 if $self->opts->can('statefilesdir')
359 0 1 if ($self->opts->can('warningx') and $self->opts->warningx)
365 0 1 if ($self->opts->can('criticalx') and $self->opts->criticalx)
371 1 0 if not $SIG{'ALRM'}
383 0 1 if ($^O =~ /MSWin/) { }
407 130 0 exists $Monitoring::GLPlugin::variables->{$key} ? :
413 0 130 -f $tracefile ? :
414 0 130 if ($self->get_variable('verbose') and $self->get_variable('verbose') > $self->get_variable('verbosity', 10))
420 0 130 if ($self->{'trace'})
423 0 0 if ($logfh->open($tracefile, 'a'))
434 0 0 if ($opt) { }
435 0 0 if ($self->opts->regexp) { }
436 0 0 if ($name =~ /$opt/i)
440 0 0 if (lc $opt eq lc $name)
469 0 0 if ($self->get_variable('version')) { }
0 0 elsif (exists $self->{'version'}) { }
476 0 0 $_ eq 'x' ? :
478 0 0 if (scalar @v1 > scalar @v2) { }
0 0 elsif (scalar @v2 > scalar @v1) { }
484 0 0 if ($v2[$pos] > $v1[$pos]) { }
0 0 elsif ($v2[$pos] < $v1[$pos]) { }
516 0 0 if exists $replace{$hex}
526 0 0 if (exists $self->{'flat_indices'}) { }
532 0 0 if defined $self->{$_} and ref $self->{$_} ne 'ARRAY'
534 0 0 if ($self->{'info'})
539 0 0 if (defined $self->{$_} and ref $self->{$_} eq 'ARRAY')
542 0 0 if ref $obj ne 'HASH' or not exists $obj->{'flat_indices'}
544 0 0 if ($have_flat_indices) { }
553 0 0 if UNIVERSAL::can($obj, 'isa') and $obj->can('dump')
569 0 0 ref $_ eq 'ARRAY' ? :
572 0 0 if (length $td > $column_length->{$column})
611 0 0 if (ref $td eq 'ARRAY')
630 0 0 if ($self->opts->mode =~ /^my-([^-.]+)/)
634 0 0 unless ($self->opts->get('with-mymodules-dyn-dir'))
651 0 0 if ($@)
659 0 0 if $self->can('compatibility_class')
661 0 0 if $self->can('compatibility_methods')
662 0 0 if ($self->isa('Monitoring::GLPlugin')) { }
664 0 0 if ($new_init == $original_init) { }
672 0 0 $loaderror ? :
684 0 0 if ($password and $password =~ m[^rfc3986://(.*)])
724 0 0 if (exists $bits->{$unit}) { }
765 0 2 if (not grep({$self->opts->mode eq $_;} map({$_->{'spec'};} @{$$Monitoring::GLPlugin::plugin{'modes'};})) || grep({$self->opts->mode eq $_;} map({defined $_->{'alias'} ? @{$_->{'alias'};} : ();} @{$$Monitoring::GLPlugin::plugin{'modes'};})))
767 0 0 if (not $self->opts->mode =~ /^my-/)
801 0 0 if (defined $self->opts->mitigation) { }
810 0 0 if (defined $self->opts->mitigation) { }
819 0 0 if (defined $self->opts->mitigation) { }
828 0 0 if (defined $self->opts->mitigation) { }
838 31 0 unless $self->is_blacklisted
840 0 31 if (exists $self->{'failed'})
841 0 0 if ($level == 3 and $self->{'failed'} == 0) { }
0 0 elsif ($level > $self->{'failed'}) { }
879 0 0 if $code =~ /^\d+$/
881 0 0 unless (exists $self->{'tmp_level'})
894 0 0 unless exists $self->{'tmp_level'}
896 0 0 if $self->{'tmp_level'}{'critical'}
897 0 0 if $self->{'tmp_level'}{'warning'}
898 0 0 if $self->{'tmp_level'}{'unknown'}
918 0 31 unless ($self->opts->can('blacklist'))
921 1 30 unless (exists $self->{'blacklisted'})
924 0 31 if (exists $self->{'blacklisted'} and $self->{'blacklisted'})
929 0 31 if ($self->opts->blacklist =~ /_/) { }
931 0 0 if ($bl_item eq $self->internal_name)
937 0 0 if ($bl_items =~ /^(\w+):([\:\d\-,]+)$/) { }
0 0 elsif ($bl_items =~ /^(\w+)$/) { }
941 0 0 if ($bl_type . '_' . $bl_name eq $self->internal_name)
946 0 0 if ($bl_items eq $self->internal_name)
960 0 0 $self->is_blacklisted ? :
976 0 0 unless $self->opts->extendedinfo
1015 31 0 unless $params{'freeze'}
1017 0 31 if ($self->opts->lookback and $self->opts->lookback == 99999 and $params{'freeze'} == 0) { }
0 31 elsif ($self->opts->lookback and $self->opts->lookback == 99999 and $params{'freeze'} == 1) { }
0 31 elsif ($self->opts->lookback and $self->opts->lookback == 99999 and $params{'freeze'} == 2) { }
21 10 elsif ($self->opts->lookback) { }
1060 0 51 if ($mode eq 'lookback_freeze_chill') { }
37 14 elsif ($mode eq 'lookback') { }
1063 0 0 if (exists $last_values->{$_}) { }
1064 0 0 if (ref $self->{$_} eq 'ARRAY') { }
1073 0 0 if (ref $self->{$_} eq 'ARRAY') { }
1080 0 0 if (exists $last_values->{'frozen'}{$_})
1081 0 0 if (ref $self->{$_} eq 'ARRAY') { }
1093 34 3 if (exists $last_values->{'lookback_history'}{$_})
1099 32 10 if ($date >= $now - $self->opts->lookback) { }
1102 14 18 if (ref $last_values->{$_} eq 'ARRAY') { }
1117 37 0 if ($mode eq 'normal' or $mode eq 'lookback' or $mode eq 'lookback_freeze_chill')
1118 31 20 if ($self->{$_} =~ /^\d+\.*\d*$/) { }
20 0 elsif (ref $self->{$_} eq 'ARRAY') { }
1119 0 31 unless exists $last_values->{$_}
1120 15 16 if ($self->{$_} >= $last_values->{$_}) { }
0 16 elsif ($self->{$_} eq $last_values->{$_}) { }
1127 0 16 if ($mode =~ /lookback_freeze/) { }
15 1 elsif (exists $params{'lastarray'}) { }
1139 27 4 $self->{'delta_timestamp'} ? :
1141 0 20 if (not exists $last_values->{$_} && defined $last_values->{$_} and exists $params{'lastarray'}) { }
0 20 elsif (not exists $last_values->{$_} && defined $last_values->{$_} || exists $params{'lastarray'}) { }
0 20 elsif (exists $last_values->{$_} and not defined $last_values->{$_}) { }
1149 0 0 %{$newest_history_set;} ? :
1151 0 0 unless exists $last_values->{$_}
1158 0 0 %{$newest_history_set;} ? :
1173 0 51 if ($mode =~ /lookback_freeze/)
1174 0 0 if (exists $last_values->{'frozen'}{$_}) { }
1175 0 0 if (ref $last_values->{'frozen'}{$_} eq 'ARRAY') { }
1181 0 0 if (ref $last_values->{'cold'}{$_} eq 'ARRAY') { }
1189 0 51 if ($mode eq 'lookback_freeze_shockfrost')
1190 0 0 if (ref $empty_events->{'cold'}{$_} eq 'ARRAY') { }
1199 21 10 if ($mode eq 'lookback')
1202 16 21 if (ref $self->{$_} eq 'ARRAY') { }
1209 0 31 if ($mode eq 'lookback_freeze_defrost')
1219 31 0 if (not -d $self->statefilesdir) { }
0 0 elsif (not -w $self->statefilesdir) { }
1224 31 0 if ($@ or not -w $self->statefilesdir)
1237 72 2 $params{'name'} ? :
1249 0 148 if ($^O =~ /MSWin/)
1263 0 0 if (ref $validfunc ne 'CODE' and $validfunc eq 'percent') { }
0 0 elsif (ref $validfunc ne 'CODE' and $validfunc eq 'positive') { }
1266 0 0 unless $value =~ /^[-+]?([0-9]+(\.[0-9]+)?|\.[0-9]+)$/
1267 0 0 $value < 0 || $value > 100 ? :
1272 0 0 unless $value =~ /^[-+]?([0-9]+(\.[0-9]+)?|\.[0-9]+)$/
1273 0 0 $value < 0 ? :
1276 0 0 if (&$validfunc($self->{$key})) { }
1286 0 0 if ($laststate->{'exception'} <= 5)
1303 31 0 if (ref $params{'save'} eq 'HASH' and exists $params{'save'}{'timestamp'})
1307 31 0 if ($seekfh->open($tmpfile, 'w'))
1314 0 31 if (not rename($tmpfile, $statefile))
1323 26 5 if (-f $statefile) { }
1326 25 1 if exists $INC{$statefile}
1329 0 26 if ($@)
1345 0 0 if ($fh->open($self->{'pidfile'}, 'r')) { }
1348 0 0 if (not $pid) { }
1355 0 0 if ($! == 3) { }
1373 0 0 unless (-d dirname($self->{'pidfile'}))
1375 0 0 if (defined &File::Path::mkpath) { }
1382 0 0 if join '/', @dirs and not -d join('/', @dirs)
1389 0 0 if ($fh->open($self->{'pidfile'}, 'w')) { }
1400 0 0 if ($^O =~ /MSWin/) { }
1409 0 0 if ($^O =~ /MSWin/) { }
1410 0 0 if defined $ENV{'TEMP'}
1411 0 0 if defined $ENV{'TMP'}
1413 0 0 if defined $ENV{'windir'}
1423 0 0 if ($n =~ /^\s*\d+\s*$/) { }
0 0 elsif ($n =~ /^\s*([-+]?)(\d*[\.,]*\d*)[eE]{1}([-+]?)(\d+)\s*$/) { }
0 0 elsif ($n =~ /^\s*([-+]?)(\d+)[\.,]*(\d*)\s*$/) { }
0 0 elsif ($n =~ /^\s*(.*?)\s*$/) { }
1430 0 0 $sign eq '-' ? :
1516 0 6 if $AUTOLOAD =~ /DESTROY/
1517 0 6 if $self->opts->verbose >= 2
1519 0 6 if ($AUTOLOAD =~ /^(.*)::analyze_and_check_(.*)_subsystem$/) { }
0 6 elsif ($AUTOLOAD =~ /^(.*)::check_(.*)_subsystem$/) { }
0 6 elsif ($AUTOLOAD =~ /^.*::(status_code|check_messages|nagios_exit|html_string|perfdata_string|selected_perfdata|check_thresholds|get_thresholds|opts)$/) { }
6 0 elsif ($AUTOLOAD =~ /^.*::(reduce_messages|reduce_messages_short|clear_messages|suppress_messages|add_html|add_perfdata|override_opt|create_opt|set_thresholds|force_thresholds)$/) { }
0 0 elsif ($AUTOLOAD =~ /^.*::mod_arg_(.*)$/) { }
1524 0 0 if (@params) { }
1539 0 0 if $self->opts->verbose >= 2