Branch Coverage

blib/lib/Monitoring/GLPlugin.pm
Criterion Covered Total %
branch 89 392 22.7


line true false branch
37 5 2 unless grep /BEGIN/, keys %Monitoring::GLPlugin::Commandline::
39 5 2 unless grep /BEGIN/, keys %Monitoring::GLPlugin::Item::
41 5 2 unless grep /BEGIN/, keys %Monitoring::GLPlugin::TableItem::
48 0 0 if ($self->opts->can('blacklist') and $self->opts->blacklist and -f $self->opts->blacklist)
284 6 174 if ($args{'help'} =~ /^--mode/)
311 0 3 if ($self->opts->mode =~ /^my-([^\-.]+)/) { }
0 3 elsif ($self->opts->mode eq 'encode') { }
0 3 elsif ($self->opts->mode eq 'decode') { }
0 3 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'};}))) { }
327 0 0 if (not -t STDIN) { }
334 0 0 if ($self->opts->name) { }
350 0 3 if ($self->opts->name and $self->opts->name =~ /(%22)|(%27)/)
359 0 3 unless $self->opts->mode eq $_->{'spec'}
362 0 3 if ($self->opts->multiline) { }
367 0 3 if ($self->opts->can('statefilesdir') and not $self->opts->statefilesdir)
368 0 0 if ($^O =~ /MSWin/) { }
0 0 elsif (exists $ENV{'OMD_ROOT'}) { }
369 0 0 if (defined $ENV{'TEMP'}) { }
0 0 elsif (defined $ENV{'TMP'}) { }
0 0 elsif (defined $ENV{'windir'}) { }
384 3 0 if $self->opts->can('statefilesdir')
386 0 3 if ($self->opts->can('warningx') and $self->opts->warningx)
392 0 3 if ($self->opts->can('criticalx') and $self->opts->criticalx)
398 3 0 if not $SIG{'ALRM'}
411 0 3 if ($^O =~ /MSWin/) { }
435 133 3 exists $Monitoring::GLPlugin::variables->{$key} ? :
440 0 134 $self->opts->tracefile ? :
443 0 134 -f $tracefile ? :
444 0 134 if ($self->get_variable('verbose') and $self->get_variable('verbose') > $self->get_variable('verbosity', 10))
450 0 134 if ($self->{'trace'})
453 0 0 if ($logfh->open($tracefile, 'a'))
464 0 0 if ($opt) { }
465 0 0 if ($self->opts->regexp) { }
466 0 0 if ($name =~ /$opt/i)
470 0 0 if (lc $opt eq lc $name)
499 0 0 if ($self->get_variable('version')) { }
0 0 elsif (exists $self->{'version'}) { }
506 0 0 $_ eq 'x' ? :
508 0 0 if (scalar @v1 > scalar @v2) { }
0 0 elsif (scalar @v2 > scalar @v1) { }
514 0 0 if ($v2[$pos] > $v1[$pos]) { }
0 0 elsif ($v2[$pos] < $v1[$pos]) { }
546 0 0 if exists $replace{$hex}
554 0 0 $indent ? :
557 0 0 if (exists $self->{'flat_indices'}) { }
563 0 0 if defined $self->{$_} and ref $self->{$_} ne 'ARRAY'
565 0 0 if ($self->{'info'})
569 0 0 if (defined $self->{$_} and ref $self->{$_} eq 'ARRAY') { }
0 0 elsif (defined $self->{$_} and ref($self->{$_}) =~ /^Classes::/) { }
572 0 0 if ref $obj ne 'HASH' or not exists $obj->{'flat_indices'}
574 0 0 if ($have_flat_indices) { }
583 0 0 if UNIVERSAL::can($obj, 'isa') and $obj->can('dump')
587 0 0 if UNIVERSAL::can($self->{$_}, 'isa') and $self->{$_}->can('dump')
602 0 0 ref $_ eq 'ARRAY' ? :
605 0 0 if (length $td > $column_length->{$column})
644 0 0 if (ref $td eq 'ARRAY')
663 0 0 if ($self->opts->mode =~ /^my-([^-.]+)/)
667 0 0 unless ($self->opts->get('with-mymodules-dyn-dir'))
685 0 0 if ($@)
693 0 0 if $self->can('compatibility_class')
695 0 0 if $self->can('compatibility_methods') and $self->isa($deprecated_class)
697 0 0 if ($self->isa('Monitoring::GLPlugin')) { }
699 0 0 if ($new_init == $original_init) { }
707 0 0 $loaderror ? :
719 0 0 if ($password and $password =~ m[^rfc3986://(.*)])
759 0 0 if (exists $bits->{$unit}) { }
802 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'};}))
803 0 0 defined $_->{'alias'} ? :
804 0 0 unless ($self->opts->mode =~ /^my-/)
810 0 3 if ($self->opts->environment)
818 0 0 if (not $ENV{$_} or $ENV{$_} ne $self->opts->environment->{$_})
825 0 3 if ($self->opts->runas)
833 0 0 if ($ENV{$survive_env} and not scalar grep({/^$survive_env=/;} keys %{$self->opts->environment;}))
837 0 0 if $self->opts->verbose >= 2
844 0 3 if ($needs_restart)
847 0 0 if $option eq 'runas'
849 0 0 if ($spec =~ /^(\w+)=(.*)/) { }
0 0 elsif ($spec eq $option) { }
850 0 0 if ($1 eq $option and $2 =~ /s%/) { }
0 0 elsif ($1 eq $option) { }
864 0 0 if ($self->opts->runas and $> == 0) { }
0 0 elsif ($self->opts->runas) { }
880 0 3 if ($self->opts->shell)
913 0 0 if (defined $self->opts->mitigation) { }
922 0 0 if (defined $self->opts->mitigation) { }
931 0 0 if (defined $self->opts->mitigation) { }
940 0 0 if (defined $self->opts->mitigation) { }
950 0 0 unless $self->is_blacklisted
952 0 0 if (exists $self->{'failed'})
953 0 0 if ($level == 3 and $self->{'failed'} == 0) { }
0 0 elsif ($level > $self->{'failed'}) { }
991 0 0 if $code =~ /^\d+$/
993 0 0 unless (exists $self->{'tmp_level'})
1006 0 0 unless exists $self->{'tmp_level'}
1008 0 0 if $self->{'tmp_level'}{'critical'}
1009 0 0 if $self->{'tmp_level'}{'warning'}
1010 0 0 if $self->{'tmp_level'}{'unknown'}
1030 0 0 unless ($self->opts->can('blacklist'))
1033 0 0 unless (exists $self->{'blacklisted'})
1036 0 0 if (exists $self->{'blacklisted'} and $self->{'blacklisted'})
1041 0 0 if ($self->opts->blacklist =~ /_/) { }
1043 0 0 if ($bl_item eq $self->internal_name)
1049 0 0 if ($bl_items =~ /^(\w+):([\:\d\-,]+)$/) { }
0 0 elsif ($bl_items =~ /^(\w+)$/) { }
1053 0 0 if ($bl_type . '_' . $bl_name eq $self->internal_name)
1058 0 0 if ($bl_items eq $self->internal_name)
1072 0 0 $self->is_blacklisted ? :
1088 0 0 unless $self->opts->extendedinfo
1127 31 0 unless $params{'freeze'}
1129 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) { }
1172 0 51 if ($mode eq 'lookback_freeze_chill') { }
37 14 elsif ($mode eq 'lookback') { }
1175 0 0 if (exists $last_values->{$_}) { }
1176 0 0 if (ref $self->{$_} eq 'ARRAY') { }
1185 0 0 if (ref $self->{$_} eq 'ARRAY') { }
1192 0 0 if (exists $last_values->{'frozen'}{$_})
1193 0 0 if (ref $self->{$_} eq 'ARRAY') { }
1205 34 3 if (exists $last_values->{'lookback_history'}{$_})
1211 32 10 if ($date >= $now - $self->opts->lookback) { }
1215 14 18 if (ref $last_values->{$_} eq 'ARRAY') { }
1230 37 0 if ($mode eq 'normal' or $mode eq 'lookback' or $mode eq 'lookback_freeze_chill')
1231 31 20 if (exists $self->{$_} and defined $self->{$_} and $self->{$_} =~ /^\d+\.*\d*$/) { }
20 0 elsif (ref $self->{$_} eq 'ARRAY') { }
1232 0 31 unless exists $last_values->{$_} and defined $last_values->{$_}
1233 15 16 if ($self->{$_} >= $last_values->{$_}) { }
0 16 elsif ($self->{$_} eq $last_values->{$_}) { }
1240 0 16 if ($mode =~ /lookback_freeze/) { }
15 1 elsif (exists $params{'lastarray'}) { }
1252 27 4 $self->{'delta_timestamp'} ? :
1254 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->{$_}) { }
1262 0 0 %{$newest_history_set;} ? :
1264 0 0 unless exists $last_values->{$_}
1271 0 0 %{$newest_history_set;} ? :
1283 0 0 unless exists $last_values->{$_} and defined $last_values->{$_}
1284 0 0 unless exists $self->{$_} and defined $self->{$_}
1293 0 51 if ($mode =~ /lookback_freeze/)
1294 0 0 if (exists $last_values->{'frozen'}{$_}) { }
1295 0 0 if (ref $last_values->{'frozen'}{$_} eq 'ARRAY') { }
1301 0 0 if (ref $last_values->{'cold'}{$_} eq 'ARRAY') { }
1309 0 51 if ($mode eq 'lookback_freeze_shockfrost')
1310 0 0 if (ref $empty_events->{'cold'}{$_} eq 'ARRAY') { }
1319 21 10 if ($mode eq 'lookback')
1322 16 21 if (ref $self->{$_} eq 'ARRAY') { }
1329 0 31 if ($mode eq 'lookback_freeze_defrost')
1339 0 31 if (not -d $self->statefilesdir) { }
0 31 elsif (not -w $self->statefilesdir) { }
1344 0 0 if ($@ or not -w $self->statefilesdir)
1357 72 3 $params{'name'} ? :
1369 0 150 if ($^O =~ /MSWin/)
1383 0 0 if (ref $validfunc ne 'CODE' and $validfunc eq 'percent') { }
0 0 elsif (ref $validfunc ne 'CODE' and $validfunc eq 'positive') { }
1386 0 0 unless defined $value
1387 0 0 unless $value =~ /^[-+]?([0-9]+(\.[0-9]+)?|\.[0-9]+)$/
1388 0 0 $value < 0 || $value > 100 ? :
1393 0 0 unless defined $value
1394 0 0 unless $value =~ /^[-+]?([0-9]+(\.[0-9]+)?|\.[0-9]+)$/
1395 0 0 $value < 0 ? :
1398 0 0 if (&$validfunc($self->{$key})) { }
1408 0 0 if ($laststate->{'exception'} <= 5)
1425 31 0 if (ref $params{'save'} eq 'HASH' and exists $params{'save'}{'timestamp'})
1429 31 0 if ($seekfh->open($tmpfile, 'w'))
1436 0 31 if (not rename($tmpfile, $statefile))
1445 26 5 if (-f $statefile) { }
1448 25 1 if exists $INC{$statefile}
1451 0 26 if ($@)
1467 0 0 if ($fh->open($self->{'pidfile'}, 'r')) { }
1470 0 0 if (not $pid) { }
1477 0 0 if ($! == 3) { }
1495 0 0 unless (-d dirname($self->{'pidfile'}))
1497 0 0 if (defined &File::Path::mkpath) { }
1504 0 0 if join '/', @dirs and not -d join('/', @dirs)
1511 0 0 if ($fh->open($self->{'pidfile'}, 'w')) { }
1522 0 0 if ($^O =~ /MSWin/) { }
1531 0 0 if ($^O =~ /MSWin/) { }
1532 0 0 if defined $ENV{'TEMP'}
1533 0 0 if defined $ENV{'TMP'}
1535 0 0 if defined $ENV{'windir'}
1545 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*$/) { }
1552 0 0 $sign eq '-' ? :
1637 4 7 if $AUTOLOAD =~ /DESTROY/
1638 0 7 if $self->opts->verbose >= 2
1640 0 7 if ($AUTOLOAD =~ /^(.*)::analyze_and_check_(.*)_subsystem$/) { }
0 7 elsif ($AUTOLOAD =~ /^(.*)::check_(.*)_subsystem$/) { }
0 7 elsif ($AUTOLOAD =~ /^.*::(status_code|check_messages|nagios_exit|html_string|perfdata_string|selected_perfdata|check_thresholds|get_thresholds|opts|pandora_string|strequal)$/) { }
7 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_(.*)$/) { }
1645 0 0 if (@params) { }
1660 0 0 if $self->opts->verbose >= 2