Ref #2049
This commit is contained in:
parent
fbb5cc34f9
commit
c52518c3ff
|
@ -65,14 +65,14 @@ sub check {
|
||||||
next if ($self->check_filter(section => 'disk', instance => $instance));
|
next if ($self->check_filter(section => 'disk', instance => $instance));
|
||||||
$self->{components}->{disk}->{total}++;
|
$self->{components}->{disk}->{total}++;
|
||||||
|
|
||||||
my $temperature_string = defined($result->{diskTemperature}) && $result->{diskTemperature} != -1 ? " (temperature $result->{diskTemperature}" : '';
|
my $temperature_value = defined($result->{diskTemperature}) && $result->{diskTemperature} != -1 ? $result->{diskTemperature} : '-';
|
||||||
my $temperature_unit = $temperature_string ne '' && $self->{mib_ver} eq 'v6' ? 'C)' : '';
|
my $temperature_unit = $temperature_string ne '' && $self->{mib_ver} eq 'v6' ? 'C' : '';
|
||||||
$temperature_unit = $temperature_string ne '' && $self->{mib_ver} eq 'v4' ? 'F)' : '';
|
$temperature_unit = $temperature_string ne '' && $self->{mib_ver} eq 'v4' ? 'F' : '';
|
||||||
|
|
||||||
$self->{output}->output_add(
|
$self->{output}->output_add(
|
||||||
long_msg => sprintf(
|
long_msg => sprintf(
|
||||||
"disk '%s' status is %s [temperature: %s%s]",
|
"disk '%s' status is %s [temperature: %s%s]",
|
||||||
$instance, $result->{diskState}, $temperature_string, $temperature_unit
|
$instance, $result->{diskState}, $temperature_value, $temperature_unit
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,6 @@ my $mapping = {
|
||||||
v6 => {
|
v6 => {
|
||||||
temperatureValue => { oid => '.1.3.6.1.4.1.4526.22.5.1.2' },
|
temperatureValue => { oid => '.1.3.6.1.4.1.4526.22.5.1.2' },
|
||||||
temperatureType => { oid => '.1.3.6.1.4.1.4526.22.5.1.3' },
|
temperatureType => { oid => '.1.3.6.1.4.1.4526.22.5.1.3' },
|
||||||
temperatureMax => { oid => '.1.3.6.1.4.1.4526.22.5.1.5' }
|
|
||||||
},
|
},
|
||||||
v4 => {
|
v4 => {
|
||||||
temperatureValue => { oid => '.1.3.6.1.4.1.4526.18.5.1.2' },
|
temperatureValue => { oid => '.1.3.6.1.4.1.4526.18.5.1.2' },
|
||||||
|
@ -66,8 +65,7 @@ sub check {
|
||||||
next if ($self->check_filter(section => 'temperature', instance => $instance));
|
next if ($self->check_filter(section => 'temperature', instance => $instance));
|
||||||
$self->{components}->{temperature}->{total}++;
|
$self->{components}->{temperature}->{total}++;
|
||||||
|
|
||||||
my $temperatureMax_string = defined($result->{temperatureMax}) && $result->{temperatureMax} != -1 ? " ($result->{temperatureMax} max)" : '';
|
my $temperature_unit = $self->{mib_ver} eq 'v6' ? 'C' : 'F';
|
||||||
my $temperatureMax_unit = defined($result->{temperatureMax}) && $self->{mib_ver} eq 'v6' ? 'C' : 'F';
|
|
||||||
my $temperature_status = defined($result->{temperatureStatus}) ? $result->{temperatureStatus} : 'n/a';
|
my $temperature_status = defined($result->{temperatureStatus}) ? $result->{temperatureStatus} : 'n/a';
|
||||||
|
|
||||||
$self->{output}->output_add(
|
$self->{output}->output_add(
|
||||||
|
@ -75,8 +73,8 @@ sub check {
|
||||||
"temperature '%s' status is %s [value = %s%s]",
|
"temperature '%s' status is %s [value = %s%s]",
|
||||||
$instance,
|
$instance,
|
||||||
defined($result->{temperatureStatus}) ? $result->{temperatureStatus} : 'n/a',
|
defined($result->{temperatureStatus}) ? $result->{temperatureStatus} : 'n/a',
|
||||||
$temperature_status,
|
$result->{temperatureValue},
|
||||||
$temperatureMax_unit
|
$temperature_unit
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
my $exit = $self->get_severity(label => 'default', section => 'temperature', value => $temperature_status);
|
my $exit = $self->get_severity(label => 'default', section => 'temperature', value => $temperature_status);
|
||||||
|
@ -91,12 +89,12 @@ sub check {
|
||||||
if (!$self->{output}->is_status(value => $exit2, compare => 'ok', litteral => 1)) {
|
if (!$self->{output}->is_status(value => $exit2, compare => 'ok', litteral => 1)) {
|
||||||
$self->{output}->output_add(
|
$self->{output}->output_add(
|
||||||
severity => $exit2,
|
severity => $exit2,
|
||||||
short_msg => sprintf("Temperature '%s' is %s%s", $instance, $result->{temperatureValue}, $temperatureMax_unit)
|
short_msg => sprintf("Temperature '%s' is %s%s", $instance, $result->{temperatureValue}, $temperature_unit)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$self->{output}->perfdata_add(
|
$self->{output}->perfdata_add(
|
||||||
label => 'temp', unit => $temperatureMax_unit,
|
label => 'temp', unit => $temperature_unit,
|
||||||
nlabel => 'hardware.temperature.' . (($temperatureMax_unit eq 'C') ? 'celsius' : 'fahrenheit'),
|
nlabel => 'hardware.temperature.' . (($temperature_unit eq 'C') ? 'celsius' : 'fahrenheit'),
|
||||||
instances => $instance,
|
instances => $instance,
|
||||||
value => $result->{temperatureValue},
|
value => $result->{temperatureValue},
|
||||||
warning => $warn,
|
warning => $warn,
|
||||||
|
|
Loading…
Reference in New Issue