diff --git a/storage/netgear/readynas/snmp/mode/components/disk.pm b/storage/netgear/readynas/snmp/mode/components/disk.pm index 88902db9d..02d751ae1 100644 --- a/storage/netgear/readynas/snmp/mode/components/disk.pm +++ b/storage/netgear/readynas/snmp/mode/components/disk.pm @@ -66,16 +66,22 @@ sub check { $self->{components}->{disk}->{total}++; my $temperature_string = defined($result->{diskTemperature}) && $result->{diskTemperature} != -1 ? " (temperature $result->{diskTemperature}" : ''; - my $temperature_unit = $temperature_string ne '' && $self->{mib_ver} == 6 ? 'C)' : ''; - $temperature_unit = $temperature_string ne '' && $self->{mib_ver} == 4 ? 'F)' : ''; + my $temperature_unit = $temperature_string ne '' && $self->{mib_ver} eq 'v6' ? 'C)' : ''; + $temperature_unit = $temperature_string ne '' && $self->{mib_ver} eq 'v4' ? 'F)' : ''; - $self->{output}->output_add(long_msg => sprintf("disk '%s' status is %s [temperature: %s%s]", - $instance, $result->{diskState}, $temperature_string, $temperature_unit)); + $self->{output}->output_add( + long_msg => sprintf( + "disk '%s' status is %s [temperature: %s%s]", + $instance, $result->{diskState}, $temperature_string, $temperature_unit + ) + ); my $exit = $self->get_severity(section => 'disk', value => $result->{diskState}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { - $self->{output}->output_add(severity => $exit, - short_msg => sprintf("Disk '%s' status is %s", $instance, $result->{diskState})); + $self->{output}->output_add( + severity => $exit, + short_msg => sprintf("Disk '%s' status is %s", $instance, $result->{diskState}) + ); } } } diff --git a/storage/netgear/readynas/snmp/mode/components/temperature.pm b/storage/netgear/readynas/snmp/mode/components/temperature.pm index e65eac413..cbfd503a2 100644 --- a/storage/netgear/readynas/snmp/mode/components/temperature.pm +++ b/storage/netgear/readynas/snmp/mode/components/temperature.pm @@ -67,20 +67,32 @@ sub check { $self->{components}->{temperature}->{total}++; my $temperatureMax_string = defined($result->{temperatureMax}) && $result->{temperatureMax} != -1 ? " ($result->{temperatureMax} max)" : ''; - my $temperatureMax_unit = defined($result->{temperatureMax}) && $self->{mib_ver} == 6 ? 'C' : 'F'; - - $self->{output}->output_add(long_msg => sprintf("temperature '%s' status is %s [value = %s%s]", - $instance, $result->{temperatureStatus}, $result->{temperatureValue}, $temperatureMax_unit)); - my $exit = $self->get_severity(label => 'default', section => 'temperature', value => $result->{temperatureStatus}); + my $temperatureMax_unit = defined($result->{temperatureMax}) && $self->{mib_ver} eq 'v6' ? 'C' : 'F'; + my $temperature_status = defined($result->{temperatureStatus}) ? $result->{temperatureStatus} : 'n/a'; + + $self->{output}->output_add( + long_msg => sprintf( + "temperature '%s' status is %s [value = %s%s]", + $instance, + defined($result->{temperatureStatus}) ? $result->{temperatureStatus} : 'n/a', + $temperature_status, + $temperatureMax_unit + ) + ); + my $exit = $self->get_severity(label => 'default', section => 'temperature', value => $temperature_status); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { - $self->{output}->output_add(severity => $exit, - short_msg => sprintf("Temperature '%s' status is %s.", $instance, $result->{temperatureStatus})); + $self->{output}->output_add( + severity => $exit, + short_msg => sprintf("Temperature '%s' status is %s.", $instance, $temperature_status) + ); } my ($exit2, $warn, $crit) = $self->get_severity_numeric(section => 'temperature', instance => $instance, value => $result->{temperatureValue}); if (!$self->{output}->is_status(value => $exit2, compare => 'ok', litteral => 1)) { - $self->{output}->output_add(severity => $exit2, - short_msg => sprintf("Temperature '%s' is %s%s", $instance, $result->{temperatureValue}, $temperatureMax_unit)); + $self->{output}->output_add( + severity => $exit2, + short_msg => sprintf("Temperature '%s' is %s%s", $instance, $result->{temperatureValue}, $temperatureMax_unit) + ); } $self->{output}->perfdata_add( label => 'temp', unit => $temperatureMax_unit, diff --git a/storage/netgear/readynas/snmp/mode/hardware.pm b/storage/netgear/readynas/snmp/mode/hardware.pm index 599541676..8782a6e7f 100644 --- a/storage/netgear/readynas/snmp/mode/hardware.pm +++ b/storage/netgear/readynas/snmp/mode/hardware.pm @@ -42,12 +42,13 @@ sub set_system { ['Ok', 'OK'], ['Unknown', 'CRITICAL'], ['Failed', 'CRITICAL'], + ['n/a', 'OK' ] ], disk => [ ['Online', 'OK'], ['Ok', 'OK'], ['Unknown', 'OK'], - ['Offline', 'CRITICAL'], + ['Offline', 'CRITICAL'] ], psu => [ ['On', 'OK'], @@ -61,8 +62,8 @@ sub set_system { ['Unprotected', 'WARNING'], ['Degraded', 'CRITICAL'], ['Dead', 'CRITICAL'], - ['Unknown', 'CRITICAL'], - ], + ['Unknown', 'CRITICAL'] + ] }; $self->{components_path} = 'storage::netgear::readynas::snmp::mode::components';