Fix #1216
This commit is contained in:
parent
eaf225c854
commit
1f501ffb75
|
@ -51,7 +51,7 @@ sub check {
|
|||
next if ($self->check_filter(section => 'fan', instance => $instance));
|
||||
|
||||
$self->{components}->{fan}->{total}++;
|
||||
$self->{output}->output_add(long_msg => sprintf("Fan '%s' [instance: %s] speed is '%s'.",
|
||||
$self->{output}->output_add(long_msg => sprintf("fan '%s' [instance: %s] speed is '%s'.",
|
||||
$fan_descr, $instance, $fan_speed));
|
||||
|
||||
if ($fan_speed =~ /([0-9]+)\s*rpm/i) {
|
||||
|
@ -68,4 +68,4 @@ sub check {
|
|||
}
|
||||
}
|
||||
|
||||
1;
|
||||
1;
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
#
|
||||
# Copyright 2019 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package storage::qnap::snmp::mode::components::raid;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
# In MIB 'NAS.mib'
|
||||
my $oid_raidStatus = '.1.3.6.1.4.1.24681.1.4.1.1.1.2.1.2.1.5';
|
||||
|
||||
sub load {
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$self->{request}}, { oid => $oid_raidStatus };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking raids");
|
||||
$self->{components}->{raid} = {name => 'raids', total => 0, skip => 0};
|
||||
return if ($self->check_filter(section => 'raid'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_raidStatus}})) {
|
||||
$oid =~ /\.(\d+)$/;
|
||||
my $instance = $1;
|
||||
|
||||
next if ($self->check_filter(section => 'raid', instance => $instance));
|
||||
|
||||
my $status = $self->{results}->{$oid_raidStatus}->{$oid};
|
||||
$self->{components}->{raid}->{total}++;
|
||||
$self->{output}->output_add(long_msg => sprintf("raid '%s' status is %s [instance: %s]",
|
||||
$instance, $status, $instance));
|
||||
my $exit = $self->get_severity(section => 'raid', value => $status);
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Raid '%s' status is %s.", $instance, $status));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -47,7 +47,7 @@ sub check {
|
|||
if ($cpu_temp =~ /([0-9]+)\s*C/ && !$self->check_filter(section => 'temperature', instance => 'cpu')) {
|
||||
my $value = $1;
|
||||
$self->{components}->{temperature}->{total}++;
|
||||
$self->{output}->output_add(long_msg => sprintf("CPU Temperature is '%s' degree centigrade",
|
||||
$self->{output}->output_add(long_msg => sprintf("cpu temperature is '%s' degree centigrade",
|
||||
$value));
|
||||
my ($exit, $warn, $crit) = $self->get_severity_numeric(section => 'temperature', instance => 'cpu', value => $value);
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
|
@ -77,4 +77,4 @@ sub check {
|
|||
}
|
||||
}
|
||||
|
||||
1;
|
||||
1;
|
||||
|
|
|
@ -28,7 +28,7 @@ use warnings;
|
|||
sub set_system {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{regexp_threshold_overload_check_section_option} = '^(temperature|disk|smartdisk|fan)$';
|
||||
$self->{regexp_threshold_overload_check_section_option} = '^(temperature|disk|smartdisk|fan|raid)$';
|
||||
$self->{regexp_threshold_numeric_check_section_option} = '^(temperature|disk|smartdisk|fan)$';
|
||||
|
||||
$self->{cb_hook2} = 'snmp_execute';
|
||||
|
@ -47,10 +47,15 @@ sub set_system {
|
|||
['--', 'OK'],
|
||||
['.*', 'CRITICAL'],
|
||||
],
|
||||
raid => [
|
||||
['Ready', 'OK'],
|
||||
['degraded', 'WARNING'],
|
||||
['.*', 'CRITICAL'],
|
||||
],
|
||||
};
|
||||
|
||||
$self->{components_path} = 'storage::qnap::snmp::mode::components';
|
||||
$self->{components_module} = ['temperature', 'disk', 'fan'];
|
||||
$self->{components_module} = ['temperature', 'disk', 'fan', 'raid'];
|
||||
}
|
||||
|
||||
sub snmp_execute {
|
||||
|
@ -66,9 +71,8 @@ sub new {
|
|||
bless $self, $class;
|
||||
|
||||
$self->{version} = '1.0';
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
});
|
||||
$options{options}->add_options(arguments => {
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
@ -79,14 +83,14 @@ __END__
|
|||
|
||||
=head1 MODE
|
||||
|
||||
Check hardware (NAS.mib) (Fans, Temperatures, Disks).
|
||||
Check hardware (NAS.mib) (Fans, Temperatures, Disks, Raid).
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--component>
|
||||
|
||||
Which component to check (Default: '.*').
|
||||
Can be: 'fan', 'disk', 'temperature'.
|
||||
Can be: 'fan', 'disk', 'temperature', 'raid'.
|
||||
|
||||
=item B<--filter>
|
||||
|
||||
|
@ -121,4 +125,4 @@ Example: --critical='temperature,system,40' --critical='disk,.*,40'
|
|||
|
||||
=back
|
||||
|
||||
=cut
|
||||
=cut
|
||||
|
|
Loading…
Reference in New Issue