(plugin) network::nokia::timos::snmp - mode hardware fix undefined value (#4444)
This commit is contained in:
parent
b659c46e05
commit
abc3ff1c87
|
@ -172,31 +172,41 @@ sub check {
|
||||||
next if ($self->check_filter(section => 'entity', instance => $result->{tmnxHwClass} . '.' . $instance));
|
next if ($self->check_filter(section => 'entity', instance => $result->{tmnxHwClass} . '.' . $instance));
|
||||||
|
|
||||||
$self->{components}->{entity}->{total}++;
|
$self->{components}->{entity}->{total}++;
|
||||||
$self->{output}->output_add(long_msg => sprintf("%s '%s' status is '%s' [instance = %s, temperature = %s]",
|
$self->{output}->output_add(
|
||||||
|
long_msg => sprintf(
|
||||||
|
"%s '%s' status is '%s' [instance = %s, temperature = %s]",
|
||||||
$result->{tmnxHwClass}, $result->{tmnxHwName},
|
$result->{tmnxHwClass}, $result->{tmnxHwName},
|
||||||
$result->{tmnxHwOperState}, $result->{tmnxHwClass} . '.' . $instance,
|
$result->{tmnxHwOperState}, $result->{tmnxHwClass} . '.' . $instance,
|
||||||
$result->{tmnxHwTempSensor} eq 'true' ? $result->{tmnxHwTemperature} : '-'));
|
$result->{tmnxHwTempSensor} eq 'true' ? $result->{tmnxHwTemperature} : '-'
|
||||||
|
)
|
||||||
|
);
|
||||||
$exit = $self->get_severity(label => 'default', section => 'entity', instance => $result->{tmnxHwClass} . '.' . $instance, value => $result->{tmnxHwOperState});
|
$exit = $self->get_severity(label => 'default', section => 'entity', instance => $result->{tmnxHwClass} . '.' . $instance, value => $result->{tmnxHwOperState});
|
||||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
$self->{output}->output_add(severity => $exit,
|
$self->{output}->output_add(
|
||||||
|
severity => $exit,
|
||||||
short_msg => sprintf("%s '%s' status is '%s'", $result->{tmnxHwClass}, $result->{tmnxHwName}, $result->{tmnxHwOperState}));
|
short_msg => sprintf("%s '%s' status is '%s'", $result->{tmnxHwClass}, $result->{tmnxHwName}, $result->{tmnxHwOperState}));
|
||||||
}
|
}
|
||||||
|
|
||||||
next if ($result->{tmnxHwTempSensor} eq 'false');
|
next if ($result->{tmnxHwTempSensor} eq 'false');
|
||||||
($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'temperature', instance => $result->{tmnxHwClass} . '.' . $instance,, value => $result->{tmnxHwTemperature});
|
($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'temperature', instance => $result->{tmnxHwClass} . '.' . $instance, value => $result->{tmnxHwTemperature});
|
||||||
if ($checked == 0 && $result->{tmnxHwTempThreshold} != -1 ) {
|
if ($checked == 0 && $result->{tmnxHwTempThreshold} != -1 ) {
|
||||||
$self->{perfdata}->threshold_validate(label => 'critical-temperature-instance-' . $result->{tmnxHwClass} . '.' . $instance, value => $result->{tmnxHwTempThreshold});
|
$self->{perfdata}->threshold_validate(label => 'critical-temperature-instance-' . $result->{tmnxHwClass} . '.' . $instance, value => $result->{tmnxHwTempThreshold});
|
||||||
|
|
||||||
$exit = $self->{perfdata}->threshold_check(value => $result->{slHdwTempSensorCurrentTemp}, threshold => [ { label => 'critical-temperature-instance-' . $instance, exit_litteral => 'critical' }]);
|
$exit = $self->{perfdata}->threshold_check(value => $result->{tmnxHwTemperature}, threshold => [ { label => 'critical-temperature-instance-' . $instance, exit_litteral => 'critical' }]);
|
||||||
$warn = undef;
|
$warn = undef;
|
||||||
$crit = $self->{perfdata}->get_perfdata_for_output(label => 'critical-temperature-instance-' . $result->{tmnxHwClass} . '.' . $instance);
|
$crit = $self->{perfdata}->get_perfdata_for_output(label => 'critical-temperature-instance-' . $result->{tmnxHwClass} . '.' . $instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
$self->{output}->output_add(severity => $exit,
|
$self->{output}->output_add(
|
||||||
short_msg => sprintf("%s '%s' temperature is '%s' C", $result->{tmnxHwClass},
|
severity => $exit,
|
||||||
$result->{tmnxHwName}, $result->{tmnxHwTemperature}));
|
short_msg => sprintf(
|
||||||
|
"%s '%s' temperature is '%s' C", $result->{tmnxHwClass},
|
||||||
|
$result->{tmnxHwName}, $result->{tmnxHwTemperature}
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$self->{output}->perfdata_add(
|
$self->{output}->perfdata_add(
|
||||||
label => 'temperature', unit => 'C',
|
label => 'temperature', unit => 'C',
|
||||||
nlabel => 'hardware.entity.temperature.celsius',
|
nlabel => 'hardware.entity.temperature.celsius',
|
||||||
|
|
Loading…
Reference in New Issue