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