+ fix cisco environment voltage threshold

This commit is contained in:
garnier-quentin 2015-12-01 13:18:21 +01:00
parent a5f1a045f9
commit 49e99dd405

View File

@ -77,8 +77,8 @@ sub check {
my ($exit2, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'voltage', instance => $instance, value => $result->{ciscoEnvMonVoltageStatusValue}); my ($exit2, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'voltage', instance => $instance, value => $result->{ciscoEnvMonVoltageStatusValue});
if ($checked == 0) { if ($checked == 0) {
my $warn_th = undef; my $warn_th = undef;
my $crit_th = (defined($result->{ciscoEnvMonVoltageThresholdLow}) ? sprintf("%.3f", $result->{ciscoEnvMonVoltageThresholdLow}) : 0) . ':' . my $crit_th = ((defined($result->{ciscoEnvMonVoltageThresholdLow}) && $result->{ciscoEnvMonVoltageThresholdLow} =~ /\d/) ? sprintf("%.3f", $result->{ciscoEnvMonVoltageThresholdLow} / 1000) : 0) . ':' .
(defined($result->{ciscoEnvMonVoltageThresholdHigh}) ? sprintf("%.3f", $result->{ciscoEnvMonVoltageThresholdHigh}) : ''); ((defined($result->{ciscoEnvMonVoltageThresholdHigh}) && $result->{ciscoEnvMonVoltageThresholdHigh} =~ /\d/) ? sprintf("%.3f", $result->{ciscoEnvMonVoltageThresholdHigh} / 1000) : '');
$self->{perfdata}->threshold_validate(label => 'warning-voltage-instance-' . $instance, value => $warn_th); $self->{perfdata}->threshold_validate(label => 'warning-voltage-instance-' . $instance, value => $warn_th);
$self->{perfdata}->threshold_validate(label => 'critical-voltage-instance-' . $instance, value => $crit_th); $self->{perfdata}->threshold_validate(label => 'critical-voltage-instance-' . $instance, value => $crit_th);
$warn = $self->{perfdata}->get_perfdata_for_output(label => 'warning-voltage-instance-' . $instance); $warn = $self->{perfdata}->get_perfdata_for_output(label => 'warning-voltage-instance-' . $instance);