diff --git a/network/mikrotik/snmp/mode/components/fan.pm b/network/mikrotik/snmp/mode/components/fan.pm index 48a15740e..77f7be728 100644 --- a/network/mikrotik/snmp/mode/components/fan.pm +++ b/network/mikrotik/snmp/mode/components/fan.pm @@ -47,8 +47,10 @@ sub check { ($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'fan', instance => '1', value => $result->{mtxrHlFanSpeed1}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { - $self->{output}->output_add(severity => $exit, - short_msg => sprintf("Fan '1' speed is '%s' RPM", $result->{mtxrHlFanSpeed1})); + $self->{output}->output_add( + severity => $exit, + short_msg => sprintf("Fan '1' speed is '%s' RPM", $result->{mtxrHlFanSpeed1}) + ); } $self->{output}->perfdata_add( label => 'fan_speed', unit => 'rpm', @@ -61,13 +63,14 @@ sub check { $self->{components}->{fan}->{total}++; } if (defined($result->{mtxrHlFanSpeed2}) && $result->{mtxrHlFanSpeed2} =~ /[0-9]+/) { - $self->{output}->output_add(long_msg => sprintf("Fan '2' speed is '%s' RPM", $result->{mtxrHlFanSpeed2})); ($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'fan', instance => '2', value => $result->{mtxrHlFanSpeed2}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { - $self->{output}->output_add(severity => $exit, - short_msg => sprintf("Fan '2' speed is '%s' RPM", $result->{mtxrHlFanSpeed2})); + $self->{output}->output_add( + severity => $exit, + short_msg => sprintf("Fan '2' speed is '%s' RPM", $result->{mtxrHlFanSpeed2}) + ); } $self->{output}->perfdata_add( label => 'fan_speed', unit => 'rpm', diff --git a/network/mikrotik/snmp/mode/components/psu.pm b/network/mikrotik/snmp/mode/components/psu.pm index bb6fbf558..5e6c10ccc 100644 --- a/network/mikrotik/snmp/mode/components/psu.pm +++ b/network/mikrotik/snmp/mode/components/psu.pm @@ -35,9 +35,9 @@ sub load {} sub check_psu { my ($self, %options) = @_; - + return if (!defined($options{value})); - + $self->{output}->output_add( long_msg => sprintf( "psu %s status is '%s'", @@ -47,8 +47,10 @@ sub check_psu { my $exit = $self->get_severity(section => 'psu.' . $options{type}, value => $options{value}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { - $self->{output}->output_add(severity => $exit, - short_msg => sprintf("psu %s status is '%s'", $options{type}, $options{value})); + $self->{output}->output_add( + severity => $exit, + short_msg => sprintf("psu %s status is '%s'", $options{type}, $options{value}) + ); } $self->{components}->{psu}->{total}++; @@ -73,8 +75,10 @@ sub check { ($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)) { - $self->{output}->output_add(severity => $exit, - short_msg => sprintf("Power is '%s' W", $result->{mtxrHlPower} / 10)); + $self->{output}->output_add( + severity => $exit, + short_msg => sprintf("Power is '%s' W", $result->{mtxrHlPower} / 10) + ); } $self->{output}->perfdata_add( label => 'power', unit => 'W', diff --git a/network/mikrotik/snmp/mode/components/temperature.pm b/network/mikrotik/snmp/mode/components/temperature.pm index 3fc280709..1b8b6abe2 100644 --- a/network/mikrotik/snmp/mode/components/temperature.pm +++ b/network/mikrotik/snmp/mode/components/temperature.pm @@ -34,24 +34,25 @@ sub check { my ($self) = @_; $self->{output}->output_add(long_msg => "Checking temperature"); - $self->{components}->{temperature} = {name => 'temperature', total => 0, skip => 0}; + $self->{components}->{temperature} = { name => 'temperature', total => 0, skip => 0 }; return if ($self->check_filter(section => 'temperature')); - + my $instance = 0; my ($exit, $warn, $crit, $checked); my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}, instance => $instance); if (defined($result->{mtxrHlTemperature}) && $result->{mtxrHlTemperature} =~ /[0-9]+/) { - $self->{output}->output_add(long_msg => sprintf("System temperature (SoC or PCB) is '%s' C", $result->{mtxrHlTemperature} / 10)); ($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'temperature', instance => '1', value => $result->{mtxrHlTemperature} / 10); - if ($result->{mtxrHlTemperature} == -2730) { # RouterOS returns this when the SNMP agent hangs... - $exit = 'UNKNOWN'; - } + if ($result->{mtxrHlTemperature} == -2730) { # RouterOS returns this when the SNMP agent hangs... + $exit = 'UNKNOWN'; + } if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { - $self->{output}->output_add(severity => $exit, - short_msg => sprintf("System temperature (SoC or PCB) is '%s' C", $result->{mtxrHlTemperature} / 10)); + $self->{output}->output_add( + severity => $exit, + short_msg => sprintf("System temperature (SoC or PCB) is '%s' C", $result->{mtxrHlTemperature} / 10) + ); } $self->{output}->perfdata_add( label => 'temperature', unit => 'C', @@ -68,12 +69,14 @@ sub check { $self->{output}->output_add(long_msg => sprintf("Processor temperature is '%s' C", $result->{mtxrHlProcessorTemperature} / 10)); ($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'temperature', instance => '2', value => $result->{mtxrHlProcessorTemperature} / 10); - if ($result->{mtxrHlProcessorTemperature} == -2730) { # RouterOS returns this when the SNMP agent hangs... - $exit = 'UNKNOWN'; - } + if ($result->{mtxrHlProcessorTemperature} == -2730) { # RouterOS returns this when the SNMP agent hangs... + $exit = 'UNKNOWN'; + } if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { - $self->{output}->output_add(severity => $exit, - short_msg => sprintf("Processor temperature is '%s' C", $result->{mtxrHlProcessorTemperature} / 10)); + $self->{output}->output_add( + severity => $exit, + short_msg => sprintf("Processor temperature is '%s' C", $result->{mtxrHlProcessorTemperature} / 10) + ); } $self->{output}->perfdata_add( label => 'temperature', unit => 'C', diff --git a/network/mikrotik/snmp/mode/components/voltage.pm b/network/mikrotik/snmp/mode/components/voltage.pm index 711661ad5..87e8acc60 100644 --- a/network/mikrotik/snmp/mode/components/voltage.pm +++ b/network/mikrotik/snmp/mode/components/voltage.pm @@ -41,13 +41,14 @@ sub check { my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}, instance => $instance); if (defined($result->{mtxrHlVoltage}) && $result->{mtxrHlVoltage} =~ /[0-9]+/) { - $self->{output}->output_add(long_msg => sprintf("Voltage is '%s' V", $result->{mtxrHlVoltage} / 10)); ($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'voltage', instance => $instance, value => $result->{mtxrHlVoltage} / 10); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { - $self->{output}->output_add(severity => $exit, - short_msg => sprintf("Voltage is '%s' V", $result->{mtxrHlVoltage} / 10)); + $self->{output}->output_add( + severity => $exit, + short_msg => sprintf("Voltage is '%s' V", $result->{mtxrHlVoltage} / 10) + ); } $self->{output}->perfdata_add( label => 'voltage', unit => 'V',