+ Enhance checkpoint hardware mode (Ref #87)

This commit is contained in:
garnier-quentin 2015-07-20 16:47:56 +02:00
parent 751cd6278f
commit 16c08c8ebe
3 changed files with 22 additions and 13 deletions

View File

@ -70,6 +70,7 @@ sub check {
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_fanSpeedSensorEntry}, instance => $instance);
next if ($self->check_exclude(section => 'fan', instance => $instance));
next if ($result->{fanSpeedSensorName} !~ /^[0-9a-zA-Z ]$/); # sometimes there is some wrong values in hex
$self->{components}->{fan}->{total}++;
$self->{output}->output_add(long_msg => sprintf("Fan '%s' sensor out of range status is '%s'",
@ -80,8 +81,10 @@ sub check {
short_msg => sprintf("Fan '%s' sensor out of range status is '%s'", $result->{fanSpeedSensorName}, $result->{fanSpeedSensorStatus}));
}
$self->{output}->perfdata_add(label => $result->{fanSpeedSensorName}, unit => 'rpm',
value => sprintf("%d", $result->{fanSpeedSensorValue}));
if (defined($result->{fanSpeedSensorValue}) && $result->{fanSpeedSensorValue} =~ /^[0-9\.]+$/) {
$self->{output}->perfdata_add(label => $result->{fanSpeedSensorName}, unit => 'rpm',
value => sprintf("%d", $result->{fanSpeedSensorValue}));
}
}
}

View File

@ -70,18 +70,21 @@ sub check {
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_tempertureSensorEntry}, instance => $instance);
next if ($self->check_exclude(section => 'temperature', instance => $instance));
next if ($result->{tempertureSensorName} !~ /^[0-9a-zA-Z ]$/); # sometimes there is some wrong values in hex
$self->{components}->{temperature}->{total}++;
$self->{output}->output_add(long_msg => sprintf("Temperature '%s' sensor out of range status is '%s'",
$result->{tempertureSensorName}, $result->{tempertureSensorStatus}));
$self->{output}->output_add(long_msg => sprintf("Temperature '%s' sensor out of range status is '%s' [instance: %s]",
$result->{tempertureSensorName}, $result->{tempertureSensorStatus}, $instance));
my $exit = $self->get_severity(section => 'temperature', value => $result->{tempertureSensorStatus});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Temperature '%s' sensor out of range status is '%s'", $result->{tempertureSensorName}, $result->{tempertureSensorStatus}));
short_msg => sprintf("Temperature '%s/%s' sensor out of range status is '%s'", $result->{tempertureSensorName}, $instance, $result->{tempertureSensorStatus}));
}
$self->{output}->perfdata_add(label => $result->{tempertureSensorName} , unit => 'C',
value => sprintf("%.2f", $result->{tempertureSensorValue}));
if (defined($result->{tempertureSensorValue}) && $result->{tempertureSensorValue} =~ /^[0-9\.]+$/) {
$self->{output}->perfdata_add(label => 'temp_' . $result->{tempertureSensorName} . '_' . $instance , unit => 'C',
value => sprintf("%.2f", $result->{tempertureSensorValue}));
}
}
}

View File

@ -70,18 +70,21 @@ sub check {
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_voltageSensorEntry}, instance => $instance);
next if ($self->check_exclude(section => 'voltage', instance => $instance));
next if ($result->{voltageSensorName} !~ /^[0-9a-zA-Z ]$/); # sometimes there is some wrong values in hex
$self->{components}->{voltage}->{total}++;
$self->{output}->output_add(long_msg => sprintf("Voltage '%s' sensor out of range status is '%s'",
$result->{voltageSensorName}, $result->{voltageSensorStatus}));
$self->{output}->output_add(long_msg => sprintf("Voltage '%s' sensor out of range status is '%s' [instance: %s]",
$result->{voltageSensorName}, $result->{voltageSensorStatus}, $instance));
my $exit = $self->get_severity(section => 'voltage', value => $result->{voltageSensorStatus});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Voltage '%s' sensor out of range status is '%s'", $result->{voltageSensorName}, $result->{voltageSensorStatus}));
short_msg => sprintf("Voltage '%s/%s' sensor out of range status is '%s'", $result->{voltageSensorName}, $instance, $result->{voltageSensorStatus}));
}
if (defined($result->{voltageSensorValue}) && $result->{voltageSensorValue} =~ /^[0-9\.]+$/) {
$self->{output}->perfdata_add(label => 'volt_' . $result->{voltageSensorName} . '_' . $instance, unit => 'V',
value => sprintf("%.2f", $result->{voltageSensorValue}));
}
$self->{output}->perfdata_add(label => $result->{voltageSensorName} , unit => 'V',
value => sprintf("%.2f", $result->{voltageSensorValue}));
}
}