diff --git a/storage/emc/clariion/TODO b/storage/emc/clariion/TODO index 50716351f..f4978fc54 100644 --- a/storage/emc/clariion/TODO +++ b/storage/emc/clariion/TODO @@ -39,143 +39,6 @@ LUN Capacity(Blocks): 1442538624 Prct Rebuilt: N/A Prct Bound: 100 -====================== -Mode pour l'etat du SP -====================== - -La commande: getcrus -SPE3 Enclosure SPE -SP A State: Present -SP B State: Present -Enclosure SPE Power A0 State: Present -Enclosure SPE Power A1 State: Present -Enclosure SPE Power B0 State: Present -Enclosure SPE Power B1 State: Present -Enclosure SPE SPS A State: Present -Enclosure SPE SPS B State: Present -Enclosure SPE SPS A Cabling State: Valid -Enclosure SPE SPS B Cabling State: Valid - -DAE3P Bus 0 Enclosure 0 -Bus 0 Enclosure 0 Fan A State: Present -Bus 0 Enclosure 0 Fan B State: Present -Bus 0 Enclosure 0 Power A State: Present -Bus 0 Enclosure 0 Power B State: Present -Bus 0 Enclosure 0 LCC A State: Present -Bus 0 Enclosure 0 LCC B State: Present -Bus 0 Enclosure 0 LCC A Revision: 7.85 -Bus 0 Enclosure 0 LCC B Revision: 7.85 -Bus 0 Enclosure 0 LCC A Serial #: FCNBD073833259 -Bus 0 Enclosure 0 LCC B Serial #: FCNBD073621646 - -DAE3P Bus 1 Enclosure 0 -Bus 1 Enclosure 0 Fan A State: Present -Bus 1 Enclosure 0 Fan B State: Present -Bus 1 Enclosure 0 Power A State: Present -Bus 1 Enclosure 0 Power B State: Present -Bus 1 Enclosure 0 LCC A State: Present -Bus 1 Enclosure 0 LCC B State: Present -Bus 1 Enclosure 0 LCC A Revision: 7.85 -Bus 1 Enclosure 0 LCC B Revision: 7.85 -Bus 1 Enclosure 0 LCC A Serial #: JAHSL074355703 -Bus 1 Enclosure 0 LCC B Serial #: JAHSL074355754 - -DAE3P Bus 0 Enclosure 1 -Bus 0 Enclosure 1 Fan A State: Present -Bus 0 Enclosure 1 Fan B State: Present -Bus 0 Enclosure 1 Power A State: Present -Bus 0 Enclosure 1 Power B State: Present -Bus 0 Enclosure 1 LCC A State: Present -Bus 0 Enclosure 1 LCC B State: Present -Bus 0 Enclosure 1 LCC A Revision: 7.85 -Bus 0 Enclosure 1 LCC B Revision: 7.85 -Bus 0 Enclosure 1 LCC A Serial #: JAHDL084257760 -Bus 0 Enclosure 1 LCC B Serial #: JAHDL084156218 - -DAE3P Bus 1 Enclosure 1 -Bus 1 Enclosure 1 Fan A State: Present -Bus 1 Enclosure 1 Fan B State: Present -Bus 1 Enclosure 1 Power A State: Present -Bus 1 Enclosure 1 Power B State: Present -Bus 1 Enclosure 1 LCC A State: Present -Bus 1 Enclosure 1 LCC B State: Present -Bus 1 Enclosure 1 LCC A Revision: 7.85 -Bus 1 Enclosure 1 LCC B Revision: 7.85 -Bus 1 Enclosure 1 LCC A Serial #: FCNBD073619725 -Bus 1 Enclosure 1 LCC B Serial #: FCNBD073619505 - -DAE3P Bus 1 Enclosure 2 -Bus 1 Enclosure 2 Fan A State: Present -Bus 1 Enclosure 2 Fan B State: Present -Bus 1 Enclosure 2 Power A State: Present -Bus 1 Enclosure 2 Power B State: Present -Bus 1 Enclosure 2 LCC A State: Present -Bus 1 Enclosure 2 LCC B State: Present -Bus 1 Enclosure 2 LCC A Revision: 7.85 -Bus 1 Enclosure 2 LCC B Revision: 7.85 -Bus 1 Enclosure 2 LCC A Serial #: JAHSL074767593 -Bus 1 Enclosure 2 LCC B Serial #: JAHSL074666885 - -DAE3P Bus 1 Enclosure 3 -Bus 1 Enclosure 3 Fan A State: Present -Bus 1 Enclosure 3 Fan B State: Present -Bus 1 Enclosure 3 Power A State: Present -Bus 1 Enclosure 3 Power B State: Present -Bus 1 Enclosure 3 LCC A State: Present -Bus 1 Enclosure 3 LCC B State: Present -Bus 1 Enclosure 3 LCC A Revision: 7.85 -Bus 1 Enclosure 3 LCC B Revision: 7.85 -Bus 1 Enclosure 3 LCC A Serial #: JAHSL074767433 -Bus 1 Enclosure 3 LCC B Serial #: JAHSL074666624 - -DAE3P Bus 1 Enclosure 4 -Bus 1 Enclosure 4 Fan A State: Present -Bus 1 Enclosure 4 Fan B State: Present -Bus 1 Enclosure 4 Power A State: Present -Bus 1 Enclosure 4 Power B State: Present -Bus 1 Enclosure 4 LCC A State: Present -Bus 1 Enclosure 4 LCC B State: Present -Bus 1 Enclosure 4 LCC A Revision: 7.85 -Bus 1 Enclosure 4 LCC B Revision: 7.85 -Bus 1 Enclosure 4 LCC A Serial #: JAHSL074767321 -Bus 1 Enclosure 4 LCC B Serial #: JAHSL074767360 - -DAE3P Bus 1 Enclosure 5 -Bus 1 Enclosure 5 Fan A State: Present -Bus 1 Enclosure 5 Fan B State: Present -Bus 1 Enclosure 5 Power A State: Present -Bus 1 Enclosure 5 Power B State: Present -Bus 1 Enclosure 5 LCC A State: Present -Bus 1 Enclosure 5 LCC B State: Present -Bus 1 Enclosure 5 LCC A Revision: 7.85 -Bus 1 Enclosure 5 LCC B Revision: 7.85 -Bus 1 Enclosure 5 LCC A Serial #: JAHSL074664396 -Bus 1 Enclosure 5 LCC B Serial #: JAHSL074768042 - -DAE3P Bus 1 Enclosure 6 -Bus 1 Enclosure 6 Fan A State: Present -Bus 1 Enclosure 6 Fan B State: Present -Bus 1 Enclosure 6 Power A State: Present -Bus 1 Enclosure 6 Power B State: Present -Bus 1 Enclosure 6 LCC A State: Present -Bus 1 Enclosure 6 LCC B State: Present -Bus 1 Enclosure 6 LCC A Revision: 7.85 -Bus 1 Enclosure 6 LCC B Revision: 7.85 -Bus 1 Enclosure 6 LCC A Serial #: JAHSL074666153 -Bus 1 Enclosure 6 LCC B Serial #: JAHSL074767483 - -DAE3P Bus 1 Enclosure 7 -Bus 1 Enclosure 7 Fan A State: Present -Bus 1 Enclosure 7 Fan B State: Present -Bus 1 Enclosure 7 Power A State: Present -Bus 1 Enclosure 7 Power B State: Present -Bus 1 Enclosure 7 LCC A State: Present -Bus 1 Enclosure 7 LCC B State: Present -Bus 1 Enclosure 7 LCC A Revision: 7.85 -Bus 1 Enclosure 7 LCC B Revision: 7.85 -Bus 1 Enclosure 7 LCC A Serial #: JAHDL084155976 -Bus 1 Enclosure 7 LCC B Serial #: JAHDL084153292 - ====================== Mode pour le controller global @@ -189,17 +52,6 @@ Total Writes: 401613 Total Reads: 6653775 Prct Idle: 94.2 -====================== -Mode pour le cache -====================== - -La commande: getcache -pdp -state -mirror - -Prct Dirty Cache Pages = 0 -SP Read Cache State Enabled -SP Write Cache State Enabled -Write Cache Mirrored: YES - ====================== Mode pour les disques ====================== diff --git a/storage/emc/clariion/custom.pm b/storage/emc/clariion/custom.pm index dfb06b94b..7c7ce1225 100644 --- a/storage/emc/clariion/custom.pm +++ b/storage/emc/clariion/custom.pm @@ -233,19 +233,19 @@ my navisphere manage =item B<--navicli-path> -Specify navicli path (default: 'navicli') +Specify navicli path (default: '/opt/Navisphere/bin') =item B<--navicli-command> -Specify navicli command (default: '/opt/Navisphere/bin'). +Specify navicli command (default: 'navicli'). =item B<--naviseccli-path> -Specify naviseccli path (default: 'naviseccli') +Specify naviseccli path (default: '/opt/Navisphere/bin') =item B<--naviseccli-command> -Specify naviseccli command (default: '/opt/Navisphere/bin'). +Specify naviseccli command (default: 'naviseccli'). =item B<--sudo> diff --git a/storage/emc/clariion/mode/cache.pm b/storage/emc/clariion/mode/cache.pm new file mode 100644 index 000000000..c9fa1ba57 --- /dev/null +++ b/storage/emc/clariion/mode/cache.pm @@ -0,0 +1,214 @@ +################################################################################ +# Copyright 2005-2013 MERETHIS +# Centreon is developped by : Julien Mathis and Romain Le Merlus under +# GPL Licence 2.0. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation ; either version 2 of the License. +# +# This program is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, see . +# +# Linking this program statically or dynamically with other modules is making a +# combined work based on this program. Thus, the terms and conditions of the GNU +# General Public License cover the whole combination. +# +# As a special exception, the copyright holders of this program give MERETHIS +# permission to link this program with independent modules to produce an executable, +# regardless of the license terms of these independent modules, and to copy and +# distribute the resulting executable under terms of MERETHIS choice, provided that +# MERETHIS also meet, for each linked independent module, the terms and conditions +# of the license of that module. An independent module is a module which is not +# derived from this program. If you modify this program, you may extend this +# exception to your version of the program, but you are not obliged to do so. If you +# do not wish to do so, delete this exception statement from your version. +# +# For more information : contact@centreon.com +# Authors : Quentin Garnier +# +#################################################################################### + +package storage::emc::clariion::mode::cache; + +use base qw(centreon::plugins::mode); + +use strict; +use warnings; +use centreon::plugins::misc; + +my %states = ( + read_cache => [ + ['^enabled$' , 'OK'], + ['^disabling$' , 'CRITICAL'], + ['^disabled$' , 'CRITICAL'], + ['^.*$' , 'CRITICAL'], + ], + write_cache => [ + ['^enabled$' , 'OK'], + ['^disabled$' , 'CRITICAL'], + ['^enabling$' , 'OK'], + ['^initializing$' , 'WARNING'], + ['^dumping$' , 'CRITICAL'], + ['^frozen$' , 'CRITICAL'], + ['^.*$' , 'CRITICAL'], + ], + write_mirror => [ + ['^yes$' , 'OK'], + ['^.*$' , 'CRITICAL'], + ], +); + + +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 => + { + "threshold-overload:s@" => { name => 'threshold_overload' }, + "warning:s" => { name => 'warning', }, + "critical:s" => { name => 'critical', }, + }); + + return $self; +} + +sub check_options { + my ($self, %options) = @_; + $self->SUPER::init(%options); + + if (($self->{perfdata}->threshold_validate(label => 'warning', value => $self->{option_results}->{warning})) == 0) { + $self->{output}->add_option_msg(short_msg => "Wrong warning threshold '" . $self->{option_results}->{warning} . "'."); + $self->{output}->option_exit(); + } + if (($self->{perfdata}->threshold_validate(label => 'critical', value => $self->{option_results}->{critical})) == 0) { + $self->{output}->add_option_msg(short_msg => "Wrong critical threshold '" . $self->{option_results}->{critical} . "'."); + $self->{output}->option_exit(); + } + $self->{overload_th} = {}; + foreach my $val (@{$self->{option_results}->{threshold_overload}}) { + if ($val !~ /(.*?):(.*?)=(.*)/) { + $self->{output}->add_option_msg(short_msg => "Wrong treshold-overload option '" . $val . "'."); + $self->{output}->option_exit(); + } + + my ($label, $filter, $threshold) = ($1, $2, $3); + if ($self->{output}->is_litteral_status(status => $threshold) == 0) { + $self->{output}->add_option_msg(short_msg => "Wrong treshold-overload status '" . $val . "'."); + $self->{output}->option_exit(); + } + $self->{overload_th}->{$label} = {} if (!defined($self->{overload_th}->{$label})); + $self->{overload_th}->{$label}->{$filter} = $threshold; + } +} + +sub get_severity { + my ($self, %options) = @_; + my $status = 'unknown'; + + foreach my $entry (@{$states{$options{label}}}) { + if ($options{value} =~ /${$entry}[0]/i) { + $status = ${$entry}[1]; + foreach my $filter (keys %{$self->{overload_th}->{$options{label}}}) { + if (${$entry}[0] =~ /$filter/i) { + $status = $self->{overload_th}->{$options{label}}->{$filter}; + last; + } + } + last; + } + } + + return $status; +} + +sub run { + my ($self, %options) = @_; + my $clariion = $options{custom}; + + #Prct Dirty Cache Pages = 0 + #SP Read Cache State Enabled + #SP Write Cache State Enabled + #Write Cache Mirrored: YES + my $response = $clariion->execute_command(cmd => 'getcache -pdp -state -mirror'); + chomp $response; + + if ($response !~ /^SP Read Cache State\s+(.*)/im) { + $self->{output}->output_add(severity => 'UNKNOWN', + short_msg => 'Cannot find cache informations.'); + $self->{output}->display(); + $self->{output}->exit(); + } + my $read_cache_state = $1; + + $response =~ /^SP Write Cache State\s+(.*)\s*$/im; + my $write_cache_state = $1; + + $response =~ /^Write Cache Mirrored:\s+(.*)\s*$/im; + my $write_cache_mirror = $1; + + $response =~ /^Prct.*?=\s+(\S+)/im; + my $dirty_prct = $1; + + $self->{output}->output_add(severity => $self->get_severity(value => $read_cache_state, + label => 'read_cache'), + short_msg => sprintf("Read cache state is '%s'", + $read_cache_state)); + $self->{output}->output_add(severity => $self->get_severity(value => $write_cache_state, + label => 'write_cache'), + short_msg => sprintf("Write cache state is '%s'", + $write_cache_state)); + $self->{output}->output_add(severity => $self->get_severity(value => $write_cache_mirror, + label => 'write_mirror'), + short_msg => sprintf("Write cache mirror is '%s'", + $write_cache_mirror)); + + my $exit = $self->{perfdata}->threshold_check(value => $dirty_prct, + threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Dirty Cache Pages is %s %%", $dirty_prct)); + } + $self->{output}->perfdata_add(label => 'dirty_cache', unit => '%', + value => $dirty_prct, + warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'), + critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'), + min => 0, max => 100); + + $self->{output}->display(); + $self->{output}->exit(); +} + +1; + +__END__ + +=head1 MODE + +Check status of the read and write cache. + +=over 8 + +=item B<--warning> + +Threshold warning in percent (for dirty cache). + +=item B<--critical> + +Threshold critical in percent (for dirty cache). + +=item B<--threshold-overload> + +Set to overload default threshold value. +Example: --threshold-overload='read_cache:(enabled)=critical' + +=back + +=cut diff --git a/storage/emc/clariion/mode/sp.pm b/storage/emc/clariion/mode/sp.pm new file mode 100644 index 000000000..11448704c --- /dev/null +++ b/storage/emc/clariion/mode/sp.pm @@ -0,0 +1,196 @@ +################################################################################ +# Copyright 2005-2013 MERETHIS +# Centreon is developped by : Julien Mathis and Romain Le Merlus under +# GPL Licence 2.0. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation ; either version 2 of the License. +# +# This program is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, see . +# +# Linking this program statically or dynamically with other modules is making a +# combined work based on this program. Thus, the terms and conditions of the GNU +# General Public License cover the whole combination. +# +# As a special exception, the copyright holders of this program give MERETHIS +# permission to link this program with independent modules to produce an executable, +# regardless of the license terms of these independent modules, and to copy and +# distribute the resulting executable under terms of MERETHIS choice, provided that +# MERETHIS also meet, for each linked independent module, the terms and conditions +# of the license of that module. An independent module is a module which is not +# derived from this program. If you modify this program, you may extend this +# exception to your version of the program, but you are not obliged to do so. If you +# do not wish to do so, delete this exception statement from your version. +# +# For more information : contact@centreon.com +# Authors : Quentin Garnier +# +#################################################################################### + +package storage::emc::clariion::mode::sp; + +use base qw(centreon::plugins::mode); + +use strict; +use warnings; +use centreon::plugins::misc; +use storage::emc::clariion::mode::spcomponents::fan; +use storage::emc::clariion::mode::spcomponents::lcc; +use storage::emc::clariion::mode::spcomponents::psu; +use storage::emc::clariion::mode::spcomponents::memory; +use storage::emc::clariion::mode::spcomponents::cpu; +use storage::emc::clariion::mode::spcomponents::iomodule; +use storage::emc::clariion::mode::spcomponents::cable; +use storage::emc::clariion::mode::spcomponents::sp; + +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 => + { + "exclude:s" => { name => 'exclude' }, + "component:s" => { name => 'component', default => 'all' }, + "no-component:s" => { name => 'no_component' }, + }); + + $self->{components} = {}; + $self->{no_components} = undef; + + return $self; +} + +sub check_options { + my ($self, %options) = @_; + $self->SUPER::init(%options); + + if (defined($self->{option_results}->{no_component})) { + if ($self->{option_results}->{no_component} ne '') { + $self->{no_components} = $self->{option_results}->{no_component}; + } else { + $self->{no_components} = 'critical'; + } + } +} + +sub component { + my ($self, %options) = @_; + + if ($self->{option_results}->{component} eq 'all') { + storage::emc::clariion::mode::spcomponents::fan::check($self); + storage::emc::clariion::mode::spcomponents::lcc::check($self); + storage::emc::clariion::mode::spcomponents::psu::check($self); + storage::emc::clariion::mode::spcomponents::cable::check($self); + storage::emc::clariion::mode::spcomponents::iomodule::check($self); + storage::emc::clariion::mode::spcomponents::memory::check($self); + storage::emc::clariion::mode::spcomponents::cpu::check($self); + storage::emc::clariion::mode::spcomponents::sp::check($self); + } elsif ($self->{option_results}->{component} eq 'sp') { + storage::emc::clariion::mode::spcomponents::sp::check($self); + } elsif ($self->{option_results}->{component} eq 'fan') { + storage::emc::clariion::mode::spcomponents::fan::check($self); + } elsif ($self->{option_results}->{component} eq 'lcc') { + storage::emc::clariion::mode::spcomponents::lcc::check($self); + } elsif ($self->{option_results}->{component} eq 'psu') { + storage::emc::clariion::mode::spcomponents::psu::check($self); + } elsif ($self->{option_results}->{component} eq 'memory') { + storage::emc::clariion::mode::spcomponents::memory::check($self); + } elsif ($self->{option_results}->{component} eq 'cpu') { + storage::emc::clariion::mode::spcomponents::cpu::check($self); + } elsif ($self->{option_results}->{component} eq 'io') { + storage::emc::clariion::mode::spcomponents::iomodule::check($self); + } elsif ($self->{option_results}->{component} eq 'cable') { + storage::emc::clariion::mode::spcomponents::cable::check($self); + } else { + $self->{output}->add_option_msg(short_msg => "Wrong option. Cannot find component '" . $self->{option_results}->{component} . "'."); + $self->{output}->option_exit(); + } + + my $total_components = 0; + my $display_by_component = ''; + my $display_by_component_append = ''; + foreach my $comp (sort(keys %{$self->{components}})) { + # Skipping short msg when no components + next if ($self->{components}->{$comp}->{total} == 0 && $self->{components}->{$comp}->{skip} == 0); + $total_components += $self->{components}->{$comp}->{total} + $self->{components}->{$comp}->{skip}; + $display_by_component .= $display_by_component_append . $self->{components}->{$comp}->{total} . '/' . $self->{components}->{$comp}->{skip} . ' ' . $self->{components}->{$comp}->{name}; + $display_by_component_append = ', '; + } + + $self->{output}->output_add(severity => 'OK', + short_msg => sprintf("All %s components [%s] are ok.", + $total_components, + $display_by_component) + ); + + if (defined($self->{option_results}->{no_component}) && $total_components == 0) { + $self->{output}->output_add(severity => $self->{no_components}, + short_msg => 'No components are checked.'); + } +} + +sub run { + my ($self, %options) = @_; + my $clariion = $options{custom}; + + $self->{response} = $clariion->execute_command(cmd => 'getcrus -all'); + chomp $self->{response}; + + $self->component(); + + $self->{output}->display(); + $self->{output}->exit(); +} + +sub check_exclude { + my ($self, %options) = @_; + + if (defined($options{instance})) { + if (defined($self->{option_results}->{exclude}) && $self->{option_results}->{exclude} =~ /(^|\s|,)${options{section}}[^,]*#\Q$options{instance}\E#/) { + $self->{components}->{$options{section}}->{skip}++; + $self->{output}->output_add(long_msg => sprintf("Skipping $options{section} section $options{instance} instance.")); + return 1; + } + } elsif (defined($self->{option_results}->{exclude}) && $self->{option_results}->{exclude} =~ /(^|\s|,)$options{section}(\s|,|$)/) { + $self->{output}->output_add(long_msg => sprintf("Skipping $options{section} section.")); + return 1; + } + return 0; +} + +1; + +__END__ + +=head1 MODE + +Check status of storage processor. + +=over 8 + +=item B<--component> + +Which component to check (Default: 'all'). +Can be: 'cpu', 'psu', 'pc', 'fan', 'network', 'temperature', 'storage'. + +=item B<--exclude> + +Exclude some parts (comma seperated list) (Example: --exclude=fan,lcc) +Can also exclude specific instance: --exclude=fan#1.2#,lcc + +=item B<--no-component> + +Return an error if no compenents are checked. +If total (with skipped) is 0. (Default: 'critical' returns). + +=back + +=cut \ No newline at end of file diff --git a/storage/emc/clariion/mode/spcomponents/cable.pm b/storage/emc/clariion/mode/spcomponents/cable.pm new file mode 100644 index 000000000..fbda6c53c --- /dev/null +++ b/storage/emc/clariion/mode/spcomponents/cable.pm @@ -0,0 +1,76 @@ +################################################################################ +# Copyright 2005-2013 MERETHIS +# Centreon is developped by : Julien Mathis and Romain Le Merlus under +# GPL Licence 2.0. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation ; either version 2 of the License. +# +# This program is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, see . +# +# Linking this program statically or dynamically with other modules is making a +# combined work based on this program. Thus, the terms and conditions of the GNU +# General Public License cover the whole combination. +# +# As a special exception, the copyright holders of this program give MERETHIS +# permission to link this program with independent modules to produce an executable, +# regardless of the license terms of these independent modules, and to copy and +# distribute the resulting executable under terms of MERETHIS choice, provided that +# MERETHIS also meet, for each linked independent module, the terms and conditions +# of the license of that module. An independent module is a module which is not +# derived from this program. If you modify this program, you may extend this +# exception to your version of the program, but you are not obliged to do so. If you +# do not wish to do so, delete this exception statement from your version. +# +# For more information : contact@centreon.com +# Authors : Quentin Garnier +# +#################################################################################### + +package storage::emc::clariion::mode::spcomponents::cable; + +use strict; +use warnings; + +my %conditions = ( + 1 => ['^(?!(Present|Valid)$)' => 'CRITICAL'], +); + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking cables"); + $self->{components}->{cable} = {name => 'cables', total => 0, skip => 0}; + return if ($self->check_exclude(section => 'cable')); + + # Enclosure SPE SPS A Cabling State: Valid + while ($self->{response} =~ /^(?:Bus\s+(\d+)\s+){0,1}Enclosure\s+(\S+)\s+(Power|SPS)\s+(\S+)\s+Cabling\s+State:\s+(.*)$/mgi) { + my ($state, $instance) = ($5, "$2.$3.$4"); + if (defined($1)) { + $instance = "$1.$2.$3.$4"; + } + + next if ($self->check_exclude(section => 'cable', instance => $instance)); + $self->{components}->{cable}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("cable '%s' state is %s.", + $instance, $state) + ); + foreach (keys %conditions) { + if ($state =~ /${$conditions{$_}}[0]/i) { + $self->{output}->output_add(severity => ${$conditions{$_}}[1], + short_msg => sprintf("cable '%s' state is %s", + $instance, $state)); + last; + } + } + } +} + +1; \ No newline at end of file diff --git a/storage/emc/clariion/mode/spcomponents/cpu.pm b/storage/emc/clariion/mode/spcomponents/cpu.pm new file mode 100644 index 000000000..411c6ed72 --- /dev/null +++ b/storage/emc/clariion/mode/spcomponents/cpu.pm @@ -0,0 +1,74 @@ +################################################################################ +# Copyright 2005-2013 MERETHIS +# Centreon is developped by : Julien Mathis and Romain Le Merlus under +# GPL Licence 2.0. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation ; either version 2 of the License. +# +# This program is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, see . +# +# Linking this program statically or dynamically with other modules is making a +# combined work based on this program. Thus, the terms and conditions of the GNU +# General Public License cover the whole combination. +# +# As a special exception, the copyright holders of this program give MERETHIS +# permission to link this program with independent modules to produce an executable, +# regardless of the license terms of these independent modules, and to copy and +# distribute the resulting executable under terms of MERETHIS choice, provided that +# MERETHIS also meet, for each linked independent module, the terms and conditions +# of the license of that module. An independent module is a module which is not +# derived from this program. If you modify this program, you may extend this +# exception to your version of the program, but you are not obliged to do so. If you +# do not wish to do so, delete this exception statement from your version. +# +# For more information : contact@centreon.com +# Authors : Quentin Garnier +# +#################################################################################### + +package storage::emc::clariion::mode::spcomponents::cpu; + +use strict; +use warnings; + +my %conditions = ( + 1 => ['^(?!(Present|Valid)$)' => 'CRITICAL'], +); + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking cpu"); + $self->{components}->{cpu} = {name => 'cpus', total => 0, skip => 0}; + return if ($self->check_exclude(section => 'cpu')); + + # Enclosure SPE CPU Module A State: Present + while ($self->{response} =~ /^Enclosure\s+(\S+)\s+CPU\s+Module\s+(\S+)\s+State:\s+(.*)$/mgi) { + my $instance = "$1.$2"; + my $state = $3; + + next if ($self->check_exclude(section => 'cpu', instance => $instance)); + $self->{components}->{cpu}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("cpu '%s' state is %s.", + $instance, $state) + ); + foreach (keys %conditions) { + if ($state =~ /${$conditions{$_}}[0]/i) { + $self->{output}->output_add(severity => ${$conditions{$_}}[1], + short_msg => sprintf("cpu '%s' state is %s", + $instance, $state)); + last; + } + } + } +} + +1; \ No newline at end of file diff --git a/storage/emc/clariion/mode/spcomponents/fan.pm b/storage/emc/clariion/mode/spcomponents/fan.pm new file mode 100644 index 000000000..8e2ff2171 --- /dev/null +++ b/storage/emc/clariion/mode/spcomponents/fan.pm @@ -0,0 +1,74 @@ +################################################################################ +# Copyright 2005-2013 MERETHIS +# Centreon is developped by : Julien Mathis and Romain Le Merlus under +# GPL Licence 2.0. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation ; either version 2 of the License. +# +# This program is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, see . +# +# Linking this program statically or dynamically with other modules is making a +# combined work based on this program. Thus, the terms and conditions of the GNU +# General Public License cover the whole combination. +# +# As a special exception, the copyright holders of this program give MERETHIS +# permission to link this program with independent modules to produce an executable, +# regardless of the license terms of these independent modules, and to copy and +# distribute the resulting executable under terms of MERETHIS choice, provided that +# MERETHIS also meet, for each linked independent module, the terms and conditions +# of the license of that module. An independent module is a module which is not +# derived from this program. If you modify this program, you may extend this +# exception to your version of the program, but you are not obliged to do so. If you +# do not wish to do so, delete this exception statement from your version. +# +# For more information : contact@centreon.com +# Authors : Quentin Garnier +# +#################################################################################### + +package storage::emc::clariion::mode::spcomponents::fan; + +use strict; +use warnings; + +my %conditions = ( + 1 => ['^(?!(Present|Valid)$)' => 'CRITICAL'], +); + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking fans"); + $self->{components}->{fan} = {name => 'fans', total => 0, skip => 0}; + return if ($self->check_exclude(section => 'fan')); + + # Bus 0 Enclosure 0 Fan A State: Present + while ($self->{response} =~ /^Bus\s+(\d+)\s+Enclosure\s+(\d+)\s+Fan\s+(\S+)\s+State:\s+(.*)$/mgi) { + my $instance = "$1.$2.$3"; + my $state = $4; + + next if ($self->check_exclude(section => 'fan', instance => $instance)); + $self->{components}->{fan}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("fan '%s' state is %s.", + $instance, $state) + ); + foreach (keys %conditions) { + if ($state =~ /${$conditions{$_}}[0]/i) { + $self->{output}->output_add(severity => ${$conditions{$_}}[1], + short_msg => sprintf("fan '%s' state is %s", + $instance, $state)); + last; + } + } + } +} + +1; \ No newline at end of file diff --git a/storage/emc/clariion/mode/spcomponents/iomodule.pm b/storage/emc/clariion/mode/spcomponents/iomodule.pm new file mode 100644 index 000000000..696d274a5 --- /dev/null +++ b/storage/emc/clariion/mode/spcomponents/iomodule.pm @@ -0,0 +1,74 @@ +################################################################################ +# Copyright 2005-2013 MERETHIS +# Centreon is developped by : Julien Mathis and Romain Le Merlus under +# GPL Licence 2.0. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation ; either version 2 of the License. +# +# This program is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, see . +# +# Linking this program statically or dynamically with other modules is making a +# combined work based on this program. Thus, the terms and conditions of the GNU +# General Public License cover the whole combination. +# +# As a special exception, the copyright holders of this program give MERETHIS +# permission to link this program with independent modules to produce an executable, +# regardless of the license terms of these independent modules, and to copy and +# distribute the resulting executable under terms of MERETHIS choice, provided that +# MERETHIS also meet, for each linked independent module, the terms and conditions +# of the license of that module. An independent module is a module which is not +# derived from this program. If you modify this program, you may extend this +# exception to your version of the program, but you are not obliged to do so. If you +# do not wish to do so, delete this exception statement from your version. +# +# For more information : contact@centreon.com +# Authors : Quentin Garnier +# +#################################################################################### + +package storage::emc::clariion::mode::spcomponents::iomodule; + +use strict; +use warnings; + +my %conditions = ( + 1 => ['^(?!(Present|Valid)$)' => 'CRITICAL'], +); + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking I/O modules"); + $self->{components}->{io} = {name => 'IO module', total => 0, skip => 0}; + return if ($self->check_exclude(section => 'io')); + + # Enclosure SPE SP A I/O Module 0 State: Present + while ($self->{response} =~ /^Enclosure\s+(\S+)\s+SP\s+(\S+)\s+I\/O\s+Module\s+(\S+)\s+State:\s+(.*)$/mgi) { + my $instance = "$1.$2.$3"; + my $state = $4; + + next if ($self->check_exclude(section => 'io', instance => $instance)); + $self->{components}->{io}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("I/O module '%s' state is %s.", + $instance, $state) + ); + foreach (keys %conditions) { + if ($state =~ /${$conditions{$_}}[0]/i) { + $self->{output}->output_add(severity => ${$conditions{$_}}[1], + short_msg => sprintf("I/O module '%s' state is %s", + $instance, $state)); + last; + } + } + } +} + +1; \ No newline at end of file diff --git a/storage/emc/clariion/mode/spcomponents/lcc.pm b/storage/emc/clariion/mode/spcomponents/lcc.pm new file mode 100644 index 000000000..7596fea2a --- /dev/null +++ b/storage/emc/clariion/mode/spcomponents/lcc.pm @@ -0,0 +1,74 @@ +################################################################################ +# Copyright 2005-2013 MERETHIS +# Centreon is developped by : Julien Mathis and Romain Le Merlus under +# GPL Licence 2.0. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation ; either version 2 of the License. +# +# This program is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, see . +# +# Linking this program statically or dynamically with other modules is making a +# combined work based on this program. Thus, the terms and conditions of the GNU +# General Public License cover the whole combination. +# +# As a special exception, the copyright holders of this program give MERETHIS +# permission to link this program with independent modules to produce an executable, +# regardless of the license terms of these independent modules, and to copy and +# distribute the resulting executable under terms of MERETHIS choice, provided that +# MERETHIS also meet, for each linked independent module, the terms and conditions +# of the license of that module. An independent module is a module which is not +# derived from this program. If you modify this program, you may extend this +# exception to your version of the program, but you are not obliged to do so. If you +# do not wish to do so, delete this exception statement from your version. +# +# For more information : contact@centreon.com +# Authors : Quentin Garnier +# +#################################################################################### + +package storage::emc::clariion::mode::spcomponents::lcc; + +use strict; +use warnings; + +my %conditions = ( + 1 => ['^(?!(Present|Valid)$)' => 'CRITICAL'], +); + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking link control card"); + $self->{components}->{lcc} = {name => 'lccs', total => 0, skip => 0}; + return if ($self->check_exclude(section => 'lcc')); + + # Bus 1 Enclosure 6 LCC A State: Present + while ($self->{response} =~ /^Bus\s+(\d+)\s+Enclosure\s+(\d+)\s+LCC\s+(\S+)\s+State:\s+(.*)$/mgi) { + my $instance = "$1.$2.$3"; + my $state = $4; + + next if ($self->check_exclude(section => 'lcc', instance => $instance)); + $self->{components}->{lcc}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("lcc '%s' state is %s.", + $instance, $state) + ); + foreach (keys %conditions) { + if ($state =~ /${$conditions{$_}}[0]/i) { + $self->{output}->output_add(severity => ${$conditions{$_}}[1], + short_msg => sprintf("lcc '%s' state is %s", + $instance, $state)); + last; + } + } + } +} + +1; \ No newline at end of file diff --git a/storage/emc/clariion/mode/spcomponents/memory.pm b/storage/emc/clariion/mode/spcomponents/memory.pm new file mode 100644 index 000000000..3a0242f63 --- /dev/null +++ b/storage/emc/clariion/mode/spcomponents/memory.pm @@ -0,0 +1,74 @@ +################################################################################ +# Copyright 2005-2013 MERETHIS +# Centreon is developped by : Julien Mathis and Romain Le Merlus under +# GPL Licence 2.0. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation ; either version 2 of the License. +# +# This program is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, see . +# +# Linking this program statically or dynamically with other modules is making a +# combined work based on this program. Thus, the terms and conditions of the GNU +# General Public License cover the whole combination. +# +# As a special exception, the copyright holders of this program give MERETHIS +# permission to link this program with independent modules to produce an executable, +# regardless of the license terms of these independent modules, and to copy and +# distribute the resulting executable under terms of MERETHIS choice, provided that +# MERETHIS also meet, for each linked independent module, the terms and conditions +# of the license of that module. An independent module is a module which is not +# derived from this program. If you modify this program, you may extend this +# exception to your version of the program, but you are not obliged to do so. If you +# do not wish to do so, delete this exception statement from your version. +# +# For more information : contact@centreon.com +# Authors : Quentin Garnier +# +#################################################################################### + +package storage::emc::clariion::mode::spcomponents::memory; + +use strict; +use warnings; + +my %conditions = ( + 1 => ['^(?!(Present|Valid)$)' => 'CRITICAL'], +); + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking dimm"); + $self->{components}->{dimm} = {name => 'dimm', total => 0, skip => 0}; + return if ($self->check_exclude(section => 'dimm')); + + # Enclosure SPE DIMM Module A State: Present + while ($self->{response} =~ /^Enclosure\s+(\S+)\s+DIMM\s+Module\s+(\S+)\s+State:\s+(.*)$/mgi) { + my $instance = "$1.$2"; + my $state = $3; + + next if ($self->check_exclude(section => 'dimm', instance => $instance)); + $self->{components}->{dimm}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("Dimm '%s' state is %s.", + $instance, $state) + ); + foreach (keys %conditions) { + if ($state =~ /${$conditions{$_}}[0]/i) { + $self->{output}->output_add(severity => ${$conditions{$_}}[1], + short_msg => sprintf("Dimm '%s' state is %s", + $instance, $state)); + last; + } + } + } +} + +1; \ No newline at end of file diff --git a/storage/emc/clariion/mode/spcomponents/psu.pm b/storage/emc/clariion/mode/spcomponents/psu.pm new file mode 100644 index 000000000..9427bef96 --- /dev/null +++ b/storage/emc/clariion/mode/spcomponents/psu.pm @@ -0,0 +1,80 @@ +################################################################################ +# Copyright 2005-2013 MERETHIS +# Centreon is developped by : Julien Mathis and Romain Le Merlus under +# GPL Licence 2.0. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation ; either version 2 of the License. +# +# This program is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, see . +# +# Linking this program statically or dynamically with other modules is making a +# combined work based on this program. Thus, the terms and conditions of the GNU +# General Public License cover the whole combination. +# +# As a special exception, the copyright holders of this program give MERETHIS +# permission to link this program with independent modules to produce an executable, +# regardless of the license terms of these independent modules, and to copy and +# distribute the resulting executable under terms of MERETHIS choice, provided that +# MERETHIS also meet, for each linked independent module, the terms and conditions +# of the license of that module. An independent module is a module which is not +# derived from this program. If you modify this program, you may extend this +# exception to your version of the program, but you are not obliged to do so. If you +# do not wish to do so, delete this exception statement from your version. +# +# For more information : contact@centreon.com +# Authors : Quentin Garnier +# +#################################################################################### + +package storage::emc::clariion::mode::spcomponents::psu; + +use strict; +use warnings; + +my %conditions = ( + 1 => ['^(?!(Present|Valid)$)' => 'CRITICAL'], +); + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking power supplies"); + $self->{components}->{psu} = {name => 'psus', total => 0, skip => 0}; + return if ($self->check_exclude(section => 'psu')); + + # SPS means = Standby Power Supply + + # Enclosure SPE Power A0 State: Present + # Enclosure SPE SPS A State: Present + # Bus 0 Enclosure 0 Power A State: Present + while ($self->{response} =~ /^(?:Bus\s+(\d+)\s+){0,1}Enclosure\s+(\S+)\s+(Power|SPS)\s+(\S+)\s+State:\s+(.*)$/mgi) { + my ($state, $instance) = ($5, "$2.$3.$4"); + if (defined($1)) { + $instance = "$1.$2.$3.$4"; + } + + next if ($self->check_exclude(section => 'psu', instance => $instance)); + $self->{components}->{psu}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("Power Supply '%s' state is %s.", + $instance, $state) + ); + foreach (keys %conditions) { + if ($state =~ /${$conditions{$_}}[0]/i) { + $self->{output}->output_add(severity => ${$conditions{$_}}[1], + short_msg => sprintf("Power Supply '%s' state is %s", + $instance, $state)); + last; + } + } + } +} + +1; \ No newline at end of file diff --git a/storage/emc/clariion/mode/spcomponents/sp.pm b/storage/emc/clariion/mode/spcomponents/sp.pm new file mode 100644 index 000000000..1973075f3 --- /dev/null +++ b/storage/emc/clariion/mode/spcomponents/sp.pm @@ -0,0 +1,74 @@ +################################################################################ +# Copyright 2005-2013 MERETHIS +# Centreon is developped by : Julien Mathis and Romain Le Merlus under +# GPL Licence 2.0. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation ; either version 2 of the License. +# +# This program is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, see . +# +# Linking this program statically or dynamically with other modules is making a +# combined work based on this program. Thus, the terms and conditions of the GNU +# General Public License cover the whole combination. +# +# As a special exception, the copyright holders of this program give MERETHIS +# permission to link this program with independent modules to produce an executable, +# regardless of the license terms of these independent modules, and to copy and +# distribute the resulting executable under terms of MERETHIS choice, provided that +# MERETHIS also meet, for each linked independent module, the terms and conditions +# of the license of that module. An independent module is a module which is not +# derived from this program. If you modify this program, you may extend this +# exception to your version of the program, but you are not obliged to do so. If you +# do not wish to do so, delete this exception statement from your version. +# +# For more information : contact@centreon.com +# Authors : Quentin Garnier +# +#################################################################################### + +package storage::emc::clariion::mode::spcomponents::sp; + +use strict; +use warnings; + +my %conditions = ( + 1 => ['^(?!(Present|Valid)$)' => 'CRITICAL'], +); + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking sp"); + $self->{components}->{sp} = {name => 'sp', total => 0, skip => 0}; + return if ($self->check_exclude(section => 'sp')); + + # SP A State: Present + while ($self->{response} =~ /^SP\s+(\S+)\s+State:\s+(.*)$/mgi) { + my $instance = $1; + my $state = $2; + + next if ($self->check_exclude(section => 'sp', instance => $instance)); + $self->{components}->{sp}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("sp '%s' state is %s.", + $instance, $state) + ); + foreach (keys %conditions) { + if ($state =~ /${$conditions{$_}}[0]/i) { + $self->{output}->output_add(severity => ${$conditions{$_}}[1], + short_msg => sprintf("sp '%s' state is %s", + $instance, $state)); + last; + } + } + } +} + +1; \ No newline at end of file diff --git a/storage/emc/clariion/plugin.pm b/storage/emc/clariion/plugin.pm index d6f5d7e6d..e0370177c 100644 --- a/storage/emc/clariion/plugin.pm +++ b/storage/emc/clariion/plugin.pm @@ -48,6 +48,8 @@ sub new { $self->{version} = '0.1'; %{$self->{modes}} = ( + 'cache' => 'storage::emc::clariion::mode::cache', + 'sp' => 'storage::emc::clariion::mode::sp', 'faults' => 'storage::emc::clariion::mode::faults', 'list-luns' => 'storage::emc::clariion::mode::listluns', 'sp-info' => 'storage::emc::clariion::mode::spinfo',