From 006a71548df3016c90dcf2a887d56e0acef97289 Mon Sep 17 00:00:00 2001 From: Quentin Garnier Date: Thu, 3 Jul 2014 17:17:51 +0200 Subject: [PATCH] Refs #5425 --- centreon-plugins/storage/emc/clariion/TODO | 31 -- .../storage/emc/clariion/custom.pm | 8 +- .../storage/emc/clariion/mode/disk.pm | 399 ++++++++++++++++++ .../storage/emc/clariion/mode/listluns.pm | 2 +- .../storage/emc/clariion/mode/sp.pm | 178 ++------ .../storage/emc/clariion/plugin.pm | 1 + 6 files changed, 433 insertions(+), 186 deletions(-) create mode 100644 centreon-plugins/storage/emc/clariion/mode/disk.pm diff --git a/centreon-plugins/storage/emc/clariion/TODO b/centreon-plugins/storage/emc/clariion/TODO index f4978fc54..c541a993e 100644 --- a/centreon-plugins/storage/emc/clariion/TODO +++ b/centreon-plugins/storage/emc/clariion/TODO @@ -52,37 +52,6 @@ Total Writes: 401613 Total Reads: 6653775 Prct Idle: 94.2 -====================== -Mode pour les disques -====================== - -La commande pour tous: getdisk -state -bytrd -bytwrt -hw -hr - -Bus 1 Enclosure 7 Disk 13 -State: Enabled -Kbytes Read: 311959566 -Kbytes Written: 0 -Hard Write Errors: 0 -Hard Read Errors: 0 - -Bus 1 Enclosure 7 Disk 14 -State: Hot Spare Ready -Kbytes Read: 1957049160 -Kbytes Written: 0 -Hard Write Errors: 0 -Hard Read Errors: 0 - - -La commande pour un seul: getdisk 1_7_14 -state -bytrd -bytwrt -hw -hr - -Bus 1 Enclosure 7 Disk 14 -State: Hot Spare Ready -Kbytes Read: 1957105480 -Kbytes Written: 0 -Hard Write Errors: 0 -Hard Read Errors: 0 - - ====================== Mode pour les raid group ====================== diff --git a/centreon-plugins/storage/emc/clariion/custom.pm b/centreon-plugins/storage/emc/clariion/custom.pm index 7c7ce1225..dfb06b94b 100644 --- a/centreon-plugins/storage/emc/clariion/custom.pm +++ b/centreon-plugins/storage/emc/clariion/custom.pm @@ -233,19 +233,19 @@ my navisphere manage =item B<--navicli-path> -Specify navicli path (default: '/opt/Navisphere/bin') +Specify navicli path (default: 'navicli') =item B<--navicli-command> -Specify navicli command (default: 'navicli'). +Specify navicli command (default: '/opt/Navisphere/bin'). =item B<--naviseccli-path> -Specify naviseccli path (default: '/opt/Navisphere/bin') +Specify naviseccli path (default: 'naviseccli') =item B<--naviseccli-command> -Specify naviseccli command (default: 'naviseccli'). +Specify naviseccli command (default: '/opt/Navisphere/bin'). =item B<--sudo> diff --git a/centreon-plugins/storage/emc/clariion/mode/disk.pm b/centreon-plugins/storage/emc/clariion/mode/disk.pm new file mode 100644 index 000000000..d33e2f86a --- /dev/null +++ b/centreon-plugins/storage/emc/clariion/mode/disk.pm @@ -0,0 +1,399 @@ +################################################################################ +# 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::disk; + +sub get_absolute { + my ($self, %options) = @_; + my $name = $options{instance} . '_' . $options{label}; + my $value; + + $self->{new_datas}->{$name} = $1; + + $self->{old_datas}->{$name} = $self->{statefile_value}->get(name => $name); + return undef if (!defined($self->{old_datas}->{$name})); + + # Reward... put to 0 + if ($self->{old_datas}->{$name} > $self->{new_datas}->{$name}) { + $self->{old_datas}->{$name} = 0; + } + + $value = ($self->{new_datas}->{$name} - $self->{old_datas}->{$name}); + + return ($value, $value); +} + +sub get_bytes_per_seconds { + my ($self, %options) = @_; + my $name = $options{instance} . '_' . $options{label}; + my $value; + + $self->{new_datas}->{$name} = $1; + if (!defined($self->{old_datas}->{last_timestamp})) { + $self->{old_datas}->{last_timestamp} = $self->{statefile_value}->get(name => 'last_timestamp'); + } + $self->{old_datas}->{$name} = $self->{statefile_value}->get(name => $name); + return undef if (!defined($self->{old_datas}->{last_timestamp}) || !defined($self->{old_datas}->{$name})); + + # Reward... put to 0 + if ($self->{old_datas}->{$name} > $self->{new_datas}->{$name}) { + $self->{old_datas}->{$name} = 0; + } + # At least one second + my $delta_time = $self->{new_datas}->{last_timestamp} - $self->{old_datas}->{last_timestamp}; + if ($delta_time <= 0) { + $delta_time = 1; + } + + $value = ($self->{new_datas}->{$name} - $self->{old_datas}->{$name}) / $delta_time; + my ($scale_value, $scale_unit) = $self->{perfdata}->change_bytes(value => $value); + + return ($value, $scale_value . ' ' . $scale_unit); +} + +sub get_utils { + my ($self, %options) = @_; + my $name = $options{instance} . '_' . $options{label}; + my $value; + + $self->{new_datas}->{$name . '_busy'} = $1; + $self->{new_datas}->{$name . '_idle'} = $2; + + $self->{old_datas}->{$name . '_busy'} = $self->{statefile_value}->get(name => $name . '_busy'); + $self->{old_datas}->{$name . '_idle'} = $self->{statefile_value}->get(name => $name . '_idle'); + return undef if (!defined($self->{old_datas}->{$name . '_busy'}) || !defined($self->{old_datas}->{$name . '_idle'})); + + # Reward... put to 0 + if ($self->{old_datas}->{$name . '_busy'} > $self->{new_datas}->{$name . '_busy'}) { + $self->{old_datas}->{$name . '_busy'} = 0; + } + if ($self->{old_datas}->{$name . '_idle'} > $self->{new_datas}->{$name . '_idle'}) { + $self->{old_datas}->{$name . '_idle'} = 0; + } + + my $total_ticks = ($self->{new_datas}->{$name . '_idle'} - $self->{old_datas}->{$name . '_idle'}) + + ($self->{new_datas}->{$name . '_busy'} - $self->{old_datas}->{$name . '_busy'}); + if ($total_ticks <= 0) { + return (0, 0); + } + $value = ($self->{new_datas}->{$name . '_busy'} - $self->{old_datas}->{$name . '_busy'}) * 100 / $total_ticks; + + return ($value, $value); +} + +use base qw(centreon::plugins::mode); + +use strict; +use warnings; +use centreon::plugins::statefile; +use centreon::plugins::misc; + +my $maps_counters = { + hard_read_errors => { thresholds => { + warning_hard_read_errors => { label => 'warning-hard-read-errors', exit_value => 'warning' }, + critical_hard_read_errors => { label => 'critical-hard-read-errors', exit_value => 'critical' }, + }, + matching => 'Hard Read Errors:\s+(\d+)', closure => \&get_absolute, + output_msg => 'Hard Read Errors : %d', perfdata => '%s', + unit => '', + }, + hard_write_errors => { thresholds => { + warning_hard_write_errors => { label => 'warning-hard-write-errors', exit_value => 'warning' }, + critical_hard_write_errors => { label => 'critical-hard-write-errors', exit_value => 'critical' }, + }, + matching => 'Hard Write Errors:\s+(\d+)', closure => \&get_absolute, + output_msg => 'Hard Write Errors : %d', perfdata => '%s', + unit => '', + }, + write_io => { thresholds => { + warning_write_io => { label => 'warning-write-io', exit_value => 'warning' }, + critical_write_io => { label => 'critical-write-io', exit_value => 'critical' }, + }, + matching => 'Kbytes Written:\s+(\d+)', closure => \&get_bytes_per_seconds, + output_msg => 'Write I/O : %s', perfdata => '%d', + unit => 'B', + }, + read_io => { thresholds => { + warning_read_io => { label => 'warning-read-io', exit_value => 'warning' }, + critical_read_io => { label => 'critical-read-io', exit_value => 'critical' }, + }, + matching => 'Kbytes Read:\s+(\d+)', closure => \&get_bytes_per_seconds, + output_msg => 'Read I/O : %s', perfdata => '%d', + unit => 'B', + }, + utils => { thresholds => { + warning_utils => { label => 'warning-utils', exit_value => 'warning' }, + critical_utils => { label => 'critical-utils', exit_value => 'critical' }, + }, + matching => 'Busy Ticks:\s+(\d+).*Idle Ticks:\s+(\d+)', closure => \&get_utils, + output_msg => 'Utils : %.2f %%', perfdata => '%.2f', + unit => '%', + }, +}; + +my @states = ( + ['^enabled$' , 'OK'], + ['^binding$' , 'OK'], + ['^expanding$' , 'OK'], + ['^ready$' , 'OK'], + ['^unbound$' , 'OK'], + ['^empty$' , 'OK'], + ['^hot spare ready$' , 'OK'], + ['^powering up$' , 'OK'], + ['^equalizing$' , 'WARNING'], + ['^formatting$' , 'WARNING'], + ['^removed$' , 'WARNING'], + ['^unformatted$' , 'WARNING'], + ['^failed$' , 'CRITICAL'], + ['^off$' , 'CRITICAL'], + ['^empty$' , 'CRITICAL'], + ['^unsupported$' , 'CRITICAL'], + ['^.*$' , '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' }, + "filter-raidgroupid:s" => { name => 'filter_raidgroupid', }, + "filter-disk:s" => { name => 'filter_disk', }, + }); + + foreach (keys %{$maps_counters}) { + foreach my $name (keys %{$maps_counters->{$_}->{thresholds}}) { + $options{options}->add_options(arguments => { + $maps_counters->{$_}->{thresholds}->{$name}->{label} . ':s' => { name => $name }, + }); + } + } + + $self->{statefile_value} = centreon::plugins::statefile->new(%options); + return $self; +} + +sub check_options { + my ($self, %options) = @_; + $self->SUPER::init(%options); + + foreach (keys %{$maps_counters}) { + foreach my $name (keys %{$maps_counters->{$_}->{thresholds}}) { + if (($self->{perfdata}->threshold_validate(label => $maps_counters->{$_}->{thresholds}->{$name}->{label}, value => $self->{option_results}->{$name})) == 0) { + $self->{output}->add_option_msg(short_msg => "Wrong " . $maps_counters->{$_}->{thresholds}->{$name}->{label} . " threshold '" . $self->{option_results}->{$name} . "'."); + $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 ($filter, $threshold) = ($1, $2); + 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}->{$filter} = $threshold; + } + + $self->{statefile_value}->check_options(%options); +} + +sub get_severity { + my ($self, %options) = @_; + my $status = 'unknown'; + + foreach my $entry (@states) { + if ($options{value} =~ /${$entry}[0]/i) { + $status = ${$entry}[1]; + foreach my $filter (keys %{$self->{overload_th}}) { + if (${$entry}[0] =~ /$filter/i) { + $status = $self->{overload_th}->{$filter}; + last; + } + } + last; + } + } + + return $status; +} + +sub run { + my ($self, %options) = @_; + my $clariion = $options{custom}; + + my $response = $clariion->execute_command(cmd => 'getdisk -state -bytrd -bytwrt -hw -hr -busyticks -idleticks -rg'); + + my ($total_num_disks, $skip_num_disks) = (0, 0); + $self->{new_datas} = {}; + $self->{statefile_value}->read(statefile => "cache_clariion_" . $clariion->{hostname} . '_' . $self->{mode}); + $self->{new_datas}->{last_timestamp} = time(); + + #Bus 1 Enclosure 7 Disk 13 + #State: Enabled + #Kbytes Read: 1109878030 + #Kbytes Written: 0 + #Hard Write Errors: 0 + #Hard Read Errors: 0 + #Busy Ticks: 462350 + #Idle Ticks: 388743630 + #Raid Group ID: 0 + while ($response =~ /^Bus\s+(\S+)\s+Enclosure\s+(\S+)\s+Disk\s+(\S+)(.*?)\n\n/msgi) { + my $disk_instance = "$1_$2_$3"; + my $values = $4; + + # First Filters + if (defined($self->{option_results}->{filter_disk}) && $self->{option_results}->{filter_disk} ne '' && + $disk_instance !~ /$self->{option_results}->{filter_disk}/) { + $skip_num_disks++; + $self->{output}->output_add(long_msg => "Skipping disk '" . $disk_instance . "': no matching filter disk"); + next; + } + if (defined($self->{option_results}->{filter_raidgroupid}) && $self->{option_results}->{filter_raidgroupid} ne '' && + $values =~ /^Raid Group ID:\s+(\S+)/mi && $1 !~ /$self->{option_results}->{filter_raidgroupid}/) { + $skip_num_disks++; + $self->{output}->output_add(long_msg => "Skipping disk '" . $disk_instance . "': no matching filter raid group id"); + next; + } + + $total_num_disks++; + $values =~ /^State:\s+(.*?)(\n|$)/msi; + + my $state = centreon::plugins::misc::trim($1); + my $exit = $self->get_severity(value => $state); + if (!$self->{output}->is_status(litteral => 1, value => $exit, compare => 'ok')) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Disk '%s' state is %s", + $disk_instance, $state)); + # Don't check values if in critical/warning + next; + } + + # Work on values. No check if in 'Hot Spare Ready' or 'Unbound' + next if ($state =~ /^(Hot Spare Ready|Unbound)$/i); + + my ($short_msg, $long_msg) = ('', ''); + my @exits; + foreach (keys %{$maps_counters}) { + next if ($values !~ /$maps_counters->{$_}->{matching}/msi); + my ($value_check, $value_output) = &{$maps_counters->{$_}->{closure}}($self, + instance => $disk_instance, label => $_); + next if (!defined($value_check)); + my ($warning, $critical); + + foreach my $name (keys %{$maps_counters->{$_}->{thresholds}}) { + my $exit2 = $self->{perfdata}->threshold_check(value => $value_check, threshold => [ { label => $maps_counters->{$_}->{thresholds}->{$name}->{label}, 'exit_litteral' => $maps_counters->{$_}->{thresholds}->{$name}->{exit_value} }]); + $long_msg .= ' ' . sprintf($maps_counters->{$_}->{output_msg}, $value_output); + if (!$self->{output}->is_status(litteral => 1, value => $exit2, compare => 'ok')) { + $short_msg .= ' ' . sprintf($maps_counters->{$_}->{output_msg}, $value_output); + } + push @exits, $exit2; + + $warning = $self->{perfdata}->get_perfdata_for_output(label => $maps_counters->{$_}->{thresholds}->{$name}->{label}) if ($maps_counters->{$_}->{thresholds}->{$name}->{exit_value} eq 'warning'); + $critical = $self->{perfdata}->get_perfdata_for_output(label => $maps_counters->{$_}->{thresholds}->{$name}->{label}) if ($maps_counters->{$_}->{thresholds}->{$name}->{exit_value} eq 'critical'); + } + + $self->{output}->output_add(long_msg => "Disk '$disk_instance':$long_msg"); + $self->{output}->perfdata_add(label => $_ . '_' . $disk_instance, unit => $maps_counters->{$_}->{unit}, + value => sprintf($maps_counters->{$_}->{perfdata}, $value_check), + warning => $warning, + critical => $critical, + min => 0); + } + + $exit = $self->{output}->get_most_critical(status => [ @exits ]); + if (!$self->{output}->is_status(litteral => 1, value => $exit, compare => 'ok')) { + $self->{output}->output_add(severity => $exit, + short_msg => "Disk '$disk_instance':$short_msg" + ); + } + } + + $self->{output}->output_add(severity => 'OK', + short_msg => sprintf("All %s disks are ok.", + $total_num_disks . '/' . $skip_num_disks) + ); + $self->{statefile_value}->write(data => $self->{new_datas}); + $self->{output}->display(); + $self->{output}->exit(); +} + +1; + +__END__ + +=head1 MODE + +Check the status of the physical disks. + +=over 8 + +=item B<--warning-*> + +Threshold warning. +Can be: 'read-errors', 'write-errors', 'read-io', 'write-io', 'utils'. + +=item B<--critical-*> + +Threshold critical. +Can be: 'read-errors', 'write-errors', 'read-io', 'write-io', 'utils'. + +=item B<--threshold-overload> + +Set to overload default threshold value. +Example: --threshold-overload='(enabled)=critical' + +=item B<--filter-disk> + +Filter Disk (regexp can be used). +Example: 1_7_14 ([BUS]_[ENCLOSURE]_[DISK]). + +=item B<--filter-raidgroupid> + +Filter Raid Group ID (regexp can be used). +Example: N/A or a number. + +=back + +=cut diff --git a/centreon-plugins/storage/emc/clariion/mode/listluns.pm b/centreon-plugins/storage/emc/clariion/mode/listluns.pm index f1053de1b..cdaa890df 100644 --- a/centreon-plugins/storage/emc/clariion/mode/listluns.pm +++ b/centreon-plugins/storage/emc/clariion/mode/listluns.pm @@ -198,7 +198,7 @@ Example: N/A, SATAII, Fibre Channel,... Filter Raid types (regexp can be used). Example: N/A, Hot Spare, RAID5,... -=item B<--filter-raidtype> +=item B<--filter-raidgroupid> Filter Raid Group ID (regexp can be used). Example: N/A or a number. diff --git a/centreon-plugins/storage/emc/clariion/mode/sp.pm b/centreon-plugins/storage/emc/clariion/mode/sp.pm index 11448704c..1973075f3 100644 --- a/centreon-plugins/storage/emc/clariion/mode/sp.pm +++ b/centreon-plugins/storage/emc/clariion/mode/sp.pm @@ -33,164 +33,42 @@ # #################################################################################### -package storage::emc::clariion::mode::sp; - -use base qw(centreon::plugins::mode); +package storage::emc::clariion::mode::spcomponents::sp; 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' }, - }); +my %conditions = ( + 1 => ['^(?!(Present|Valid)$)' => 'CRITICAL'], +); - $self->{components} = {}; - $self->{no_components} = undef; - - return $self; -} +sub check { + my ($self) = @_; -sub check_options { - my ($self, %options) = @_; - $self->SUPER::init(%options); + $self->{output}->output_add(long_msg => "Checking sp"); + $self->{components}->{sp} = {name => 'sp', total => 0, skip => 0}; + return if ($self->check_exclude(section => 'sp')); - 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'; + # 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; + } } } } -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 +1; \ No newline at end of file diff --git a/centreon-plugins/storage/emc/clariion/plugin.pm b/centreon-plugins/storage/emc/clariion/plugin.pm index e0370177c..bbf179936 100644 --- a/centreon-plugins/storage/emc/clariion/plugin.pm +++ b/centreon-plugins/storage/emc/clariion/plugin.pm @@ -49,6 +49,7 @@ sub new { $self->{version} = '0.1'; %{$self->{modes}} = ( 'cache' => 'storage::emc::clariion::mode::cache', + 'disk' => 'storage::emc::clariion::mode::disk', 'sp' => 'storage::emc::clariion::mode::sp', 'faults' => 'storage::emc::clariion::mode::faults', 'list-luns' => 'storage::emc::clariion::mode::listluns',