Branch Coverage

blib/lib/Monitoring/GLPlugin.pm
Criterion Covered Total %
branch 86 376 22.8


line true false branch
37 2 1 unless grep /BEGIN/, keys %Monitoring::GLPlugin::Commandline::
39 2 1 unless grep /BEGIN/, keys %Monitoring::GLPlugin::Item::
41 2 1 unless grep /BEGIN/, keys %Monitoring::GLPlugin::TableItem::
48 0 0 if ($self->opts->can('blacklist') and $self->opts->blacklist and -f $self->opts->blacklist)
277 3 81 if ($args{'help'} =~ /^--mode/)
304 0 2 if ($self->opts->mode =~ /^my-([^\-.]+)/) { }
0 2 elsif ($self->opts->mode eq 'encode') { }
0 2 elsif ($self->opts->mode eq 'decode') { }
0 2 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'};}))) { }
320 0 0 if (not -t STDIN) { }
327 0 0 if ($self->opts->name) { }
343 0 2 if ($self->opts->name and $self->opts->name =~ /(%22)|(%27)/)
352 0 2 unless $self->opts->mode eq $_->{'spec'}
355 0 2 if ($self->opts->multiline) { }
360 0 2 if ($self->opts->can('statefilesdir') and not $self->opts->statefilesdir)
361 0 0 if ($^O =~ /MSWin/) { }
0 0 elsif (exists $ENV{'OMD_ROOT'}) { }
362 0 0 if (defined $ENV{'TEMP'}) { }
0 0 elsif (defined $ENV{'TMP'}) { }
0 0 elsif (defined $ENV{'windir'}) { }
377 2 0 if $self->opts->can('statefilesdir')
379 0 2 if ($self->opts->can('warningx') and $self->opts->warningx)
385 0 2 if ($self->opts->can('criticalx') and $self->opts->criticalx)
391 2 0 if not $SIG{'ALRM'}
403 0 2 if ($^O =~ /MSWin/) { }
427 130 0 exists $Monitoring::GLPlugin::variables->{$key} ? :
433 0 130 -f $tracefile ? :
434 0 130 if ($self->get_variable('verbose') and $self->get_variable('verbose') > $self->get_variable('verbosity', 10))
440 0 130 if ($self->{'trace'})
443 0 0 if ($logfh->open($tracefile, 'a'))
454 0 0 if ($opt) { }
455 0 0 if ($self->opts->regexp) { }
456 0 0 if ($name =~ /$opt/i)
460 0 0 if (lc $opt eq lc $name)
489 0 0 if ($self->get_variable('version')) { }
0 0 elsif (exists $self->{'version'}) { }
496 0 0 $_ eq 'x' ? :
498 0 0 if (scalar @v1 > scalar @v2) { }
0 0 elsif (scalar @v2 > scalar @v1) { }
504 0 0 if ($v2[$pos] > $v1[$pos]) { }
0 0 elsif ($v2[$pos] < $v1[$pos]) { }
536 0 0 if exists $replace{$hex}
546 0 0 if (exists $self->{'flat_indices'}) { }
552 0 0 if defined $self->{$_} and ref $self->{$_} ne 'ARRAY'
554 0 0 if ($self->{'info'})
559 0 0 if (defined $self->{$_} and ref $self->{$_} eq 'ARRAY')
562 0 0 if ref $obj ne 'HASH' or not exists $obj->{'flat_indices'}
564 0 0 if ($have_flat_indices) { }
573 0 0 if UNIVERSAL::can($obj, 'isa') and $obj->can('dump')
589 0 0 ref $_ eq 'ARRAY' ? :
592 0 0 if (length $td > $column_length->{$column})
631 0 0 if (ref $td eq 'ARRAY')
650 0 0 if ($self->opts->mode =~ /^my-([^-.]+)/)
654 0 0 unless ($self->opts->get('with-mymodules-dyn-dir'))
672 0 0 if ($@)
680 0 0 if $self->can('compatibility_class')
682 0 0 if $self->can('compatibility_methods') and $self->isa($deprecated_class)
684 0 0 if ($self->isa('Monitoring::GLPlugin')) { }
686 0 0 if ($new_init == $original_init) { }
694 0 0 $loaderror ? :
706 0 0 if ($password and $password =~ m[^rfc3986://(.*)])
746 0 0 if (exists $bits->{$unit}) { }
789 0 0 unless (grep {$self->opts->mode eq $_;} map({$_->{'spec'};} @{$$Monitoring::GLPlugin::plugin{'modes'};}) or grep {$self->opts->mode eq $_;} map({defined $_->{'alias'} ? @{$_->{'alias'};} : ();} @{$$Monitoring::GLPlugin::plugin{'modes'};}))
790 0 0 defined $_->{'alias'} ? :
791 0 0 unless ($self->opts->mode =~ /^my-/)
797 0 2 if ($self->opts->environment)
805 0 0 if (not $ENV{$_} or $ENV{$_} ne $self->opts->environment->{$_})
812 0 2 if ($self->opts->runas)
820 0 0 if ($ENV{$survive_env} and not scalar grep({/^$survive_env=/;} keys %{$self->opts->environment;}))
824 0 0 if $self->opts->verbose >= 2
831 0 2 if ($needs_restart)
834 0 0 if $option eq 'runas'
836 0 0 if ($spec =~ /^(\w+)=(.*)/) { }
0 0 elsif ($spec eq $option) { }
837 0 0 if ($1 eq $option and $2 =~ /s%/) { }
0 0 elsif ($1 eq $option) { }
851 0 0 if ($self->opts->runas and $> == 0) { }
0 0 elsif ($self->opts->runas) { }
867 0 2 if ($self->opts->shell)
900 0 0 if (defined $self->opts->mitigation) { }
909 0 0 if (defined $self->opts->mitigation) { }
918 0 0 if (defined $self->opts->mitigation) { }
927 0 0 if (defined $self->opts->mitigation) { }
937 0 0 unless $self->is_blacklisted
939 0 0 if (exists $self->{'failed'})
940 0 0 if ($level == 3 and $self->{'failed'} == 0) { }
0 0 elsif ($level > $self->{'failed'}) { }
978 0 0 if $code =~ /^\d+$/
980 0 0 unless (exists $self->{'tmp_level'})
993 0 0 unless exists $self->{'tmp_level'}
995 0 0 if $self->{'tmp_level'}{'critical'}
996 0 0 if $self->{'tmp_level'}{'warning'}
997 0 0 if $self->{'tmp_level'}{'unknown'}
1017 0 0 unless ($self->opts->can('blacklist'))
1020 0 0 unless (exists $self->{'blacklisted'})
1023 0 0 if (exists $self->{'blacklisted'} and $self->{'blacklisted'})
1028 0 0 if ($self->opts->blacklist =~ /_/) { }
1030 0 0 if ($bl_item eq $self->internal_name)
1036 0 0 if ($bl_items =~ /^(\w+):([\:\d\-,]+)$/) { }
0 0 elsif ($bl_items =~ /^(\w+)$/) { }
1040 0 0 if ($bl_type . '_' . $bl_name eq $self->internal_name)
1045 0 0 if ($bl_items eq $self->internal_name)
1059 0 0 $self->is_blacklisted ? :
1075 0 0 unless $self->opts->extendedinfo
1114 31 0 unless $params{'freeze'}
1116 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) { }
1159 0 51 if ($mode eq 'lookback_freeze_chill') { }
37 14 elsif ($mode eq 'lookback') { }
1162 0 0 if (exists $last_values->{$_}) { }
1163 0 0 if (ref $self->{$_} eq 'ARRAY') { }
1172 0 0 if (ref $self->{$_} eq 'ARRAY') { }
1179 0 0 if (exists $last_values->{'frozen'}{$_})
1180 0 0 if (ref $self->{$_} eq 'ARRAY') { }
1192 34 3 if (exists $last_values->{'lookback_history'}{$_})
1198 32 10 if ($date >= $now - $self->opts->lookback) { }
1201 14 18 if (ref $last_values->{$_} eq 'ARRAY') { }
1216 37 0 if ($mode eq 'normal' or $mode eq 'lookback' or $mode eq 'lookback_freeze_chill')
1217 31 20 if ($self->{$_} =~ /^\d+\.*\d*$/) { }
20 0 elsif (ref $self->{$_} eq 'ARRAY') { }
1218 0 31 unless exists $last_values->{$_}
1219 15 16 if ($self->{$_} >= $last_values->{$_}) { }
0 16 elsif ($self->{$_} eq $last_values->{$_}) { }
1226 0 16 if ($mode =~ /lookback_freeze/) { }
15 1 elsif (exists $params{'lastarray'}) { }
1238 27 4 $self->{'delta_timestamp'} ? :
1240 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->{$_}) { }
1248 0 0 %{$newest_history_set;} ? :
1250 0 0 unless exists $last_values->{$_}
1257 0 0 %{$newest_history_set;} ? :
1272 0 51 if ($mode =~ /lookback_freeze/)
1273 0 0 if (exists $last_values->{'frozen'}{$_}) { }
1274 0 0 if (ref $last_values->{'frozen'}{$_} eq 'ARRAY') { }
1280 0 0 if (ref $last_values->{'cold'}{$_} eq 'ARRAY') { }
1288 0 51 if ($mode eq 'lookback_freeze_shockfrost')
1289 0 0 if (ref $empty_events->{'cold'}{$_} eq 'ARRAY') { }
1298 21 10 if ($mode eq 'lookback')
1301 16 21 if (ref $self->{$_} eq 'ARRAY') { }
1308 0 31 if ($mode eq 'lookback_freeze_defrost')
1318 0 31 if (not -d $self->statefilesdir) { }
0 31 elsif (not -w $self->statefilesdir) { }
1323 0 0 if ($@ or not -w $self->statefilesdir)
1336 72 2 $params{'name'} ? :
1348 0 148 if ($^O =~ /MSWin/)
1362 0 0 if (ref $validfunc ne 'CODE' and $validfunc eq 'percent') { }
0 0 elsif (ref $validfunc ne 'CODE' and $validfunc eq 'positive') { }
1365 0 0 unless $value =~ /^[-+]?([0-9]+(\.[0-9]+)?|\.[0-9]+)$/
1366 0 0 $value < 0 || $value > 100 ? :
1371 0 0 unless $value =~ /^[-+]?([0-9]+(\.[0-9]+)?|\.[0-9]+)$/
1372 0 0 $value < 0 ? :
1375 0 0 if (&$validfunc($self->{$key})) { }
1385 0 0 if ($laststate->{'exception'} <= 5)
1402 31 0 if (ref $params{'save'} eq 'HASH' and exists $params{'save'}{'timestamp'})
1406 31 0 if ($seekfh->open($tmpfile, 'w'))
1413 0 31 if (not rename($tmpfile, $statefile))
1422 26 5 if (-f $statefile) { }
1425 25 1 if exists $INC{$statefile}
1428 0 26 if ($@)
1444 0 0 if ($fh->open($self->{'pidfile'}, 'r')) { }
1447 0 0 if (not $pid) { }
1454 0 0 if ($! == 3) { }
1472 0 0 unless (-d dirname($self->{'pidfile'}))
1474 0 0 if (defined &File::Path::mkpath) { }
1481 0 0 if join '/', @dirs and not -d join('/', @dirs)
1488 0 0 if ($fh->open($self->{'pidfile'}, 'w')) { }
1499 0 0 if ($^O =~ /MSWin/) { }
1508 0 0 if ($^O =~ /MSWin/) { }
1509 0 0 if defined $ENV{'TEMP'}
1510 0 0 if defined $ENV{'TMP'}
1512 0 0 if defined $ENV{'windir'}
1522 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*$/) { }
1529 0 0 $sign eq '-' ? :
1615 0 6 if $AUTOLOAD =~ /DESTROY/
1616 0 6 if $self->opts->verbose >= 2
1618 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|pandora_string)$/) { }
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|add_pandora)$/) { }
0 0 elsif ($AUTOLOAD =~ /^.*::mod_arg_(.*)$/) { }
1623 0 0 if (@params) { }
1638 0 0 if $self->opts->verbose >= 2