Merge pull request #1455 from CPbN/mikropower

Mikrotik, adjust power value
This commit is contained in:
qgarnier 2019-03-28 11:32:48 +01:00 committed by GitHub
commit 56934e6b8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -69,15 +69,15 @@ sub check {
check_psu($self, value => $result->{mtxrHlBackupPowerSupplyState}, type => 'backup'); check_psu($self, value => $result->{mtxrHlBackupPowerSupplyState}, type => 'backup');
if (defined($result->{mtxrHlPower}) && $result->{mtxrHlPower} =~ /[0-9]+/) { if (defined($result->{mtxrHlPower}) && $result->{mtxrHlPower} =~ /[0-9]+/) {
$self->{output}->output_add(long_msg => sprintf("Power is '%s' W", $result->{mtxrHlPower})); $self->{output}->output_add(long_msg => sprintf("Power is '%s' W", $result->{mtxrHlPower} / 10));
($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'psu', instance => $instance, value => $result->{mtxrHlPower}); ($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'psu', instance => $instance, value => $result->{mtxrHlPower} / 10);
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("Power is '%s' W", $result->{mtxrHlPower})); short_msg => sprintf("Power is '%s' W", $result->{mtxrHlPower} / 10));
} }
$self->{output}->perfdata_add(label => 'power', unit => 'W', $self->{output}->perfdata_add(label => 'power', unit => 'W',
value => $result->{mtxrHlPower}, value => $result->{mtxrHlPower} / 10,
warning => $warn, warning => $warn,
critical => $crit); critical => $crit);
$self->{components}->{psu}->{total}++; $self->{components}->{psu}->{total}++;