diff --git a/centreon-plugins/hardware/server/ibm/bladecenter/snmp/mode/components/ambient.pm b/centreon-plugins/hardware/server/ibm/bladecenter/snmp/mode/components/ambient.pm index d30d61822..6725026a0 100644 --- a/centreon-plugins/hardware/server/ibm/bladecenter/snmp/mode/components/ambient.pm +++ b/centreon-plugins/hardware/server/ibm/bladecenter/snmp/mode/components/ambient.pm @@ -23,18 +23,26 @@ package hardware::server::ibm::bladecenter::snmp::mode::components::ambient; use strict; use warnings; -# In MIB 'mmblade.mib' + my $oid_temperature = '.1.3.6.1.4.1.2.3.51.2.2.1'; +my $oid_end = '.1.3.6.1.4.1.2.3.51.2.2.1.5'; +my $oid_rearLEDCardTempMax = '.1.3.6.1.4.1.2.3.51.2.2.1.5.3.0'; +# In MIB 'mmblade.mib' and 'cme.mib' my $oids = { - mm => '.1.3.6.1.4.1.2.3.51.2.2.1.1.2.0', - frontpanel => '.1.3.6.1.4.1.2.3.51.2.2.1.5.1.0', - frontpanel2 => '.1.3.6.1.4.1.2.3.51.2.2.1.5.2.0', + bladecenter => { + mm => '.1.3.6.1.4.1.2.3.51.2.2.1.1.2.0', + frontpanel => '.1.3.6.1.4.1.2.3.51.2.2.1.5.1.0', + frontpanel2 => '.1.3.6.1.4.1.2.3.51.2.2.1.5.2.0', + }, + pureflex => { + ambient => '.1.3.6.1.4.1.2.3.51.2.2.1.5.1.0', # rearLEDCardTempAvg + } }; sub load { my (%options) = @_; - push @{$options{request}}, { oid => $oid_temperature }; + push @{$options{request}}, { oid => $oid_temperature, end => $oid_end }; } sub check { @@ -44,9 +52,16 @@ sub check { $self->{components}->{ambient} = {name => 'ambient', total => 0, skip => 0}; return if ($self->check_exclude(section => 'ambient')); - foreach my $temp (('mm', 'frontpanel', 'frontpanel2')) { - if (!defined($self->{results}->{$oid_temperature}->{$oids->{$temp}}) || - $self->{results}->{$oid_temperature}->{$oids->{$temp}} !~ /([0-9\.]+)/) { + my @sensors = ('mm', 'frontpanel', 'frontpanel2'); + my $label = 'bladecenter'; + if (defined()) { + @sensors = ('ambient'); + $label = 'pureflex'; + } + + foreach my $temp (@values) { + if (!defined($self->{results}->{$oid_temperature}->{$oids->{$label}->{$temp}}) || + $self->{results}->{$oid_temperature}->{$oids->{$label}->{$temp}} !~ /([0-9\.]+)/) { $self->{output}->output_add(long_msg => sprintf("skip ambient '%s': no values", $temp)); next; diff --git a/centreon-plugins/hardware/server/ibm/bladecenter/snmp/mode/components/blade.pm b/centreon-plugins/hardware/server/ibm/bladecenter/snmp/mode/components/blade.pm index ee0b5e5c6..db7fc2399 100644 --- a/centreon-plugins/hardware/server/ibm/bladecenter/snmp/mode/components/blade.pm +++ b/centreon-plugins/hardware/server/ibm/bladecenter/snmp/mode/components/blade.pm @@ -48,7 +48,7 @@ my %map_blade_power_state = ( 4 => 'hibernate', ); -# In MIB 'CPQSTDEQ-MIB.mib' +# In MIB 'mmblade.mib' and 'cme.mib' my $mapping = { bladeId => { oid => '.1.3.6.1.4.1.2.3.51.2.22.1.5.1.1.2' }, bladeExists => { oid => '.1.3.6.1.4.1.2.3.51.2.22.1.5.1.1.3', map => \%map_blade_exists }, diff --git a/centreon-plugins/hardware/server/ibm/bladecenter/snmp/mode/components/chassisfan.pm b/centreon-plugins/hardware/server/ibm/bladecenter/snmp/mode/components/chassisfan.pm new file mode 100644 index 000000000..c92ddd188 --- /dev/null +++ b/centreon-plugins/hardware/server/ibm/bladecenter/snmp/mode/components/chassisfan.pm @@ -0,0 +1,86 @@ +# +# Copyright 2015 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::ibm::bladecenter::snmp::mode::components::chassisfan; + +use strict; +use warnings; + +my %map_state = ( + 0 => 'unknown', + 1 => 'good', + 2 => 'warning', + 3 => 'bad', +); + +# In MIB 'mmblade.mib' and 'cme.mib' +my $mapping = { + chassisFanState => { oid => '.1.3.6.1.4.1.2.3.51.2.2.3.50.1.4', map => \%map_state }, + chassisFanSpeedRPM => { oid => '.1.3.6.1.4.1.2.3.51.2.2.3.50.1.5' }, +}; +my $oid_chassisFansEntry = '.1.3.6.1.4.1.2.3.51.2.2.3.50.1'; + +sub load { + my (%options) = @_; + + push @{$options{request}}, { oid => $oid_chassisFansEntry }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking chassis fan"); + $self->{components}->{chassisfan} = {name => 'chassis fan', total => 0, skip => 0}; + return if ($self->check_exclude(section => 'chassisfan')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_chassisFansEntry}})) { + next if ($oid !~ /^$mapping->{chassisFanState}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_chassisFansEntry}, instance => $instance); + + next if ($self->check_exclude(section => 'chassisfan', instance => $instance)); + $self->{components}->{chassisfan}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("Chassis fan '%s' is %d rpm [status: %s, instance: %s]", + $instance, $result->{fanPackAverageSpeedRPM}, $result->{chassisFanState}, + $instance)); + my $exit = $self->get_severity(section => 'chassisfan', value => $result->{chassisFanState}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Chassis fan '%s' status is %s", + $instance, $result->{chassisFanState})); + } + + if (defined($result->{chassisFanSpeedRPM}) && $result->{chassisFanSpeedRPM} =~ /[0-9]/) { + my ($exit2, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'chassisfan', instance => $instance, value => $result->{chassisFanSpeedRPM}); + if (!$self->{output}->is_status(value => $exit2, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit2, + short_msg => sprintf("Chassis fan '%s' speed is %s rpm", $instance, $result->{chassisFanSpeedRPM})); + } + $self->{output}->perfdata_add(label => "chassisfan_" . $instance, unit => 'rpm', + value => $result->{chassisFanSpeedRPM}, + warning => $warn, + critical => $crit, + min => 0); + } + } +} + +1; \ No newline at end of file diff --git a/centreon-plugins/hardware/server/ibm/bladecenter/snmp/mode/components/chassisstatus.pm b/centreon-plugins/hardware/server/ibm/bladecenter/snmp/mode/components/chassisstatus.pm index 3a2537aae..db8b4a56a 100644 --- a/centreon-plugins/hardware/server/ibm/bladecenter/snmp/mode/components/chassisstatus.pm +++ b/centreon-plugins/hardware/server/ibm/bladecenter/snmp/mode/components/chassisstatus.pm @@ -23,7 +23,7 @@ package hardware::server::ibm::bladecenter::snmp::mode::components::chassisstatu use strict; use warnings; -# In MIB 'mmblade.mib' +# In MIB 'mmblade.mib' and 'cme.mib' my $oid_mmBistAndChassisStatus = '.1.3.6.1.4.1.2.3.51.2.2.5.2'; my $oid_bistLogicalNetworkLink = '.1.3.6.1.4.1.2.3.51.2.2.5.2.30.0'; my $oids = { diff --git a/centreon-plugins/hardware/server/ibm/bladecenter/snmp/mode/components/fanpack.pm b/centreon-plugins/hardware/server/ibm/bladecenter/snmp/mode/components/fanpack.pm new file mode 100644 index 000000000..6f6b075ff --- /dev/null +++ b/centreon-plugins/hardware/server/ibm/bladecenter/snmp/mode/components/fanpack.pm @@ -0,0 +1,91 @@ +# +# Copyright 2015 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::ibm::bladecenter::snmp::mode::components::fanpack; + +use strict; +use warnings; + +my %map_state = ( + 0 => 'unknown', + 1 => 'good', + 2 => 'warning', + 3 => 'bad', +); + +# In MIB 'mmblade.mib' and 'cme.mib' +my $mapping = { + fanPackExists => { oid => '.1.3.6.1.4.1.2.3.51.2.2.6.1.1.2' }, + fanPackState => { oid => '.1.3.6.1.4.1.2.3.51.2.2.6.1.1.3', map => \%map_state }, + fanPackAverageSpeedRPM => { oid => '.1.3.6.1.4.1.2.3.51.2.2.6.1.1.6' }, +}; +my $oid_fanPackEntry = '.1.3.6.1.4.1.2.3.51.2.2.6.1.1'; + +sub load { + my (%options) = @_; + + push @{$options{request}}, { oid => $oid_fanPackEntry }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking fanpack"); + $self->{components}->{fanpack} = {name => 'fanpacks', total => 0, skip => 0}; + return if ($self->check_exclude(section => 'fanpack')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_fanPackEntry}})) { + next if ($oid !~ /^$mapping->{fanPackState}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_fanPackEntry}, instance => $instance); + + if ($result->{fanPackExists} == 1) { + $self->{output}->output_add(long_msg => "skipping fanpack '" . $instance . "' : not exits"); + next; + } + next if ($self->check_exclude(section => 'fanpack', instance => $instance)); + $self->{components}->{fanpack}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("Fanpack '%s' is %d rpm [status: %s, instance: %s]", + $instance, $result->{fanPackAverageSpeedRPM}, $result->{fanPackState}, + $instance)); + my $exit = $self->get_severity(section => 'fanpack', value => $result->{fanPackState}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Fanpack '%s' status is %s", + $instance, $result->{fanPackState})); + } + + if (defined($result->{fanPackAverageSpeedRPM}) && $result->{fanPackAverageSpeedRPM} =~ /[0-9]/) { + my ($exit2, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'fanpack', instance => $instance, value => $result->{fanPackAverageSpeedRPM}); + if (!$self->{output}->is_status(value => $exit2, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit2, + short_msg => sprintf("Fanpack '%s' speed is %s rpm", $instance, $result->{fanPackAverageSpeedRPM})); + } + $self->{output}->perfdata_add(label => "fanpack_" . $instance, unit => 'rpm', + value => $result->{fanPackAverageSpeedRPM}, + warning => $warn, + critical => $crit, + min => 0); + } + } +} + +1; \ No newline at end of file diff --git a/centreon-plugins/hardware/server/ibm/bladecenter/snmp/mode/components/powermodule.pm b/centreon-plugins/hardware/server/ibm/bladecenter/snmp/mode/components/powermodule.pm index 577608191..dd4fd6135 100644 --- a/centreon-plugins/hardware/server/ibm/bladecenter/snmp/mode/components/powermodule.pm +++ b/centreon-plugins/hardware/server/ibm/bladecenter/snmp/mode/components/powermodule.pm @@ -35,7 +35,7 @@ my %map_pw_exists = ( 1 => 'true', ); -# In MIB 'CPQSTDEQ-MIB.mib' +# In MIB 'mmblade.mib' and 'cme.mib' my $mapping = { powerModuleExists => { oid => '.1.3.6.1.4.1.2.3.51.2.2.4.1.1.2', map => \%map_pw_exists }, powerModuleState => { oid => '.1.3.6.1.4.1.2.3.51.2.2.4.1.1.3', map => \%map_pw_state }, diff --git a/centreon-plugins/hardware/server/ibm/bladecenter/snmp/mode/components/switchmodule.pm b/centreon-plugins/hardware/server/ibm/bladecenter/snmp/mode/components/switchmodule.pm new file mode 100644 index 000000000..d48dac789 --- /dev/null +++ b/centreon-plugins/hardware/server/ibm/bladecenter/snmp/mode/components/switchmodule.pm @@ -0,0 +1,70 @@ +# +# Copyright 2015 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::ibm::bladecenter::snmp::mode::components::switchmodule; + +use strict; +use warnings; + +my %map_state = ( + 0 => 'unknown', + 1 => 'good', + 2 => 'warning', + 3 => 'bad', +); + +# In MIB 'mmblade.mib' and 'cme.mib' +my $mapping = { + smHealthState => { oid => '.1.3.6.1.4.1.2.3.51.2.22.3.1.1.1.15', map => \%map_state }, +}; + +sub load { + my (%options) = @_; + + push @{$options{request}}, { oid => $mapping->{smHealthState}->{oid} }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking switch module"); + $self->{components}->{switchmodule} = {name => 'switch modules', total => 0, skip => 0}; + return if ($self->check_exclude(section => 'switchmodule')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$mapping->{smHealthState}->{oid}}})) { + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$mapping->{smHealthState}->{oid}}, instance => $instance); + + next if ($self->check_exclude(section => 'switchmodule', instance => $instance)); + $self->{components}->{switchmodule}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("Switch module '%s' status is %s [instance: %s]", + $instance, $result->{smHealthState}, + $instance)); + my $exit = $self->get_severity(section => 'switchmodule', value => $result->{smHealthState}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Switch module '%s' status is %s", + $instance, $result->{smHealthState})); + } + } +} + +1; \ No newline at end of file diff --git a/centreon-plugins/hardware/server/ibm/bladecenter/snmp/mode/components/systemhealth.pm b/centreon-plugins/hardware/server/ibm/bladecenter/snmp/mode/components/systemhealth.pm index 88097db74..4f4958292 100644 --- a/centreon-plugins/hardware/server/ibm/bladecenter/snmp/mode/components/systemhealth.pm +++ b/centreon-plugins/hardware/server/ibm/bladecenter/snmp/mode/components/systemhealth.pm @@ -23,7 +23,7 @@ package hardware::server::ibm::bladecenter::snmp::mode::components::systemhealth use strict; use warnings; -# In MIB 'mmblade.mib' +# In MIB 'mmblade.mib' and 'cme.mib' my $oid_systemHealthStat = '.1.3.6.1.4.1.2.3.51.2.2.7.1'; my %map_systemhealth_state = ( diff --git a/centreon-plugins/hardware/server/ibm/bladecenter/snmp/mode/hardware.pm b/centreon-plugins/hardware/server/ibm/bladecenter/snmp/mode/hardware.pm index 8faa14976..1d939c6e7 100644 --- a/centreon-plugins/hardware/server/ibm/bladecenter/snmp/mode/hardware.pm +++ b/centreon-plugins/hardware/server/ibm/bladecenter/snmp/mode/hardware.pm @@ -42,12 +42,30 @@ my $thresholds = { ['warning', 'WARNING'], ['notAvailable', 'UNKNOWN'], ], - blower => [ + fanpack => [ + ['unknown', 'UNKNOWN'], + ['good', 'OK'], + ['warning', 'WARNING'], + ['bad', 'CRITICAL'], + ], + chassisfan => [ ['unknown', 'UNKNOWN'], ['good', 'OK'], ['warning', 'WARNING'], ['bad', 'CRITICAL'], ], + blower => [ + ['unknown', 'UNKNOWN'], + ['good', 'OK'], + ['warning', 'WARNING'], + ['bad', 'CRITICAL'], + ], + switchmodule => [ + ['unknown', 'UNKNOWN'], + ['good', 'OK'], + ['warning', 'WARNING'], + ['bad', 'CRITICAL'], + ], blowerctrl => [ ['unknown', 'UNKNOWN'], ['operational', 'OK'], @@ -132,8 +150,8 @@ sub check_options { $self->{output}->option_exit(); } my ($section, $regexp, $value) = ($1, $2, $3); - if ($section !~ /(blower|ambient)/) { - $self->{output}->add_option_msg(short_msg => "Wrong $option option '" . $val . "' (type must be: blower or ambient)."); + if ($section !~ /(blower|ambient|fanpack|chassisfan)/) { + $self->{output}->add_option_msg(short_msg => "Wrong $option option '" . $val . "' (type must be: blower, fanpack, chassisfan or ambient)."); $self->{output}->option_exit(); } my $position = 0; @@ -156,7 +174,7 @@ sub run { $self->{snmp} = $options{snmp}; my $snmp_request = []; - my @components = ('ambient', 'powermodule', 'blade', 'blower', 'systemhealth', 'chassisstatus'); + my @components = ('ambient', 'powermodule', 'blade', 'blower', 'fanpack', 'chassisfan', 'systemhealth', 'chassisstatus', 'switchmodule'); foreach (@components) { if (/$self->{option_results}->{component}/) { my $mod_name = "hardware::server::ibm::bladecenter::snmp::mode::components::$_"; @@ -289,14 +307,15 @@ __END__ =head1 MODE -Check Hardware (Ambient temperatures, Blowers, Power modules, Blades, System Health, Chassis status). +Check Hardware (Ambient temperatures, Blowers, Power modules, Blades, System Health, Chassis status, Fanpack). =over 8 =item B<--component> Which component to check (Default: 'all'). -Can be: 'ambient', 'powermodule', 'blower', 'blade', 'systemhealth', 'chassisstatus'. +Can be: 'ambient', 'powermodule', 'fanpack', 'chassisfan', +'blower', 'blade', 'systemhealth', 'chassisstatus', 'switchmodule'. =item B<--exclude> diff --git a/centreon-plugins/hardware/server/ibm/bladecenter/snmp/plugin.pm b/centreon-plugins/hardware/server/ibm/bladecenter/snmp/plugin.pm index 324ec3c75..0842efad6 100644 --- a/centreon-plugins/hardware/server/ibm/bladecenter/snmp/plugin.pm +++ b/centreon-plugins/hardware/server/ibm/bladecenter/snmp/plugin.pm @@ -44,6 +44,6 @@ __END__ =head1 PLUGIN DESCRIPTION -Check IBM Chassis BladeCenter (H, HT, T) in SNMP. +Check IBM Chassis BladeCenter (H, HT, T, Pureflex) in SNMP. =cut