+ Add plugin for global health status smcli
dell MD3000, IBM DS3000, IBM DS4000, IBMD DS5000
This commit is contained in:
parent
7b15e0c6ac
commit
5b9b3c135b
|
@ -1,5 +1,5 @@
|
|||
################################################################################
|
||||
# Copyright 2005-2013 MERETHIS
|
||||
# Copyright 2005-2014 MERETHIS
|
||||
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
|
||||
# GPL Licence 2.0.
|
||||
#
|
||||
|
@ -33,7 +33,7 @@
|
|||
#
|
||||
####################################################################################
|
||||
|
||||
package centreon::common::emc::navisphere::custom::custom;
|
||||
package centreon::common::smcli::custom::custom;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
@ -69,6 +69,7 @@ sub new {
|
|||
"hostname2:s@" => { name => 'hostname2' },
|
||||
"password:s@" => { name => 'password' },
|
||||
"timeout:s@" => { name => 'timeout' },
|
||||
"show-output:s" => { name => 'show_output' },
|
||||
});
|
||||
}
|
||||
$options{options}->add_help(package => __PACKAGE__, sections => 'SMCLI OPTIONS', once => 1);
|
||||
|
@ -114,7 +115,7 @@ sub build_command {
|
|||
|
||||
$self->{cmd} = '';
|
||||
$self->{cmd} .= $self->{option_results}->{smcli_path} . '/' if (defined($self->{option_results}->{smcli_path}));
|
||||
$self->{cmd} .= $self->{option_results}->{smcli_path_command};
|
||||
$self->{cmd} .= $self->{option_results}->{smcli_command};
|
||||
|
||||
if (defined($self->{special_arg}) && $self->{special_arg} ne '') {
|
||||
$self->{cmd} .= ' ' . $self->{special_arg};
|
||||
|
@ -143,7 +144,7 @@ sub check_options {
|
|||
$self->{hostname2} = (defined($self->{option_results}->{hostname2})) ? shift(@{$self->{option_results}->{hostname2}}) : undef;
|
||||
$self->{password} = (defined($self->{option_results}->{password})) ? shift(@{$self->{option_results}->{password}}) : undef;
|
||||
$self->{timeout} = (defined($self->{option_results}->{timeout})) ? shift(@{$self->{option_results}->{timeout}}) : 30;
|
||||
$self->{extra_options} = (defined($self->{option_results}->{extra_options})) ? shift(@{$self->{option_results}->{extra_options}}) : '-quick';
|
||||
$self->{extra_options} = (defined($self->{option_results}->{extra_options})) ? shift(@{$self->{option_results}->{extra_options}}) : '-quick -S';
|
||||
$self->{special_arg} = (defined($self->{option_results}->{special_arg})) ? shift(@{$self->{option_results}->{special_arg}}) : undef;
|
||||
$self->{sudo} = $self->{option_results}->{sudo};
|
||||
|
||||
|
@ -168,13 +169,22 @@ sub execute_command {
|
|||
|
||||
# Need to set timeout over command.
|
||||
$self->{option_results}->{timeout} = $self->{timeout};
|
||||
return centreon::plugins::misc::execute(output => $self->{output},
|
||||
my ($response, $exit_code) = centreon::plugins::misc::execute(output => $self->{output},
|
||||
options => $self->{option_results},
|
||||
sudo => $self->{sudo},
|
||||
command => $self->{cmd},
|
||||
command_path => undef,
|
||||
command_options => undef
|
||||
command_options => undef,
|
||||
no_quit => 1
|
||||
);
|
||||
if ($exit_code != 0) {
|
||||
$self->{output}->output_add(severity => 'UNKNOWN',
|
||||
short_msg => "Command execution error (verbose mode for more details)");
|
||||
$self->{output}->output_add(long_msg => $response);
|
||||
$self->{output}->display();
|
||||
$self->{output}->exit();
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
1;
|
||||
|
@ -203,7 +213,7 @@ Specify navicli command (default: 'SMcli').
|
|||
|
||||
=item B<--extra-option>
|
||||
|
||||
Set SMcli extras options (Default: '-quick').
|
||||
Set SMcli extras options (Default: '-quick -S').
|
||||
|
||||
=item B<--sudo>
|
||||
|
||||
|
|
|
@ -0,0 +1,100 @@
|
|||
################################################################################
|
||||
# Copyright 2005-2014 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 <http://www.gnu.org/licenses>.
|
||||
#
|
||||
# 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 <qgarnier@merethis.com>
|
||||
#
|
||||
####################################################################################
|
||||
|
||||
package centreon::common::smcli::mode::healthstatus;
|
||||
|
||||
use base qw(centreon::plugins::mode);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
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 =>
|
||||
{
|
||||
"storage-command:s" => { name => 'storage_command', },
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::init(%options);
|
||||
}
|
||||
|
||||
sub run {
|
||||
my ($self, %options) = @_;
|
||||
my $smcli = $options{custom};
|
||||
|
||||
my $response = $smcli->execute_command(cmd => $self->{option_results}->{storage_command});
|
||||
# IBM smcli: Storage Subsystem health status = optimal.
|
||||
# Dell smcli: Storage array health status = optimal.
|
||||
|
||||
my $match_ok_regexp = 'health status.*optimal';
|
||||
$self->{output}->output_add(severity => 'OK',
|
||||
short_msg => sprintf("storage health status is optimal"));
|
||||
if ($response !~ /$match_ok_regexp/msi) {
|
||||
$self->{output}->output_add(severity => 'CRITICAL',
|
||||
short_msg => sprintf("Some failures have been found (verbose mode for more details)"));
|
||||
$self->{output}->output_add(long_msg => $response);
|
||||
}
|
||||
|
||||
$self->{output}->display();
|
||||
$self->{output}->exit();
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check health status
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--storage-command>
|
||||
|
||||
By default for Dell MD: 'show storageArray healthstatus;'
|
||||
By default for IBM DS: 'show storageSubsystem healthstatus;'
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -55,7 +55,7 @@ sub new {
|
|||
|
||||
sub init {
|
||||
my ($self, %options) = @_;
|
||||
# options{default} = [ {option_name => '', option_value => '' }, ]
|
||||
# options{default} = { mode_xxx => { option_name => option_value }, }
|
||||
|
||||
%{$self->{option_results}} = %{$options{option_results}};
|
||||
# Manage default value
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
################################################################################
|
||||
# Copyright 2005-2014 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 <http://www.gnu.org/licenses>.
|
||||
#
|
||||
# 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 <qgarnier@merethis.com>
|
||||
#
|
||||
####################################################################################
|
||||
|
||||
package storage::dell::MD3000::cli::plugin;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use base qw(centreon::plugins::script_custom);
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
# $options->{options} = options object
|
||||
|
||||
$self->{version} = '0.1';
|
||||
%{$self->{modes}} = (
|
||||
'health-status' => 'centreon::common::smcli::mode::healthstatus',
|
||||
);
|
||||
$self->{custom_modes}{smcli} = 'centreon::common::smcli::custom::custom';
|
||||
$self->{default} = { 'health-status' => { storage_command => 'show storageArray healthstatus;',
|
||||
smcli_path => '/opt/dell/mdstoragemanager/client' }, };
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub init {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->SUPER::init(%options);
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 PLUGIN DESCRIPTION
|
||||
|
||||
Check Dell MD3000 series.
|
||||
|
||||
=over 8
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,78 @@
|
|||
################################################################################
|
||||
# Copyright 2005-2014 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 <http://www.gnu.org/licenses>.
|
||||
#
|
||||
# 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 <qgarnier@merethis.com>
|
||||
#
|
||||
####################################################################################
|
||||
|
||||
package storage::ibm::DS3000::cli::plugin;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use base qw(centreon::plugins::script_custom);
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
# $options->{options} = options object
|
||||
|
||||
$self->{version} = '0.1';
|
||||
%{$self->{modes}} = (
|
||||
'health-status' => 'centreon::common::smcli::mode::healthstatus',
|
||||
);
|
||||
$self->{custom_modes}{smcli} = 'centreon::common::smcli::custom::custom';
|
||||
$self->{default} = { 'health-status' => { storage_command => 'show storageSubsystem healthstatus;',
|
||||
smcli_path => '/opt/IBM_DS/client' }, };
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub init {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->SUPER::init(%options);
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 PLUGIN DESCRIPTION
|
||||
|
||||
Check IBM DS3000 series.
|
||||
|
||||
=over 8
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,78 @@
|
|||
################################################################################
|
||||
# Copyright 2005-2014 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 <http://www.gnu.org/licenses>.
|
||||
#
|
||||
# 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 <qgarnier@merethis.com>
|
||||
#
|
||||
####################################################################################
|
||||
|
||||
package storage::ibm::DS3000::cli::plugin;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use base qw(centreon::plugins::script_custom);
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
# $options->{options} = options object
|
||||
|
||||
$self->{version} = '0.1';
|
||||
%{$self->{modes}} = (
|
||||
'health-status' => 'centreon::common::smcli::mode::healthstatus',
|
||||
);
|
||||
$self->{custom_modes}{smcli} = 'centreon::common::smcli::custom::custom';
|
||||
$self->{default} = { 'health-status' => { storage_command => 'show storageSubsystem healthstatus;',
|
||||
smcli_path => '/opt/IBM_DS/client' }, };
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub init {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->SUPER::init(%options);
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 PLUGIN DESCRIPTION
|
||||
|
||||
Check IBM DS4000 series.
|
||||
|
||||
=over 8
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,78 @@
|
|||
################################################################################
|
||||
# Copyright 2005-2014 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 <http://www.gnu.org/licenses>.
|
||||
#
|
||||
# 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 <qgarnier@merethis.com>
|
||||
#
|
||||
####################################################################################
|
||||
|
||||
package storage::ibm::DS3000::cli::plugin;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use base qw(centreon::plugins::script_custom);
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
# $options->{options} = options object
|
||||
|
||||
$self->{version} = '0.1';
|
||||
%{$self->{modes}} = (
|
||||
'health-status' => 'centreon::common::smcli::mode::healthstatus',
|
||||
);
|
||||
$self->{custom_modes}{smcli} = 'centreon::common::smcli::custom::custom';
|
||||
$self->{default} = { 'health-status' => { storage_command => 'show storageSubsystem healthstatus;',
|
||||
smcli_path => '/opt/IBM_DS/client' }, };
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub init {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->SUPER::init(%options);
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 PLUGIN DESCRIPTION
|
||||
|
||||
Check IBM DS5000 series.
|
||||
|
||||
=over 8
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
Loading…
Reference in New Issue