parent
8e34ef8d10
commit
512685c6c7
|
@ -107,8 +107,12 @@ sub get_items {
|
|||
$self->settings();
|
||||
|
||||
if (defined($options{parent})) {
|
||||
if (defined($options{$options{parent}}) && $options{$options{parent}} ne '') {
|
||||
$options{url} .= $options{parent} . '-' . $options{engine} . '/';
|
||||
if (defined($options{parent_filter}) && $options{parent_filter} ne '') {
|
||||
if ($options{parent_filter} =~ /^[0-9\-]+$/) {
|
||||
$options{url} .= $options{parent_filter_prefix} . $options{parent_filter} . '/';
|
||||
} else {
|
||||
$options{url} .= $options{parent_filter} . '/';
|
||||
}
|
||||
} else {
|
||||
$options{url} .= '*' . '/';
|
||||
}
|
||||
|
@ -133,8 +137,8 @@ sub get_items {
|
|||
my $engine_name;
|
||||
|
||||
if (defined($options{parent})) {
|
||||
$context->{parent} =~ /\/$options{parent}-(.*?)\//;
|
||||
$engine_name = $options{parent} . '-' . $1;
|
||||
$context->{parent} =~ /$options{parent_select}/;
|
||||
$engine_name = $1;
|
||||
$items->{$engine_name} = {} if (!defined($items->{$engine_name}));
|
||||
}
|
||||
|
||||
|
|
|
@ -29,8 +29,8 @@ my $thresholds = {
|
|||
component_opstatus => [
|
||||
['cluster-in-contact', 'OK'],
|
||||
['in-contact', 'OK'],
|
||||
['.*', 'CRITICAL'],
|
||||
],
|
||||
['.*', 'CRITICAL']
|
||||
]
|
||||
};
|
||||
|
||||
sub new {
|
||||
|
@ -38,10 +38,9 @@ sub new {
|
|||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"filter:s@" => { name => 'filter' },
|
||||
"threshold-overload:s@" => { name => 'threshold_overload' },
|
||||
$options{options}->add_options(arguments => {
|
||||
'filter:s@' => { name => 'filter' },
|
||||
'threshold-overload:s@' => { name => 'threshold_overload' }
|
||||
});
|
||||
|
||||
return $self;
|
||||
|
@ -93,8 +92,7 @@ sub run {
|
|||
$self->{output}->output_add(severity => 'OK',
|
||||
short_msg => 'All Cluster Witness components are OK');
|
||||
|
||||
my $urlbase = '/vplex/cluster-witness/components/';
|
||||
my $items = $vplex->get_items(url => $urlbase);
|
||||
my $items = $vplex->get_items(url => '/vplex/cluster-witness/components/');
|
||||
foreach my $name (sort keys %{$items}) {
|
||||
my $instance = $name;
|
||||
|
||||
|
|
|
@ -90,11 +90,14 @@ sub run {
|
|||
my ($self, %options) = @_;
|
||||
my $vplex = $options{custom};
|
||||
|
||||
my $urlbase = '/vplex/clusters/';
|
||||
my $items = $vplex->get_items(url => $urlbase,
|
||||
parent => 'cluster',
|
||||
engine => $self->{option_results}->{cluster},
|
||||
obj => 'devices');
|
||||
my $items = $vplex->get_items(
|
||||
url => '/vplex/clusters/',
|
||||
parent => 1,
|
||||
parent_filter => $self->{option_results}->{cluster},
|
||||
parent_filter_prefix => 'cluster-',
|
||||
parent_select => '/clusters/(.*?)/',
|
||||
obj => 'devices'
|
||||
);
|
||||
|
||||
$self->{output}->output_add(severity => 'OK',
|
||||
short_msg => 'All Cluster Devices are OK');
|
||||
|
|
|
@ -105,11 +105,14 @@ sub run {
|
|||
my ($self, %options) = @_;
|
||||
my $vplex = $options{custom};
|
||||
|
||||
my $urlbase = '/vplex/engines/';
|
||||
my $items = $vplex->get_items(url => $urlbase,
|
||||
parent => 'engine',
|
||||
engine => $self->{option_results}->{engine},
|
||||
obj => 'directors');
|
||||
my $items = $vplex->get_items(
|
||||
url => '/vplex/engines/',
|
||||
parent => 1,
|
||||
parent_filter => $self->{option_results}->{engine},
|
||||
parent_filter_prefix => 'engine-',
|
||||
parent_select => '/engines/(.*?)/',
|
||||
obj => 'directors'
|
||||
);
|
||||
|
||||
$self->{output}->output_add(severity => 'OK',
|
||||
short_msg => 'All Directors are OK');
|
||||
|
|
|
@ -100,8 +100,7 @@ sub run {
|
|||
$self->{output}->output_add(severity => 'OK',
|
||||
short_msg => 'All Distributed devices are OK');
|
||||
|
||||
my $urlbase = '/vplex/distributed-storage/distributed-devices/';
|
||||
my $items = $vplex->get_items(url => $urlbase);
|
||||
my $items = $vplex->get_items(url => '/vplex/distributed-storage/distributed-devices/');
|
||||
foreach my $name (sort keys %{$items}) {
|
||||
my $instance = $name;
|
||||
|
||||
|
|
|
@ -94,14 +94,17 @@ sub run {
|
|||
my ($self, %options) = @_;
|
||||
my $vplex = $options{custom};
|
||||
|
||||
my $urlbase = '/vplex/engines/';
|
||||
$self->{output}->output_add(severity => 'OK',
|
||||
short_msg => 'All Fans are OK');
|
||||
|
||||
my $items = $vplex->get_items(url => $urlbase,
|
||||
parent => 'engine',
|
||||
engine => $self->{option_results}->{engine},
|
||||
obj => 'fans');
|
||||
my $items = $vplex->get_items(
|
||||
url => '/vplex/engines/',
|
||||
parent => 1,
|
||||
parent_filter => $self->{option_results}->{engine},
|
||||
parent_filter_prefix => 'engine-',
|
||||
parent_select => '/engines/(.*?)/',
|
||||
obj => 'fans'
|
||||
);
|
||||
foreach my $engine_name (sort keys %{$items}) {
|
||||
foreach my $fan_name (sort keys %{$items->{$engine_name}}) {
|
||||
my $instance = $engine_name . '_' . $fan_name;
|
||||
|
|
|
@ -94,11 +94,14 @@ sub run {
|
|||
my ($self, %options) = @_;
|
||||
my $vplex = $options{custom};
|
||||
|
||||
my $urlbase = '/vplex/engines/';
|
||||
my $items = $vplex->get_items(url => $urlbase,
|
||||
parent => 'engine',
|
||||
engine => $self->{option_results}->{engine},
|
||||
obj => 'power-supplies');
|
||||
my $items = $vplex->get_items(
|
||||
url => '/vplex/engines/',
|
||||
parent => 1,
|
||||
parent_filter => $self->{option_results}->{engine},
|
||||
parent_filter_prefix => 'engine-',
|
||||
parent_select => '/engines/(.*?)/',
|
||||
obj => 'power-supplies'
|
||||
);
|
||||
|
||||
$self->{output}->output_add(severity => 'OK',
|
||||
short_msg => 'All Power supplies are OK');
|
||||
|
|
|
@ -89,11 +89,12 @@ sub run {
|
|||
my ($self, %options) = @_;
|
||||
my $vplex = $options{custom};
|
||||
|
||||
my $urlbase = '/vplex/clusters/';
|
||||
my $items = $vplex->get_items(
|
||||
url => $urlbase,
|
||||
parent => 'cluster',
|
||||
engine => $self->{option_results}->{cluster},
|
||||
url => '/vplex/clusters/',
|
||||
parent => 1,
|
||||
parent_filter => $self->{option_results}->{cluster},
|
||||
parent_filter_prefix => 'cluster-',
|
||||
parent_select => '/clusters/(.*?)/',
|
||||
obj => 'storage-elements/storage-volumes'
|
||||
);
|
||||
|
||||
|
|
|
@ -30,17 +30,17 @@ sub new {
|
|||
bless $self, $class;
|
||||
|
||||
$self->{version} = '1.0';
|
||||
%{$self->{modes}} = (
|
||||
$self->{modes} = {
|
||||
'psus' => 'storage::emc::vplex::restapi::mode::psus',
|
||||
'fans' => 'storage::emc::vplex::restapi::mode::fans',
|
||||
'distributed-devices' => 'storage::emc::vplex::restapi::mode::distributeddevices',
|
||||
'cluster-devices' => 'storage::emc::vplex::restapi::mode::clusterdevices',
|
||||
'storage-volumes' => 'storage::emc::vplex::restapi::mode::storagevolumes',
|
||||
'directors' => 'storage::emc::vplex::restapi::mode::directors',
|
||||
'cluster-communication' => 'storage::emc::vplex::restapi::mode::clustercommunication',
|
||||
);
|
||||
'cluster-communication' => 'storage::emc::vplex::restapi::mode::clustercommunication'
|
||||
};
|
||||
|
||||
$self->{custom_modes}{vplexapi} = 'storage::emc::vplex::restapi::custom::vplexapi';
|
||||
$self->{custom_modes}->{vplexapi} = 'storage::emc::vplex::restapi::custom::vplexapi';
|
||||
return $self;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue