(plugin) storage::emc::unisphere::restapi - mode hardware add component memmodule (#4367)

This commit is contained in:
qgarnier 2023-04-19 13:41:15 +02:00 committed by GitHub
parent 326929d341
commit 954742ed7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 85 additions and 20 deletions

View File

@ -47,11 +47,11 @@ sub check {
my $health = $health_status->{ $result->{content}->{health}->{value} };
$self->{output}->output_add(
long_msg => sprintf(
"battery '%s' status is '%s' [instance = %s]",
$result->{content}->{name}, $health, $instance,
"battery '%s' status is '%s' [instance: %s]",
$result->{content}->{name}, $health, $instance
)
);
my $exit = $self->get_severity(label => 'health', section => 'battery', value => $health);
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(

View File

@ -47,8 +47,8 @@ sub check {
my $health = $health_status->{ $result->{content}->{health}->{value} };
$self->{output}->output_add(
long_msg => sprintf(
"disk '%s' status is '%s' [instance = %s]",
$result->{content}->{name}, $health, $instance,
"disk '%s' status is '%s' [instance: %s]",
$result->{content}->{name}, $health, $instance
)
);

View File

@ -47,8 +47,8 @@ sub check {
my $health = $health_status->{ $result->{content}->{health}->{value} };
$self->{output}->output_add(
long_msg => sprintf(
"dpe '%s' status is '%s' [instance = %s]",
$result->{content}->{name}, $health, $instance,
"dpe '%s' status is '%s' [instance: %s]",
$result->{content}->{name}, $health, $instance
)
);

View File

@ -47,8 +47,8 @@ sub check {
my $health = $health_status->{ $result->{content}->{health}->{value} };
$self->{output}->output_add(
long_msg => sprintf(
"fan '%s' status is '%s' [instance = %s]",
$result->{content}->{id}, $health, $instance,
"fan '%s' status is '%s' [instance: %s]",
$result->{content}->{id}, $health, $instance
)
);

View File

@ -47,8 +47,8 @@ sub check {
my $health = $health_status->{ $result->{content}->{health}->{value} };
$self->{output}->output_add(
long_msg => sprintf(
"iomodule '%s' status is '%s' [instance = %s]",
$result->{content}->{name}, $health, $instance,
"iomodule '%s' status is '%s' [instance: %s]",
$result->{content}->{name}, $health, $instance
)
);

View File

@ -0,0 +1,65 @@
#
# Copyright 2023 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
package storage::emc::unisphere::restapi::mode::components::memmodule;
use strict;
use warnings;
use storage::emc::unisphere::restapi::mode::components::resources qw($health_status);
sub load {
my ($self) = @_;
$self->{json_results}->{memmodules} = $self->{custom}->request_api(method => 'GET', url_path => '/api/types/memoryModule/instances?fields=name,health');
}
sub check {
my ($self) = @_;
$self->{output}->output_add(long_msg => 'checking memmodules');
$self->{components}->{memmodule} = { name => 'memmodules', total => 0, skip => 0 };
return if ($self->check_filter(section => 'memmodule'));
return if (!defined($self->{json_results}->{memmodules}));
foreach my $result (@{$self->{json_results}->{memmodules}->{entries}}) {
my $instance = $result->{content}->{id};
next if ($self->check_filter(section => 'memmodule', instance => $instance));
$self->{components}->{memmodule}->{total}++;
my $health = $health_status->{ $result->{content}->{health}->{value} };
$self->{output}->output_add(
long_msg => sprintf(
"memory module '%s' status is '%s' [instance: %s]",
$result->{content}->{name}, $health, $instance
)
);
my $exit = $self->get_severity(label => 'health', section => 'memmodule', value => $health);
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf("memory module '%s' status is '%s'", $result->{content}->{name}, $health)
);
}
}
}
1;

View File

@ -47,8 +47,8 @@ sub check {
my $health = $health_status->{ $result->{content}->{health}->{value} };
$self->{output}->output_add(
long_msg => sprintf(
"power supply '%s' status is '%s' [instance = %s]",
$result->{content}->{name}, $health, $instance,
"power supply '%s' status is '%s' [instance: %s]",
$result->{content}->{name}, $health, $instance
)
);

View File

@ -48,7 +48,7 @@ sub check {
my $health = $health_status->{ $result->{content}->{health}->{value} };
$self->{output}->output_add(
long_msg => sprintf(
"storage processor '%s' status is '%s' [instance = %s]",
"storage processor '%s' status is '%s' [instance: %s]",
$name, $health, $instance
)
);

View File

@ -48,7 +48,7 @@ sub check {
my $health = $health_status->{ $result->{content}->{health}->{value} };
$self->{output}->output_add(
long_msg => sprintf(
"ssd '%s' status is '%s' [instance = %s]",
"ssd '%s' status is '%s' [instance: %s]",
$name, $health, $instance
)
);

View File

@ -41,12 +41,12 @@ sub set_system {
['major', 'CRITICAL'],
['critical', 'CRITICAL'],
['non_recoverable', 'CRITICAL'],
['unknown', 'UNKNOWN'],
],
['unknown', 'UNKNOWN']
]
};
$self->{components_path} = 'storage::emc::unisphere::restapi::mode::components';
$self->{components_module} = ['disk', 'fan', 'iomodule', 'psu', 'dpe', 'battery', 'ssd', 'sp'];
$self->{components_module} = ['disk', 'fan', 'iomodule', 'memmodule', 'psu', 'dpe', 'battery', 'ssd', 'sp'];
}
sub new {
@ -76,7 +76,7 @@ Check hardware.
=item B<--component>
Which component to check (Default: '.*').
Can be: 'disk', 'fan', 'iomodule', 'psu', 'dpe', 'battery', 'ssd', 'sp'.
Can be: 'disk', 'fan', 'iomodule', 'memmodule', 'psu', 'dpe', 'battery', 'ssd', 'sp'.
=item B<--filter>