Unverified Commit 12687ccf authored by qgarnier's avatar qgarnier Committed by GitHub
Browse files

enh(server/fujitsu): add disk and raid component (#2811)

parent 0622a400
......@@ -25,21 +25,21 @@ use warnings;
my $map_sc_cpu_status = {
1 => 'unknown', 2 => 'disabled', 3 => 'ok', 4 => 'not-present', 5 => 'error',
6 => 'fail', 7 => 'missing-termination', 8 => 'prefailure-warning',
6 => 'fail', 7 => 'missing-termination', 8 => 'prefailure-warning'
};
my $map_sc2_cpu_status = {
1 => 'unknown', 2 => 'not-present', 3 => 'ok', 4 => 'disabled', 5 => 'error',
6 => 'failed', 7 => 'missing-termination', 8 => 'prefailure-warning',
6 => 'failed', 7 => 'missing-termination', 8 => 'prefailure-warning'
};
my $mapping = {
sc => {
cpuStatus => { oid => '.1.3.6.1.4.1.231.2.10.2.2.5.4.1.1.6', map => $map_sc_cpu_status },
cpuStatus => { oid => '.1.3.6.1.4.1.231.2.10.2.2.5.4.1.1.6', map => $map_sc_cpu_status }
},
sc2 => {
sc2cpuDesignation => { oid => '.1.3.6.1.4.1.231.2.10.2.2.10.6.4.1.3' },
sc2cpuStatus => { oid => '.1.3.6.1.4.1.231.2.10.2.2.10.6.4.1.4', map => $map_sc2_cpu_status },
},
sc2cpuStatus => { oid => '.1.3.6.1.4.1.231.2.10.2.2.10.6.4.1.4', map => $map_sc2_cpu_status }
}
};
my $oid_sc2CPUs = '.1.3.6.1.4.1.231.2.10.2.2.10.6.4.1';
......@@ -58,20 +58,25 @@ sub check_cpu {
my $instance = $1;
my $result = $self->{snmp}->map_instance(mapping => $options{mapping}, results => $self->{results}->{$options{entry}}, instance => $instance);
$result->{instance} = $instance;
next if ($self->check_filter(section => 'cpu', instance => $instance));
next if ($result->{$options{status}} =~ /not-present|not-available/i &&
$self->absent_problem(section => 'cpu', instance => $instance));
$self->{components}->{cpu}->{total}++;
$self->{output}->output_add(long_msg => sprintf("cpu '%s' status is '%s' [instance = %s]",
$result->{$options{name}}, $result->{$options{status}}, $instance,
));
$self->{output}->output_add(
long_msg => sprintf(
"cpu '%s' status is '%s' [instance: %s]",
$result->{$options{name}}, $result->{$options{status}}, $instance
)
);
$exit = $self->get_severity(section => 'cpu', value => $result->{$options{status}});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Cpu '%s' status is '%s'", $result->{$options{name}}, $result->{$options{status}}));
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf("Cpu '%s' status is '%s'", $result->{$options{name}}, $result->{$options{status}})
);
}
}
}
......@@ -79,16 +84,20 @@ sub check_cpu {
sub check {
my ($self) = @_;
$self->{output}->output_add(long_msg => "Checking cpu");
$self->{components}->{cpu} = {name => 'cpu', total => 0, skip => 0};
$self->{output}->output_add(long_msg => 'Checking cpu');
$self->{components}->{cpu} = { name => 'cpu', total => 0, skip => 0 };
return if ($self->check_filter(section => 'cpu'));
if (defined($self->{results}->{$oid_sc2CPUs}) && scalar(keys %{$self->{results}->{$oid_sc2CPUs}}) > 0) {
check_cpu($self, entry => $oid_sc2CPUs, mapping => $mapping->{sc2}, name => 'sc2cpuDesignation',
status => 'sc2cpuStatus');
check_cpu(
$self, entry => $oid_sc2CPUs, mapping => $mapping->{sc2}, name => 'sc2cpuDesignation',
status => 'sc2cpuStatus'
);
} else {
check_cpu($self, entry => $mapping->{sc}->{cpuStatus}, mapping => $mapping->{sc}, name => 'instance',
status => 'cpuStatus');
check_cpu(
$self, entry => $mapping->{sc}->{cpuStatus}, mapping => $mapping->{sc}, name => 'instance',
status => 'cpuStatus'
);
}
}
......
#
# Copyright 2021 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 hardware::server::fujitsu::snmp::mode::components::disk;
use strict;
use warnings;
my $map_drive_status = {
1 => 'unknown', 2 => 'noDisk',
3 => 'online', 4 => 'ready',
5 => 'failed', 6 => 'rebuilding',
7 => 'hotspareGlobal', 8 => 'hotspareDedicated',
9 => 'offline', 10 => 'unconfiguredFailed',
11 => 'formatting', 12 => 'dead'
};
my $mapping = {
status => { oid => '.1.3.6.1.4.1.231.2.49.1.5.2.1.15', map => $map_drive_status } # svrPhysicalDeviceStatus
};
sub load {
my ($self) = @_;
push @{$self->{request}}, { oid => $mapping->{status}->{oid} };
}
sub check {
my ($self) = @_;
$self->{output}->output_add(long_msg => 'Checking disks');
$self->{components}->{disk} = { name => 'disks', total => 0, skip => 0 };
return if ($self->check_filter(section => 'disk'));
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{ $mapping->{status}->{oid} }})) {
next if ($oid !~ /^$mapping->{status}->{oid}\.(\d+)\.(\d+)\.(\d+)\.(\d+)$/);
my $instance = $1 . '.' . $2 . '.' . $3 . '.' . $4;
my $name = $1 . ':' . $2 . ':' . $3 . ':' . $4;
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{ $mapping->{status}->{oid} }, instance => $instance);
next if ($self->check_filter(section => 'disk', instance => $instance));
$self->{components}->{disk}->{total}++;
$self->{output}->output_add(
long_msg => sprintf(
"disk '%s' status is '%s' [instance: %s]",
$name, $result->{status}, $instance
)
);
my $exit = $self->get_severity(section => 'disk', value => $result->{status});
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'", $name, $result->{status})
);
}
}
}
1;
......@@ -26,25 +26,25 @@ use warnings;
my $map_sc_fan_status = {
1 => 'unknown', 2 => 'disabled', 3 => 'ok', 4 => 'fail',
5 => 'prefailure-predicted', 6 => 'redundant-fan-failed',
7 => 'not-manageable', 8 => 'not-present',
7 => 'not-manageable', 8 => 'not-present'
};
my $map_sc2_fan_status = {
1 => 'unknown', 2 => 'disabled', 3 => 'ok', 4 => 'failed',
5 => 'prefailure-predicted', 6 => 'redundant-fan-failed',
7 => 'not-manageable', 8 => 'not-present',
7 => 'not-manageable', 8 => 'not-present'
};
my $mapping = {
sc => {
fanStatus => { oid => '.1.3.6.1.4.1.231.2.10.2.2.5.2.2.1.3', map => $map_sc_fan_status },
fanCurrentSpeed => { oid => '.1.3.6.1.4.1.231.2.10.2.2.5.2.2.1.8' },
fanDesignation => { oid => '.1.3.6.1.4.1.231.2.10.2.2.5.2.2.1.16' },
fanDesignation => { oid => '.1.3.6.1.4.1.231.2.10.2.2.5.2.2.1.16' }
},
sc2 => {
sc2fanDesignation => { oid => '.1.3.6.1.4.1.231.2.10.2.2.10.5.2.1.3' },
sc2fanStatus => { oid => '.1.3.6.1.4.1.231.2.10.2.2.10.5.2.1.5', map => $map_sc2_fan_status },
sc2fanCurrentSpeed => { oid => '.1.3.6.1.4.1.231.2.10.2.2.10.5.2.1.6' },
},
sc2fanCurrentSpeed => { oid => '.1.3.6.1.4.1.231.2.10.2.2.10.5.2.1.6' }
}
};
my $oid_sc2Fans = '.1.3.6.1.4.1.231.2.10.2.2.10.5.2.1';
my $oid_fans = '.1.3.6.1.4.1.231.2.10.2.2.5.2.2.1';
......@@ -63,34 +63,41 @@ sub check_fan {
next if ($oid !~ /^$options{mapping}->{$options{status}}->{oid}\.(.*)$/);
my $instance = $1;
my $result = $self->{snmp}->map_instance(mapping => $options{mapping}, results => $self->{results}->{$options{entry}}, instance => $instance);
next if ($self->check_filter(section => 'fan', instance => $instance));
next if ($result->{$options{status}} =~ /not-present|not-available/i &&
$self->absent_problem(section => 'fan', instance => $instance));
$self->{components}->{fan}->{total}++;
$self->{output}->output_add(long_msg => sprintf("fan '%s' status is '%s' [instance = %s] [speed = %s]",
$result->{$options{name}}, $result->{$options{status}}, $instance, $result->{$options{speed}}
));
$self->{output}->output_add(
long_msg => sprintf(
"fan '%s' status is '%s' [instance: %s] [speed: %s]",
$result->{$options{name}}, $result->{$options{status}}, $instance, $result->{$options{speed}}
)
);
$exit = $self->get_severity(section => 'fan', value => $result->{$options{status}});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Fan '%s' status is '%s'", $result->{$options{name}}, $result->{$options{status}}));
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf("Fan '%s' status is '%s'", $result->{$options{name}}, $result->{$options{status}})
);
}
next if (!defined($result->{$options{speed}}) || $result->{$options{speed}} == -1);
($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'fan', instance => $instance, value => $result->{$options{speed}});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Fan '%s' speed is %s rpm", $result->{$options{name}}, $result->{$options{speed}}));
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf("Fan '%s' speed is %s rpm", $result->{$options{name}}, $result->{$options{speed}})
);
}
$self->{output}->perfdata_add(
label => 'fan', unit => 'rpm',
nlabel => 'hardware.fan.speed.rpm',
unit => 'rpm',
instances => $result->{$options{name}},
value => $result->{$options{speed}},
warning => $warn,
......@@ -103,16 +110,20 @@ sub check_fan {
sub check {
my ($self) = @_;
$self->{output}->output_add(long_msg => "Checking fans");
$self->{components}->{fan} = {name => 'fans', total => 0, skip => 0};
$self->{output}->output_add(long_msg => 'Checking fans');
$self->{components}->{fan} = { name => 'fans', total => 0, skip => 0 };
return if ($self->check_filter(section => 'fan'));
if (defined($self->{results}->{$oid_sc2Fans}) && scalar(keys %{$self->{results}->{$oid_sc2Fans}}) > 0) {
check_fan($self, entry => $oid_sc2Fans, mapping => $mapping->{sc2}, name => 'sc2fanDesignation',
speed => 'sc2fanCurrentSpeed', status => 'sc2fanStatus');
check_fan(
$self, entry => $oid_sc2Fans, mapping => $mapping->{sc2}, name => 'sc2fanDesignation',
speed => 'sc2fanCurrentSpeed', status => 'sc2fanStatus'
);
} else {
check_fan($self, entry => $oid_fans, mapping => $mapping->{sc}, name => 'fanDesignation',
speed => 'fanCurrentSpeed', status => 'fanStatus');
check_fan(
$self, entry => $oid_fans, mapping => $mapping->{sc}, name => 'fanDesignation',
speed => 'fanCurrentSpeed', status => 'fanStatus'
);
}
}
......
......@@ -26,21 +26,21 @@ use warnings;
my $map_sc_memory_status = {
1 => 'unknown', 2 => 'error', 3 => 'ok', 4 => 'not-available', 5 => 'fail',
6 => 'prefailure-warning', 7 => 'hot-spare', 8 => 'mirror',
9 => 'disabled', 10 => 'raid',
9 => 'disabled', 10 => 'raid'
};
my $map_sc2_memory_status = {
1 => 'unknown', 2 => 'not-present', 3 => 'ok', 4 => 'disabled', 5 => 'error', 6 => 'failed',
7 => 'prefailure-predicted', 8 => 'hot-spare', 9 => 'mirror', 10 => 'raid', 11 => 'hidden',
7 => 'prefailure-predicted', 8 => 'hot-spare', 9 => 'mirror', 10 => 'raid', 11 => 'hidden'
};
my $mapping = {
sc => {
memModuleStatus => { oid => '.1.3.6.1.4.1.231.2.10.2.2.5.4.10.1.3', map => $map_sc_memory_status },
memModuleStatus => { oid => '.1.3.6.1.4.1.231.2.10.2.2.5.4.10.1.3', map => $map_sc_memory_status }
},
sc2 => {
sc2memModuleDesignation => { oid => '.1.3.6.1.4.1.231.2.10.2.2.10.6.5.1.3' },
sc2memModuleStatus => { oid => '.1.3.6.1.4.1.231.2.10.2.2.10.6.5.1.4', map => $map_sc2_memory_status },
},
sc2memModuleStatus => { oid => '.1.3.6.1.4.1.231.2.10.2.2.10.6.5.1.4', map => $map_sc2_memory_status }
}
};
my $oid_sc2MemoryModules = '.1.3.6.1.4.1.231.2.10.2.2.10.6.5.1';
......@@ -59,20 +59,25 @@ sub check_memory {
my $instance = $1;
my $result = $self->{snmp}->map_instance(mapping => $options{mapping}, results => $self->{results}->{$options{entry}}, instance => $instance);
$result->{instance} = $instance;
next if ($self->check_filter(section => 'memory', instance => $instance));
next if ($result->{$options{status}} =~ /not-present|not-available/i &&
$self->absent_problem(section => 'memory', instance => $instance));
$self->{components}->{memory}->{total}++;
$self->{output}->output_add(long_msg => sprintf("memory '%s' status is '%s' [instance = %s]",
$result->{$options{name}}, $result->{$options{status}}, $instance,
));
$self->{output}->output_add(
long_msg => sprintf(
"memory '%s' status is '%s' [instance: %s]",
$result->{$options{name}}, $result->{$options{status}}, $instance
)
);
$exit = $self->get_severity(section => 'memory', value => $result->{$options{status}});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Memory '%s' status is '%s'", $result->{$options{name}}, $result->{$options{status}}));
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf("Memory '%s' status is '%s'", $result->{$options{name}}, $result->{$options{status}})
);
}
}
}
......@@ -80,16 +85,20 @@ sub check_memory {
sub check {
my ($self) = @_;
$self->{output}->output_add(long_msg => "Checking memories");
$self->{components}->{memory} = {name => 'memories', total => 0, skip => 0};
$self->{output}->output_add(long_msg => 'Checking memories');
$self->{components}->{memory} = { name => 'memories', total => 0, skip => 0 };
return if ($self->check_filter(section => 'memory'));
if (defined($self->{results}->{$oid_sc2MemoryModules}) && scalar(keys %{$self->{results}->{$oid_sc2MemoryModules}}) > 0) {
check_memory($self, entry => $oid_sc2MemoryModules, mapping => $mapping->{sc2}, name => 'sc2memModuleDesignation',
status => 'sc2memModuleStatus');
check_memory(
$self, entry => $oid_sc2MemoryModules, mapping => $mapping->{sc2}, name => 'sc2memModuleDesignation',
status => 'sc2memModuleStatus'
);
} else {
check_memory($self, entry => $mapping->{sc}->{memModuleStatus}, mapping => $mapping->{sc}, name => 'instance',
status => 'memModuleStatus');
check_memory(
$self, entry => $mapping->{sc}->{memModuleStatus}, mapping => $mapping->{sc}, name => 'instance',
status => 'memModuleStatus'
);
}
}
......
......@@ -26,19 +26,19 @@ use warnings;
my $map_psu_status = {
1 => 'unknown', 2 => 'not-present', 3 => 'ok', 4 => 'failed', 5 => 'ac-fail', 6 => 'dc-fail',
7 => 'critical-temperature', 8 => 'not-manageable', 9 => 'fan-failure-predicted', 10 => 'fan-failure',
11 => 'power-safe-mode', 12 => 'non-redundant-dc-fail', 13 => 'non-redundant-ac-fail',
11 => 'power-safe-mode', 12 => 'non-redundant-dc-fail', 13 => 'non-redundant-ac-fail'
};
my $mapping = {
sc => {
powerSupplyUnitStatus => { oid => '.1.3.6.1.4.1.231.2.10.2.2.5.11.2.1.3', map => $map_psu_status },
powerSupplyUnitDesignation => { oid => '.1.3.6.1.4.1.231.2.10.2.2.5.11.2.1.4' },
powerSupplyUnitDesignation => { oid => '.1.3.6.1.4.1.231.2.10.2.2.5.11.2.1.4' }
},
sc2 => {
sc2PowerSupplyDesignation => { oid => '.1.3.6.1.4.1.231.2.10.2.2.10.6.2.1.3' },
sc2PowerSupplyStatus => { oid => '.1.3.6.1.4.1.231.2.10.2.2.10.6.2.1.5', map => $map_psu_status },
sc2psPowerSupplyLoad => { oid => '.1.3.6.1.4.1.231.2.10.2.2.10.6.2.1.6' },
},
sc2psPowerSupplyLoad => { oid => '.1.3.6.1.4.1.231.2.10.2.2.10.6.2.1.6' }
}
};
my $oid_sc2PowerSupply = '.1.3.6.1.4.1.231.2.10.2.2.10.6.2.1';
my $oid_powerSupplyUnits = '.1.3.6.1.4.1.231.2.10.2.2.5.11.2.1';
......@@ -57,33 +57,39 @@ sub check_psu {
next if ($oid !~ /^$options{mapping}->{$options{status}}->{oid}\.(.*)$/);
my $instance = $1;
my $result = $self->{snmp}->map_instance(mapping => $options{mapping}, results => $self->{results}->{$options{entry}}, instance => $instance);
next if ($self->check_filter(section => 'psu', instance => $instance));
next if ($result->{$options{status}} =~ /not-present|not-available/i &&
$self->absent_problem(section => 'psu', instance => $instance));
$self->{components}->{psu}->{total}++;
$self->{output}->output_add(long_msg => sprintf("power supply '%s' status is '%s' [instance = %s] [value = %s]",
$result->{$options{name}}, $result->{$options{status}}, $instance, $result->{$options{current}}
));
$self->{output}->output_add(
long_msg => sprintf(
"power supply '%s' status is '%s' [instance: %s] [value: %s]",
$result->{$options{name}}, $result->{$options{status}}, $instance, $result->{$options{current}}
)
);
$exit = $self->get_severity(section => 'psu', value => $result->{$options{status}});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Power supply '%s' status is '%s'", $result->{$options{name}}, $result->{$options{status}}));
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf("Power supply '%s' status is '%s'", $result->{$options{name}}, $result->{$options{status}})
);
}
next if (!defined($result->{$options{current}}) || $result->{$options{current}} == 0);
($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'power', instance => $instance, value => $result->{$options{current}});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Power supply '%s' is %s W", $result->{$options{name}}, $result->{$options{current}}));
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf("Power supply '%s' is %s W", $result->{$options{name}}, $result->{$options{current}})
);
}
$self->{output}->perfdata_add(
label => 'power', unit => 'W',
nlabel => 'hardware.powersupply.power.watt',
unit => 'W',
instances => $result->{$options{name}},
value => $result->{$options{current}},
warning => $warn,
......@@ -96,16 +102,20 @@ sub check_psu {
sub check {
my ($self) = @_;
$self->{output}->output_add(long_msg => "Checking poer supplies");
$self->{components}->{psu} = {name => 'psus', total => 0, skip => 0};
$self->{output}->output_add(long_msg => 'Checking poer supplies');
$self->{components}->{psu} = { name => 'psus', total => 0, skip => 0 };
return if ($self->check_filter(section => 'psu'));
if (defined($self->{results}->{$oid_sc2PowerSupply}) && scalar(keys %{$self->{results}->{$oid_sc2PowerSupply}}) > 0) {
check_psu($self, entry => $oid_sc2PowerSupply, mapping => $mapping->{sc2}, name => 'sc2PowerSupplyDesignation',
current => 'sc2psPowerSupplyLoad', status => 'sc2PowerSupplyStatus');
check_psu(
$self, entry => $oid_sc2PowerSupply, mapping => $mapping->{sc2}, name => 'sc2PowerSupplyDesignation',
current => 'sc2psPowerSupplyLoad', status => 'sc2PowerSupplyStatus'
);
} else {
check_psu($self, entry => $oid_powerSupplyUnits, mapping => $mapping->{sc}, name => 'powerSupplyUnitDesignation',
status => 'powerSupplyUnitStatus');
check_psu(
$self, entry => $oid_powerSupplyUnits, mapping => $mapping->{sc}, name => 'powerSupplyUnitDesignation',
status => 'powerSupplyUnitStatus'
);
}
}
......
#
# Copyright 2021 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 hardware::server::fujitsu::snmp::mode::components::raid;
use strict;
use warnings;
my $map_raid_status = {
1 => 'unknown', 2 => 'online',
3 => 'degraded', 4 => 'offline',
5 => 'rebuilding', 6 => 'verifying',
7 => 'initializing', 8 => 'morphing',
9 => 'partialDegraded'
};
my $mapping = {
status => { oid => '.1.3.6.1.4.1.231.2.49.1.6.2.1.10', map => $map_raid_status }, # svrLogicalDriveStatus
name => { oid => '.1.3.6.1.4.1.231.2.49.1.6.2.1.11' } # svrLogicalDriveName
};
my $oid_ldrive_table = '.1.3.6.1.4.1.231.2.49.1.6.2'; # svrLogicalDriveTable
sub load {
my ($self) = @_;
push @{$self->{request}}, {
oid => $oid_ldrive_table,
start => $mapping->{status}->{oid},
end => $mapping->{name}->{oid}
};
}
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_ldrive_table }})) {
next if ($oid !~ /^$mapping->{status}->{oid}\.(\d+)\.(\d+)$/);
my $instance = $1 . '.' . $2;
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{ $oid_ldrive_table }, instance => $instance);
next if ($self->check_filter(section => 'disk', instance => $instance));
$self->{components}->{disk}->{total}++;
$self->{output}->output_add(
long_msg => sprintf(
"raid '%s' status is '%s' [instance: %s]",
$result->{name}, $result->{status}, $instance
)
);
my $exit = $self->get_severity(section => 'raid', value => $result->{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'", $result->{name}, $result->{status})
);
}
}
}
1;
......@@ -26,25 +26,25 @@ use warnings;
my $map_sc_temp_status = {
1 => 'unknown', 2 => 'sensor-disabled', 3 => 'ok', 4 => 'sensor-fail',
5 => 'warning-temp-warm', 6 => 'warning-temp-cold', 7 => 'critical-temp-warm',
8 => 'critical-temp-cold', 9 => 'damage-temp-warm', 10 => 'damage-temp-cold', 99 => 'not-available',
8 => 'critical-temp-cold', 9 => 'damage-temp-warm', 10 => 'damage-temp-cold', 99 => 'not-available'
};
my $map_sc2_temp_status = {
1 => 'unknown', 2 => 'not-available', 3 => 'ok', 4 => 'sensor-failed', 5 => 'failed',
6 => 'temperature-warning-toohot', 7 => 'temperature-critical-toohot', 8 => 'temperature-normal',
9 => 'temperature-warning',
9 => 'temperature-warning'
};