diff --git a/centreon/common/broadcom/megaraid/snmp/mode/components/alarm.pm b/centreon/common/broadcom/megaraid/snmp/mode/components/alarm.pm new file mode 100644 index 000000000..fd5a58e6b --- /dev/null +++ b/centreon/common/broadcom/megaraid/snmp/mode/components/alarm.pm @@ -0,0 +1,74 @@ +# +# Copyright 2018 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 centreon::common::broadcom::megaraid::snmp::mode::components::alarm; + +use strict; +use warnings; + +my %map_alarm_status = ( + 1 => 'status-invalid', 2 => 'status-ok', 3 => 'status-critical', 4 => 'status-nonCritical', + 5 => 'status-unrecoverable', 6 => 'status-not-installed', 7 => 'status-unknown', 8 => 'status-not-available' +); + +my $mapping = { + enclosureId_EAT => { oid => '.1.3.6.1.4.1.3582.4.1.5.7.1.2' }, + alarmStatus => { oid => '.1.3.6.1.4.1.3582.4.1.5.7.1.3', map => \%map_alarm_status }, +}; +my $oid_enclosureAlarmEntry= '.1.3.6.1.4.1.3582.4.1.5.7.1'; + +sub load { + my ($self) = @_; + + push @{$self->{requEAT}}, { oid => $oid_enclosureAlarmEntry, start => $mapping->{enclosureId_EAT}->{oid}, + end => $mapping->{alarmStatus}->{oid} }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking alarms"); + $self->{components}->{alarm} = {name => 'alarms', total => 0, skip => 0}; + return if ($self->check_filter(section => 'alarm')); + + my ($exit, $warn, $crit, $checked); + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_enclosureAlarmEntry}})) { + next if ($oid !~ /^$mapping->{alarmStatus}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_enclosureAlarmEntry}, instance => $instance); + + next if ($self->check_filter(section => 'alarm', instance => $instance)); + if ($result->{alarmStatus} =~ /status-not-installed/i) { + $self->absent_problem(section => 'alarm', instance => $instance); + next; + } + + $self->{components}->{alarm}->{total}++; + $self->{output}->output_add(long_msg => sprintf("Alarm '%s' status is '%s' [instance = %s, enclosure = %s]", + $instance, $result->{alarmStatus}, $instance, $result->{enclosureId_EAT})); + $exit = $self->get_severity(label => 'default', section => 'alarm', value => $result->{alarmStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Alarm '%s' status is '%s'", $instance, $result->{alarmStatus})); + } + } +} + +1; diff --git a/centreon/common/broadcom/megaraid/snmp/mode/components/fan.pm b/centreon/common/broadcom/megaraid/snmp/mode/components/fan.pm new file mode 100644 index 000000000..d0cb3230e --- /dev/null +++ b/centreon/common/broadcom/megaraid/snmp/mode/components/fan.pm @@ -0,0 +1,74 @@ +# +# Copyright 2018 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 centreon::common::broadcom::megaraid::snmp::mode::components::fan; + +use strict; +use warnings; + +my %map_fan_status = ( + 1 => 'status-invalid', 2 => 'status-ok', 3 => 'status-critical', 4 => 'status-nonCritical', + 5 => 'status-unrecoverable', 6 => 'status-not-installed', 7 => 'status-unknown', 8 => 'status-not-available' +); + +my $mapping = { + enclosureId => { oid => '.1.3.6.1.4.1.3582.4.1.5.3.1.2' }, + fanStatus => { oid => '.1.3.6.1.4.1.3582.4.1.5.3.1.3', map => \%map_fan_status }, +}; +my $oid_enclosureFanEntry = '.1.3.6.1.4.1.3582.4.1.5.3.1'; + +sub load { + my ($self) = @_; + + push @{$self->{request}}, { oid => $oid_enclosureFanEntry, start => $mapping->{enclosureId}->{oid}, + end => $mapping->{fanStatus}->{oid} }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking fans"); + $self->{components}->{fan} = {name => 'fan', total => 0, skip => 0}; + return if ($self->check_filter(section => 'fan')); + + my ($exit, $warn, $crit, $checked); + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_enclosureFanEntry}})) { + next if ($oid !~ /^$mapping->{fanStatus}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_enclosureFanEntry}, instance => $instance); + + next if ($self->check_filter(section => 'fan', instance => $instance)); + if ($result->{fanStatus} =~ /status-not-installed/i) { + $self->absent_problem(section => 'fan', instance => $instance); + next; + } + + $self->{components}->{fan}->{total}++; + $self->{output}->output_add(long_msg => sprintf("Fan '%s' status is '%s' [instance = %s, enclosure = %s]", + $instance, $result->{fanStatus}, $instance, $result->{enclosureId})); + $exit = $self->get_severity(label => 'default', section => 'fan', value => $result->{fanStatus}); + 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'", $instance, $result->{fanStatus})); + } + } +} + +1; diff --git a/centreon/common/broadcom/megaraid/snmp/mode/components/pdrive.pm b/centreon/common/broadcom/megaraid/snmp/mode/components/pdrive.pm new file mode 100644 index 000000000..70ff2345b --- /dev/null +++ b/centreon/common/broadcom/megaraid/snmp/mode/components/pdrive.pm @@ -0,0 +1,75 @@ +# +# Copyright 2018 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 centreon::common::broadcom::megaraid::snmp::mode::components::pdrive; + +use strict; +use warnings; + +my %map_pdrive_status = ( + 0 => 'unconfigured-good', 1 => 'unconfigured-bad', 2 => 'hot-spare', 16 => 'offline', + 17 => 'failed', 20 => 'rebuild', 24 => 'online', 32 => 'copyback', 64 => 'system', 128 => 'UNCONFIGURED-SHIELDED', + 130 => 'HOTSPARE-SHIELDED', 144 => 'CONFIGURED-SHIELDED' +); + +my $mapping = { + pdState => { oid => '.1.3.6.1.4.1.3582.4.1.4.2.1.2.1.10', map => \%map_pdrive_status }, + pdSerialNumber => { oid => '.1.3.6.1.4.1.3582.4.1.4.2.1.2.1.37' }, +}; +my $oid_virtualDriveEntry = '.1.3.6.1.4.1.3582.4.1.4.2.1.2.1'; + +sub load { + my ($self) = @_; + + push @{$self->{request}}, { oid => $oid_virtualDriveEntry, start => $mapping->{pdState}->{oid}, + end => $mapping->{pdSerialNumber}->{oid} }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking physical drives"); + $self->{components}->{pdrive} = {name => 'pdrives', total => 0, skip => 0}; + return if ($self->check_filter(section => 'pdrive')); + + my ($exit, $warn, $crit, $checked); + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_virtualDriveEntry}})) { + next if ($oid !~ /^$mapping->{pdState}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_virtualDriveEntry}, instance => $instance); + + next if ($self->check_filter(section => 'pdrive', instance => $instance)); + if ($result->{pdState} =~ /status-not-installed/i) { + $self->absent_problem(section => 'pdrive', instance => $instance); + next; + } + + $self->{components}->{pdrive}->{total}++; + $self->{output}->output_add(long_msg => sprintf("Physical drive '%s' status is '%s' [instance = %s, SN = %s]", + $instance, $result->{pdState}, $instance, $result->{pdSerialNumber})); + $exit = $self->get_severity(label => 'pdrive', section => 'pdrive', value => $result->{pdState}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Physical drive '%s' status is '%s'", $instance, $result->{pdState})); + } + } +} + +1; diff --git a/centreon/common/broadcom/megaraid/snmp/mode/components/psu.pm b/centreon/common/broadcom/megaraid/snmp/mode/components/psu.pm new file mode 100644 index 000000000..4aca68671 --- /dev/null +++ b/centreon/common/broadcom/megaraid/snmp/mode/components/psu.pm @@ -0,0 +1,74 @@ +# +# Copyright 2018 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 centreon::common::broadcom::megaraid::snmp::mode::components::psu; + +use strict; +use warnings; + +my %map_psu_status = ( + 1 => 'status-invalid', 2 => 'status-ok', 3 => 'status-critical', 4 => 'status-nonCritical', + 5 => 'status-unrecoverable', 6 => 'status-not-installed', 7 => 'status-unknown', 8 => 'status-not-available' +); + +my $mapping = { + enclosureId_EPST => { oid => '.1.3.6.1.4.1.3582.4.1.5.5.1.2' }, + powerSupplyStatus => { oid => '.1.3.6.1.4.1.3582.4.1.5.5.1.3', map => \%map_psu_status }, +}; +my $oid_enclosurePowerSupplyEntry = '.1.3.6.1.4.1.3582.4.1.5.5.1'; + +sub load { + my ($self) = @_; + + push @{$self->{request}}, { oid => $oid_enclosurePowerSupplyEntry, start => $mapping->{enclosureId_EPST}->{oid}, + end => $mapping->{powerSupplyStatus}->{oid} }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking power supplies"); + $self->{components}->{psu} = {name => 'psu', total => 0, skip => 0}; + return if ($self->check_filter(section => 'psu')); + + my ($exit, $warn, $crit, $checked); + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_enclosurePowerSupplyEntry}})) { + next if ($oid !~ /^$mapping->{powerSupplyStatus}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_enclosurePowerSupplyEntry}, instance => $instance); + + next if ($self->check_filter(section => 'psu', instance => $instance)); + if ($result->{powerSupplyStatus} =~ /status-not-installed/i) { + $self->absent_problem(section => 'psu', instance => $instance); + next; + } + + $self->{components}->{psu}->{total}++; + $self->{output}->output_add(long_msg => sprintf("Power supply '%s' status is '%s' [instance = %s, enclosure = %s]", + $instance, $result->{powerSupplyStatus}, $instance, $result->{enclosureId_EPST})); + $exit = $self->get_severity(label => 'default', section => 'psu', value => $result->{powerSupplyStatus}); + 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'", $instance, $result->{powerSupplyStatus})); + } + } +} + +1; diff --git a/centreon/common/broadcom/megaraid/snmp/mode/components/sim.pm b/centreon/common/broadcom/megaraid/snmp/mode/components/sim.pm new file mode 100644 index 000000000..a27f4e7f4 --- /dev/null +++ b/centreon/common/broadcom/megaraid/snmp/mode/components/sim.pm @@ -0,0 +1,74 @@ +# +# Copyright 2018 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 centreon::common::broadcom::megaraid::snmp::mode::components::sim; + +use strict; +use warnings; + +my %map_slot_status = ( + 1 => 'status-invalid', 2 => 'status-ok', 3 => 'status-critical', 4 => 'status-nonCritical', + 5 => 'status-unrecoverable', 6 => 'status-not-installed', 7 => 'status-unknown', 8 => 'status-not-available' +); + +my $mapping = { + enclosureId_ESIT => { oid => '.1.3.6.1.4.1.3582.4.1.5.8.1.2' }, + slotStatus => { oid => '.1.3.6.1.4.1.3582.4.1.5.8.1.3', map => \%map_slot_status }, +}; +my $oid_enclosureSIMEntry = '.1.3.6.1.4.1.3582.4.1.5.8.1'; + +sub load { + my ($self) = @_; + + push @{$self->{request}}, { oid => $oid_enclosureSIMEntry, start => $mapping->{enclosureId_ESIT}->{oid}, + end => $mapping->{slotStatus}->{oid} }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking SIMs"); + $self->{components}->{sim} = {name => 'sims', total => 0, skip => 0}; + return if ($self->check_filter(section => 'sim')); + + my ($exit, $warn, $crit, $checked); + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_enclosureSIMEntry}})) { + next if ($oid !~ /^$mapping->{slotStatus}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_enclosureSIMEntry}, instance => $instance); + + next if ($self->check_filter(section => 'sim', instance => $instance)); + if ($result->{slotStatus} =~ /status-not-installed/i) { + $self->absent_problem(section => 'sim', instance => $instance); + next; + } + + $self->{components}->{sim}->{total}++; + $self->{output}->output_add(long_msg => sprintf("Sim '%s' status is '%s' [instance = %s, enclosure = %s]", + $instance, $result->{slotStatus}, $instance, $result->{enclosureId_ESIT})); + $exit = $self->get_severity(label => 'default', section => 'sim', value => $result->{slotStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Sim '%s' status is '%s'", $instance, $result->{slotStatus})); + } + } +} + +1; diff --git a/centreon/common/broadcom/megaraid/snmp/mode/components/slot.pm b/centreon/common/broadcom/megaraid/snmp/mode/components/slot.pm new file mode 100644 index 000000000..2ac5183be --- /dev/null +++ b/centreon/common/broadcom/megaraid/snmp/mode/components/slot.pm @@ -0,0 +1,74 @@ +# +# Copyright 2018 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 centreon::common::broadcom::megaraid::snmp::mode::components::slot; + +use strict; +use warnings; + +my %map_slot_status = ( + 1 => 'status-invalid', 2 => 'status-ok', 3 => 'status-critical', 4 => 'status-nonCritical', + 5 => 'status-unrecoverable', 6 => 'status-not-installed', 7 => 'status-unknown', 8 => 'status-not-available' +); + +my $mapping = { + enclosureId_EST => { oid => '.1.3.6.1.4.1.3582.4.1.5.4.1.2' }, + slotStatus => { oid => '.1.3.6.1.4.1.3582.4.1.5.4.1.3', map => \%map_slot_status }, +}; +my $oid_enclosureSlotEntry = '.1.3.6.1.4.1.3582.4.1.5.4.1'; + +sub load { + my ($self) = @_; + + push @{$self->{request}}, { oid => $oid_enclosureSlotEntry, start => $mapping->{enclosureId_EST}->{oid}, + end => $mapping->{slotStatus}->{oid} }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking slots"); + $self->{components}->{slot} = {name => 'slots', total => 0, skip => 0}; + return if ($self->check_filter(section => 'slot')); + + my ($exit, $warn, $crit, $checked); + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_enclosureSlotEntry}})) { + next if ($oid !~ /^$mapping->{slotStatus}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_enclosureSlotEntry}, instance => $instance); + + next if ($self->check_filter(section => 'slot', instance => $instance)); + if ($result->{slotStatus} =~ /status-not-installed/i) { + $self->absent_problem(section => 'slot', instance => $instance); + next; + } + + $self->{components}->{slot}->{total}++; + $self->{output}->output_add(long_msg => sprintf("Slot '%s' status is '%s' [instance = %s, enclosure = %s]", + $instance, $result->{slotStatus}, $instance, $result->{enclosureId_EST})); + $exit = $self->get_severity(label => 'default', section => 'slot', value => $result->{slotStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Slot '%s' status is '%s'", $instance, $result->{slotStatus})); + } + } +} + +1; diff --git a/centreon/common/broadcom/megaraid/snmp/mode/components/temperature.pm b/centreon/common/broadcom/megaraid/snmp/mode/components/temperature.pm new file mode 100644 index 000000000..95b3c02f7 --- /dev/null +++ b/centreon/common/broadcom/megaraid/snmp/mode/components/temperature.pm @@ -0,0 +1,89 @@ +# +# Copyright 2018 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 centreon::common::broadcom::megaraid::snmp::mode::components::temperature; + +use strict; +use warnings; + +my %map_temp_status = ( + 1 => 'status-invalid', 2 => 'status-ok', 3 => 'status-critical', 4 => 'status-nonCritical', + 5 => 'status-unrecoverable', 6 => 'status-not-installed', 7 => 'status-unknown', 8 => 'status-not-available' +); + +my $mapping = { + enclosureId_ETST => { oid => '.1.3.6.1.4.1.3582.4.1.5.6.1.2' }, + tempSensorStatus => { oid => '.1.3.6.1.4.1.3582.4.1.5.6.1.3', map => \%map_temp_status }, + enclosureTemperature => { oid => '.1.3.6.1.4.1.3582.4.1.5.6.1.4' }, +}; +my $oid_enclosureTempSensorEntry = '.1.3.6.1.4.1.3582.4.1.5.6.1'; + +sub load { + my ($self) = @_; + + push @{$self->{request}}, { oid => $oid_enclosureTempSensorEntry, start => $mapping->{enclosureId_ETST}->{oid}, + end => $mapping->{enclosureTemperature}->{oid} }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking temperatures"); + $self->{components}->{temperature} = {name => 'temperatures', total => 0, skip => 0}; + return if ($self->check_filter(section => 'temperature')); + + my ($exit, $warn, $crit, $checked); + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_enclosureTempSensorEntry}})) { + next if ($oid !~ /^$mapping->{tempSensorStatus}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_enclosureTempSensorEntry}, instance => $instance); + + next if ($self->check_filter(section => 'temperature', instance => $instance)); + if ($result->{tempSensorStatus} =~ /status-not-installed/i) { + $self->absent_problem(section => 'temperature', instance => $instance); + next; + } + + $self->{components}->{temperature}->{total}++; + $self->{output}->output_add(long_msg => sprintf("Temperature '%s' status is '%s' [instance = %s, enclosure = %s, temperature = %s C]", + $instance, $result->{tempSensorStatus}, $instance, $result->{enclosureId_ETST}, + defined($result->{enclosureTemperature}) ? $result->{enclosureTemperature} : 'unknown')); + $exit = $self->get_severity(section => 'default', value => $result->{tempSensorStatus}); + 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->{tempSensorStatus})); + } + + next if (!defined($result->{enclosureTemperature}) || $result->{enclosureTemperature} !~ /[0-9]+/); + + ($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'temperature', instance => $instance, value => $result->{enclosureTemperature}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Temperature '%s' is '%s' C", $instance, $result->{enclosureTemperature})); + } + $self->{output}->perfdata_add(label => 'temp_' . $instance, unit => 'C', + value => $result->{enclosureTemperature}, + warning => $warn, + critical => $crit, + ); + } +} + +1; diff --git a/centreon/common/broadcom/megaraid/snmp/mode/components/vdrive.pm b/centreon/common/broadcom/megaraid/snmp/mode/components/vdrive.pm new file mode 100644 index 000000000..50deeff79 --- /dev/null +++ b/centreon/common/broadcom/megaraid/snmp/mode/components/vdrive.pm @@ -0,0 +1,73 @@ +# +# Copyright 2018 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 centreon::common::broadcom::megaraid::snmp::mode::components::vdrive; + +use strict; +use warnings; + +my %map_vdrive_status = ( + 0 => 'offline', 1 => 'partially-degraded', 2 => 'degraded', 3 => 'optimal' +); + +my $mapping = { + state => { oid => '.1.3.6.1.4.1.3582.4.1.4.3.1.2.1.5', map => \%map_vdrive_status }, + name => { oid => '.1.3.6.1.4.1.3582.4.1.4.3.1.2.1.6' }, +}; +my $oid_virtualDriveEntry = '.1.3.6.1.4.1.3582.4.1.4.3.1.2.1'; + +sub load { + my ($self) = @_; + + push @{$self->{request}}, { oid => $oid_virtualDriveEntry, start => $mapping->{state}->{oid}, + end => $mapping->{name}->{oid} }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking virtual drives"); + $self->{components}->{vdrive} = {name => 'vdrives', total => 0, skip => 0}; + return if ($self->check_filter(section => 'vdrive')); + + my ($exit, $warn, $crit, $checked); + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_virtualDriveEntry}})) { + next if ($oid !~ /^$mapping->{state}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_virtualDriveEntry}, instance => $instance); + + next if ($self->check_filter(section => 'vdrive', instance => $instance)); + if ($result->{state} =~ /status-not-installed/i) { + $self->absent_problem(section => 'vdrive', instance => $instance); + next; + } + + $self->{components}->{vdrive}->{total}++; + $self->{output}->output_add(long_msg => sprintf("Virtual drive '%s' status is '%s' [instance = %s, name = %s]", + $instance, $result->{state}, $instance, $result->{name})); + $exit = $self->get_severity(label => 'vdrive', section => 'vdrive', value => $result->{state}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Virtual drive '%s' status is '%s'", $instance, $result->{state})); + } + } +} + +1; diff --git a/centreon/common/broadcom/megaraid/snmp/mode/hardware.pm b/centreon/common/broadcom/megaraid/snmp/mode/hardware.pm new file mode 100644 index 000000000..9797963ac --- /dev/null +++ b/centreon/common/broadcom/megaraid/snmp/mode/hardware.pm @@ -0,0 +1,142 @@ +# +# Copyright 2018 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 centreon::common::broadcom::megaraid::snmp::mode::hardware; + +use base qw(centreon::plugins::templates::hardware); + +use strict; +use warnings; + +sub set_system { + my ($self, %options) = @_; + + $self->{regexp_threshold_overload_check_section_option} = '^(alarm|fan|sim|slot|psu|temprature|pdrive|vdrive)$'; + $self->{regexp_threshold_numeric_check_section_option} = '^(temperature)$'; + + $self->{cb_hook2} = 'snmp_execute'; + + $self->{thresholds} = { + default => [ + ['status-invalid', 'CRITICAL'], + ['status-ok', 'OK'], + ['status-critical', 'CRITICAL'], + ['status-nonCritical', 'WARNING'], + ['status-unrecoverable', 'CRITICAL'], + ['status-not-installed', 'OK'], + ['status-unknown', 'UNKNOWN'], + ['status-not-available', 'WARNING'], + ], + vdrive => [ + ['offline', 'UNKNOWN'], + ['partially-degraded', 'WARNING'], + ['degraded', 'CRITICAL'], + ['optimal', 'OK'], + ], + pdrive => [ + ['unconfigured-good', 'OK'], + ['unconfigured-bad', 'CRITICAL'], + ['hot-spare', 'OK'], + ['offline', 'UNKNOWN'], + ['failed', 'CRITICAL'], + ['rebuild', 'OK'], + ['online', 'OK'], + ['copyback', 'OK'], + ['system', 'OK'], + ['UNCONFIGURED-SHIELDED', 'UNKNOWN'], + ['HOTSPARE-SHIELDED', 'UNKNOWN'], + ['CONFIGURED-SHIELDED', 'UNKNOWN'], + ], + }; + + $self->{components_path} = 'centreon::common::broadcom::megaraid::snmp::mode::components'; + $self->{components_module} = ['alarm', 'fan', 'sim', 'slot', 'psu', 'temperature', 'pdrive', 'vdrive']; +} + +sub snmp_execute { + my ($self, %options) = @_; + + $self->{snmp} = $options{snmp}; + $self->{results} = $self->{snmp}->get_multiple_table(oids => $self->{request}); +} + +sub new { + my ($class, %options) = @_; + my $self = $class->SUPER::new(package => __PACKAGE__, %options); + bless $self, $class; + + $self->{version} = '1.0'; + $options{options}->add_options(arguments => + { + }); + + return $self; +} + +1; + +__END__ + +=head1 MODE + +Check hardware (LSI-MegaRAID-SAS-MIB). + +=over 8 + +=item B<--component> + +Which component to check (Default: '.*'). +Can be: 'alarm', 'fan', 'sim', 'slot', 'psu', +'temperature', 'pdrive', 'vdrive'. + +=item B<--filter> + +Exclude some parts (comma seperated list) (Example: --filter=fan --filter=psu) +Can also exclude specific instance: --filter=fan,3 + +=item B<--absent-problem> + +Return an error if an entity is not 'present' (default is skipping) (comma seperated list) +Can be specific or global: --absent-problem=fan,1 + +=item B<--no-component> + +Return an error if no compenents are checked. +If total (with skipped) is 0. (Default: 'critical' returns). + +=item B<--threshold-overload> + +Set to overload default threshold values (syntax: section,[instance,]status,regexp) +It used before default thresholds (order stays). +Example: --threshold-overload='psu,OK,^(?!(status-unrecoverable)$)' + +=item B<--warning> + +Set warning threshold for 'temperature' (syntax: type,regexp,threshold) +Example: --warning='temperature,.*,40' + +=item B<--critical> + +Set critical threshold for 'temperature' (syntax: type,regexp,threshold) +Example: --critical='temperature,.*,50' + +=back + +=cut diff --git a/storage/avid/isis/snmp/plugin.pm b/storage/avid/isis/snmp/plugin.pm index 0deb104d4..e6825ba1f 100644 --- a/storage/avid/isis/snmp/plugin.pm +++ b/storage/avid/isis/snmp/plugin.pm @@ -32,6 +32,7 @@ sub new { $self->{version} = '0.1'; %{$self->{modes}} = ( + 'hardware' => 'centreon::common::broadcom::megaraid::snmp::mode::hardware', 'performance' => 'storage::avid::isis::snmp::mode::performance', 'status' => 'storage::avid::isis::snmp::mode::status', 'usage' => 'storage::avid::isis::snmp::mode::usage', @@ -46,6 +47,8 @@ __END__ =head1 PLUGIN DESCRIPTION -Check Avid ISIS storage (5xxx, 7xxx) through SNMP +Check Avid ISIS storage (5xxx, 7xxx) through SNMP. + +Mode 'hardware' will work if storage is managed by LSI/Broadcom MegaRAID card. =cut