(plugin) storage::ibm::storwize::ssh - mode hardware add option --add-name-instance (#4391)

This commit is contained in:
qgarnier 2023-04-28 10:08:10 +02:00 committed by GitHub
parent 2702d91a76
commit 2bf68587a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 78 additions and 43 deletions

View File

@ -453,7 +453,9 @@ sub get_severity {
my ($self, %options) = @_;
my $status = 'UNKNOWN'; # default
foreach (@{$self->{overload_th}}) {
$options{instance} .= '#' . $options{name} if (defined($self->{option_results}->{add_name_instance}) && defined($options{name}));
foreach (@{$self->{overload_th}}) {
if ($options{section} =~ /$_->{section}/i) {
if ($options{value} =~ /$_->{filter}/i &&
(!defined($options{instance}) || $options{instance} =~ /$_->{instance}/)) {

View File

@ -41,7 +41,7 @@ sub check {
my $result = $self->{custom}->get_hasharray(content => $content, delim => ':');
foreach (@$result) {
next if ($self->check_filter(section => 'array', instance => $_->{mdisk_id}));
next if ($self->check_filter(section => 'array', instance => $_->{mdisk_id}, name => $_->{mdisk_name}));
$self->{components}->{array}->{total}++;
$self->{output}->output_add(
@ -52,7 +52,13 @@ sub check {
$_->{mdisk_id}
)
);
my $exit = $self->get_severity(label => 'default', section => 'array', value => $_->{status});
my $exit = $self->get_severity(
label => 'default',
section => 'array',
instance => $_->{mdisk_id},
name => $_->{mdisk_name},
value => $_->{status}
);
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(
severity => $exit,

View File

@ -51,7 +51,7 @@ sub check {
$_->{id}
)
);
my $exit = $self->get_severity(label => 'default', section => 'drive', value => $_->{status});
my $exit = $self->get_severity(label => 'default', section => 'drive', instance => $_->{id}, value => $_->{status});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(
severity => $exit,

View File

@ -46,13 +46,13 @@ sub check {
$self->{output}->output_add(
long_msg => sprintf(
"enclosure '%s' status is '%s' [instance: %s].",
"enclosure '%s' status is '%s' [instance: %s]",
$_->{id},
$_->{status},
$_->{id}
)
);
my $exit = $self->get_severity(label => 'default', section => 'enclosure', value => $_->{status});
my $exit = $self->get_severity(label => 'default', section => 'enclosure', instance => $_->{id}, value => $_->{status});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(
severity => $exit,

View File

@ -47,13 +47,18 @@ sub check {
$self->{output}->output_add(
long_msg => sprintf(
"enclosure battery '%s' status is '%s' [instance: %s].",
"enclosure battery '%s' status is '%s' [instance: %s]",
$instance,
$_->{status},
$instance
)
);
my $exit = $self->get_severity(label => 'default', section => 'enclosurebattery', value => $_->{status});
my $exit = $self->get_severity(
label => 'default',
section => 'enclosurebattery',
instance => $instance,
value => $_->{status}
);
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(
severity => $exit,

View File

@ -47,13 +47,13 @@ sub check {
$self->{output}->output_add(
long_msg => sprintf(
"enclosure canister '%s' status is '%s' [instance: %s].",
"enclosure canister '%s' status is '%s' [instance: %s]",
$instance,
$_->{status},
$instance
)
);
my $exit = $self->get_severity(label => 'default', section => 'enclosurecanister', value => $_->{status});
my $exit = $self->get_severity(label => 'default', section => 'enclosurecanister', instance => $instance, value => $_->{status});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(
severity => $exit,

View File

@ -47,13 +47,13 @@ sub check {
$self->{output}->output_add(
long_msg => sprintf(
"enclosure power supply '%s' status is '%s' [instance: %s].",
"enclosure power supply '%s' status is '%s' [instance: %s]",
$instance,
$_->{status},
$instance
)
);
my $exit = $self->get_severity(label => 'default', section => 'enclosurepsu', value => $_->{status});
my $exit = $self->get_severity(label => 'default', section => 'enclosurepsu', instance => $instance, value => $_->{status});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(
severity => $exit,

View File

@ -41,18 +41,18 @@ sub check {
my $result = $self->{custom}->get_hasharray(content => $content, delim => ':');
foreach (@$result) {
next if ($self->check_filter(section => 'host', instance => $_->{id}));
next if ($self->check_filter(section => 'host', instance => $_->{id}, name => $_->{name}));
$self->{components}->{host}->{total}++;
$self->{output}->output_add(
long_msg => sprintf(
"host '%s' status is '%s' [instance: %s].",
"host '%s' status is '%s' [instance: %s]",
$_->{name},
$_->{status},
$_->{id}
)
);
my $exit = $self->get_severity(label => 'default', section => 'host', value => $_->{status});
my $exit = $self->get_severity(label => 'default', section => 'host',instance => $_->{id}, name => $_->{name}, value => $_->{status});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(
severity => $exit,

View File

@ -41,18 +41,18 @@ sub check {
my $result = $self->{custom}->get_hasharray(content => $content, delim => ':');
foreach (@$result) {
next if ($self->check_filter(section => 'mdisk', instance => $_->{id}));
next if ($self->check_filter(section => 'mdisk', instance => $_->{id}, name => $_->{name}));
$self->{components}->{mdisk}->{total}++;
$self->{output}->output_add(
long_msg => sprintf(
"mdisk '%s' status is '%s' [instance: %s].",
"mdisk '%s' status is '%s' [instance: %s]",
$_->{name},
$_->{status},
$_->{id}
)
);
my $exit = $self->get_severity(section => 'mdisk', value => $_->{status});
my $exit = $self->get_severity(section => 'mdisk', instance => $_->{id}, name => $_->{name}, value => $_->{status});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(
severity => $exit,

View File

@ -41,18 +41,18 @@ sub check {
my $result = $self->{custom}->get_hasharray(content => $content, delim => ':');
foreach (@$result) {
next if ($self->check_filter(section => 'node', instance => $_->{id}));
next if ($self->check_filter(section => 'node', instance => $_->{id}, name => $_->{name}));
$self->{components}->{node}->{total}++;
$self->{output}->output_add(
long_msg => sprintf(
"node '%s' status is '%s' [instance: %s].",
"node '%s' status is '%s' [instance: %s]",
$_->{name},
$_->{status},
$_->{id}
)
);
my $exit = $self->get_severity(label => 'default', section => 'node', value => $_->{status});
my $exit = $self->get_severity(label => 'default', section => 'node', instance => $_->{id}, name => $_->{name}, value => $_->{status});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(
severity => $exit,

View File

@ -41,19 +41,20 @@ sub check {
my $result = $self->{custom}->get_hasharray(content => $content, delim => ':');
foreach (@$result) {
next if ($self->check_filter(section => 'portfc', instance => $_->{id}));
my $name = $_->{node_name} . "." . $_->{WWPN};
next if ($self->check_filter(section => 'portfc', instance => $_->{id}, name => $name));
$self->{components}->{portfc}->{total}++;
my $name = $_->{node_name} . "." . $_->{WWPN};
$self->{output}->output_add(
long_msg => sprintf(
"portfc '%s' status is '%s' [instance: %s].",
"portfc '%s' status is '%s' [instance: %s]",
$name,
$_->{status},
$_->{id}
)
);
my $exit = $self->get_severity(section => 'portfc', value => $_->{status});
my $exit = $self->get_severity(section => 'portfc', instance => $_->{id}, name => $name, value => $_->{status});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(
severity => $exit,

View File

@ -41,19 +41,20 @@ sub check {
my $result = $self->{custom}->get_hasharray(content => $content, delim => ':');
foreach (@$result) {
next if ($self->check_filter(section => 'portsas', instance => $_->{id}));
my $name = $_->{node_name} . '.' . $_->{WWPN};
next if ($self->check_filter(section => 'portsas', instance => $_->{id}, name => $name));
$self->{components}->{portsas}->{total}++;
my $name = $_->{node_name} . "." . $_->{WWPN};
$self->{output}->output_add(
long_msg => sprintf(
"port sas '%s' status is '%s' [instance: %s].",
"port sas '%s' status is '%s' [instance: %s]",
$name,
$_->{status},
$_->{id}
)
);
my $exit = $self->get_severity(section => 'portsas', value => $_->{status});
my $exit = $self->get_severity(section => 'portsas', instance => $_->{id}, name => $name, value => $_->{status});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(
severity => $exit,

View File

@ -41,18 +41,24 @@ sub check {
my $result = $self->{custom}->get_hasharray(content => $content, delim => ':');
foreach (@$result) {
next if ($self->check_filter(section => 'quorum', instance => $_->{quorum_index}));
next if ($self->check_filter(section => 'quorum', instance => $_->{quorum_index}, name => $_->{controller_name}));
$self->{components}->{quorum}->{total}++;
$self->{output}->output_add(
long_msg => sprintf(
"quorum '%s' status is '%s' [instance: %s].",
"quorum '%s' status is '%s' [instance: %s]",
$_->{controller_name},
$_->{status},
$_->{quorum_index}
)
);
my $exit = $self->get_severity(label => 'default', section => 'quorum', value => $_->{status});
my $exit = $self->get_severity(
label => 'default',
section => 'quorum',
instance => $_->{quorum_index},
name => $_->{controller_name},
value => $_->{status}
);
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(
severity => $exit,

View File

@ -41,18 +41,22 @@ sub check {
my $result = $self->{custom}->get_hasharray(content => $content, delim => '\s+');
foreach (@$result) {
next if ($self->check_filter(section => 'systemstats', instance => $_->{stat_name}));
next if ($self->check_filter(section => 'systemstats', instance => $_->{stat_name}, name => $_->{stat_name}));
$self->{components}->{systemstats}->{total}++;
$self->{output}->output_add(
long_msg => sprintf(
"system stat '%s' value is '%s' [instance: %s].",
"system stat '%s' value is '%s' [instance: %s]",
$_->{stat_name},
$_->{stat_current},
$_->{stat_name}
)
);
my ($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'systemstats', instance => $_->{stat_name}, value => $_->{stat_current});
my ($exit, $warn, $crit, $checked) = $self->get_severity_numeric(
section => 'systemstats',
instance => $_->{stat_name},
value => $_->{stat_current}
);
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(
severity => $exit,

View File

@ -41,18 +41,24 @@ sub check {
my $result = $self->{custom}->get_hasharray(content => $content, delim => ':');
foreach (@$result) {
next if ($self->check_filter(section => 'vdisk', instance => $_->{id}));
next if ($self->check_filter(section => 'vdisk', instance => $_->{id}, name => $_->{name}));
$self->{components}->{vdisk}->{total}++;
$self->{output}->output_add(
long_msg => sprintf(
"vdisk '%s' status is '%s' [instance: %s].",
"vdisk '%s' status is '%s' [instance: %s]",
$_->{name},
$_->{status},
$_->{id}
)
);
my $exit = $self->get_severity(label => 'default', section => 'vdisk', value => $_->{status});
my $exit = $self->get_severity(
label => 'default',
section => 'vdisk',
instance => $_->{id},
name => $_->{name},
value => $_->{status}
);
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(
severity => $exit,

View File

@ -38,19 +38,19 @@ sub set_system {
['offline', 'CRITICAL'],
['degraded', 'WARNING'],
['excluded', 'OK'], # lsarray
['mask', 'OK'], # lshost
['mask', 'OK'] # lshost
],
portfc => [
['active', 'OK'],
['inactive_unconfigured', 'OK'],
['.*', 'CRITICAL'],
['.*', 'CRITICAL']
],
portsas => [
['online', 'OK'],
['offline_unconfigured', 'OK'],
['excluded', 'OK'],
['offline', 'CRITICAL'],
['degraded', 'WARNING'],
['degraded', 'WARNING']
],
mdisk => [
['online', 'OK'],
@ -58,8 +58,8 @@ sub set_system {
['offline', 'CRITICAL'],
['degraded_paths', 'WARNING'],
['degraded_ports', 'WARNING'],
['degraded', 'WARNING'],
],
['degraded', 'WARNING']
]
};
$self->{components_path} = 'storage::ibm::storwize::ssh::mode::components';
@ -103,6 +103,10 @@ Which component to check (Default: '.*').
Can be: 'array', 'drive', 'enclosure', 'enclosurebattery', 'enclosurecanister',
'enclosurepsu', 'host', 'portfc', 'portsas', 'vdisk', 'node', 'quorum', 'mdisk', 'systemstats'.
=item B<--add-name-instance>
Add literal description for instance value (used in filter, absent-problem and threshold options).
=item B<--filter>
Exclude some parts (comma seperated list) (Example: --filter=host --filter=enclosurecanister)