(plugin) network:🇦🇼:aoscx::snmp - fix temperature value (#3788)

This commit is contained in:
qgarnier 2022-07-27 14:58:12 +02:00 committed by GitHub
parent fb928e0db7
commit f59d16d7c1
3 changed files with 10 additions and 8 deletions

View File

@ -75,7 +75,7 @@ sub check {
); );
} }
next if (!defined($result->{speed})); next if (!defined($result->{speed}) || $result->{speed} =~ /^0$/);
my ($exit2, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'fan.speed', instance => $instance, name => $result->{name}, value => $result->{speed}); my ($exit2, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'fan.speed', instance => $instance, name => $result->{name}, value => $result->{speed});
if (!$self->{output}->is_status(value => $exit2, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit2, compare => 'ok', litteral => 1)) {
@ -88,6 +88,7 @@ sub check {
) )
); );
} }
$self->{output}->perfdata_add( $self->{output}->perfdata_add(
unit => 'rpm', unit => 'rpm',
nlabel => 'hardware.fan.speed.rpm', nlabel => 'hardware.fan.speed.rpm',

View File

@ -55,9 +55,11 @@ sub check {
next if ($self->check_filter(section => 'temperature', instance => $instance, name => $result->{name})); next if ($self->check_filter(section => 'temperature', instance => $instance, name => $result->{name}));
$self->{components}->{temperature}->{total}++; $self->{components}->{temperature}->{total}++;
$result->{temperature} /= 1000;
$self->{output}->output_add( $self->{output}->output_add(
long_msg => sprintf( long_msg => sprintf(
"temperature '%s' status is %s [instance: %s, current: %s C]", "temperature '%s' status is %s [instance: %s, current: %.2f C]",
$result->{name}, $result->{name},
$result->{state}, $result->{state},
$instance, $instance,
@ -82,7 +84,7 @@ sub check {
$self->{output}->output_add( $self->{output}->output_add(
severity => $exit2, severity => $exit2,
short_msg => sprintf( short_msg => sprintf(
"temperature '%s' is %s C", "temperature '%s' is %.2f C",
$result->{name}, $result->{name},
$result->{temperature} $result->{temperature}
) )
@ -92,10 +94,9 @@ sub check {
unit => 'C', unit => 'C',
nlabel => 'hardware.temperature.celsius', nlabel => 'hardware.temperature.celsius',
instances => $result->{name}, instances => $result->{name},
value => $result->{temperature}, value => sprintf('%.2f', $result->{temperature}),
warning => $warn, warning => $warn,
critical => $crit, critical => $crit
min => 0
); );
} }
} }