diff --git a/hardware/ups/standard/rfc1628/snmp/mode/inputlines.pm b/hardware/ups/standard/rfc1628/snmp/mode/inputlines.pm index 0a6d31623..cc25c5aa7 100644 --- a/hardware/ups/standard/rfc1628/snmp/mode/inputlines.pm +++ b/hardware/ups/standard/rfc1628/snmp/mode/inputlines.pm @@ -142,7 +142,7 @@ sub run { my @exits; foreach (keys %{$maps_counters}) { foreach my $name (keys %{$maps_counters->{$_}->{thresholds}}) { - if (defined($self->{counters_value}->{$instance}->{$_}) && $self->{counters_value}->{$instance}->{$_} != 0) { + if (defined($self->{counters_value}->{$instance}->{$_}) && $self->{counters_value}->{$instance}->{$_} ne '' && $self->{counters_value}->{$instance}->{$_} != 0) { push @exits, $self->{perfdata}->threshold_check(value => $self->{counters_value}->{$instance}->{$_} * $maps_counters->{$_}->{factor}, threshold => [ { label => $maps_counters->{$_}->{thresholds}->{$name}->{label}, 'exit_litteral' => $maps_counters->{$_}->{thresholds}->{$name}->{exit_value} }]); } } @@ -155,7 +155,7 @@ sub run { my $str_output = "Input Line '$instance_output' "; my $str_append = ''; foreach (keys %{$maps_counters}) { - next if (!defined($self->{counters_value}->{$instance}->{$_}) || $self->{counters_value}->{$instance}->{$_} == 0); + next if (!defined($self->{counters_value}->{$instance}->{$_}) || $self->{counters_value}->{$instance}->{$_} == 0 || $self->{counters_value}->{$instance}->{$_} eq ''); $str_output .= $str_append . sprintf($maps_counters->{$_}->{output_msg}, $self->{counters_value}->{$instance}->{$_} * $maps_counters->{$_}->{factor}); $str_append = ', '; diff --git a/hardware/ups/standard/rfc1628/snmp/mode/outputlines.pm b/hardware/ups/standard/rfc1628/snmp/mode/outputlines.pm index b4805867d..937ccfba3 100644 --- a/hardware/ups/standard/rfc1628/snmp/mode/outputlines.pm +++ b/hardware/ups/standard/rfc1628/snmp/mode/outputlines.pm @@ -182,7 +182,7 @@ sub run { my @exits; foreach (keys %{$maps_counters}) { foreach my $name (keys %{$maps_counters->{$_}->{thresholds}}) { - if (defined($self->{counters_value}->{$instance}->{$_}) && $self->{counters_value}->{$instance}->{$_} == $maps_counters->{$_}->{no_present}) { + if (defined($self->{counters_value}->{$instance}->{$_}) && $self->{counters_value}->{$instance}->{$_} ne '' && $self->{counters_value}->{$instance}->{$_} != $maps_counters->{$_}->{no_present}) { push @exits, $self->{perfdata}->threshold_check(value => $self->{counters_value}->{$instance}->{$_} * $maps_counters->{$_}->{factor}, threshold => [ { label => $maps_counters->{$_}->{thresholds}->{$name}->{label}, 'exit_litteral' => $maps_counters->{$_}->{thresholds}->{$name}->{exit_value} }]); } } @@ -195,7 +195,7 @@ sub run { my $str_output = "Output Line '$instance_output' "; my $str_append = ''; foreach (keys %{$maps_counters}) { - next if (!defined($self->{counters_value}->{$instance}->{$_}) || $self->{counters_value}->{$instance}->{$_} == $maps_counters->{$_}->{no_present}); + next if (!defined($self->{counters_value}->{$instance}->{$_}) || $self->{counters_value}->{$instance}->{$_} == $maps_counters->{$_}->{no_present} || $self->{counters_value}->{$instance}->{$_} eq ''); $str_output .= $str_append . sprintf($maps_counters->{$_}->{output_msg}, $self->{counters_value}->{$instance}->{$_} * $maps_counters->{$_}->{factor}); $str_append = ', ';