mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-27 15:44:21 +02:00
+ enhance emc dmx plugin
This commit is contained in:
parent
ce9d7f658b
commit
2bbf6084f3
@ -1,56 +0,0 @@
|
|||||||
#
|
|
||||||
# Copyright 2016 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::symmetrix::dmx34::local::mode::components::environment;
|
|
||||||
|
|
||||||
use base qw(centreon::plugins::mode);
|
|
||||||
|
|
||||||
use strict;
|
|
||||||
use warnings;
|
|
||||||
|
|
||||||
# -------------[ Power Information ]-------------
|
|
||||||
#
|
|
||||||
# No Environmental Problems found
|
|
||||||
sub check {
|
|
||||||
my ($self) = @_;
|
|
||||||
|
|
||||||
$self->{output}->output_add(long_msg => "Checking environment");
|
|
||||||
$self->{components}->{environment} = {name => 'environment', total => 0, skip => 0};
|
|
||||||
return if ($self->check_filter(section => 'environment'));
|
|
||||||
|
|
||||||
if ($self->{content_file_health} !~ /----\[ Power Information(.*?)----\[/msi) {
|
|
||||||
$self->{output}->output_add(long_msg => 'skipping: cannot find environment');
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
|
|
||||||
my $content = $1;
|
|
||||||
$self->{components}->{environment}->{total}++;
|
|
||||||
|
|
||||||
# Error if not present:
|
|
||||||
# No Environmental Problems found
|
|
||||||
if ($content !~ /No Environmental Problems found/msi) {
|
|
||||||
$self->{output}->output_add(severity => 'CRITICAL',
|
|
||||||
short_msg => sprintf("environment problem detected"));
|
|
||||||
} else {
|
|
||||||
$self->{output}->output_add(long_msg => sprintf("no environment problem detected"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
1;
|
|
75
storage/emc/symmetrix/dmx34/local/mode/components/fru.pm
Normal file
75
storage/emc/symmetrix/dmx34/local/mode/components/fru.pm
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
#
|
||||||
|
# Copyright 2016 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::symmetrix::dmx34::local::mode::components::fru;
|
||||||
|
|
||||||
|
use base qw(centreon::plugins::mode);
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use centreon::plugins::misc;
|
||||||
|
|
||||||
|
#FRU status (alarms) table:
|
||||||
|
#
|
||||||
|
#+---------------------+--------------------+-----------+
|
||||||
|
#| Description | FRU/Alarm Status | Comm. |
|
||||||
|
#+---------------------+--------------------+-----------+
|
||||||
|
#| Dir 01 | OK | 01A |
|
||||||
|
#| Dir 02 | OK | 02A |
|
||||||
|
#...
|
||||||
|
#| Backplane | OK | 01A,16A |
|
||||||
|
#+---------------------+--------------------+-----------+
|
||||||
|
#| Description | FRU/Alarm Status | Comm. |
|
||||||
|
#+---------------------+--------------------+-----------+
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#Analog readings:
|
||||||
|
|
||||||
|
sub check {
|
||||||
|
my ($self) = @_;
|
||||||
|
|
||||||
|
$self->{output}->output_add(long_msg => "Checking frus");
|
||||||
|
$self->{components}->{fru} = {name => 'frus', total => 0, skip => 0};
|
||||||
|
return if ($self->check_filter(section => 'fru'));
|
||||||
|
|
||||||
|
if ($self->{content_file_health_env} !~ /FRU status .*? table:.*?---------.*?Description.*?---------.*?\n(.*?\n)\+---------/msi) {
|
||||||
|
$self->{output}->output_add(long_msg => 'skipping: cannot find frus');
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $content = $1;
|
||||||
|
while ($content =~ /^\|(.*?)\|(.*?)\|.*?\n/msig) {
|
||||||
|
my ($fru, $status) = (centreon::plugins::misc::trim($1), centreon::plugins::misc::trim($2));
|
||||||
|
|
||||||
|
next if ($self->check_filter(section => 'fru', instance => $fru));
|
||||||
|
$self->{components}->{fru}->{total}++;
|
||||||
|
|
||||||
|
$self->{output}->output_add(long_msg => sprintf("fru '%s' status is '%s'",
|
||||||
|
$fru, $status));
|
||||||
|
my $exit = $self->get_severity(section => 'fru', value => $status);
|
||||||
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
|
$self->{output}->output_add(severity => $exit,
|
||||||
|
short_msg => sprintf("Fru '%s' status is '%s'",
|
||||||
|
$fru, $status));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
@ -54,10 +54,14 @@ sub set_system {
|
|||||||
['\.\./.*', 'OK'],
|
['\.\./.*', 'OK'],
|
||||||
['.*', 'CRITICAL'],
|
['.*', 'CRITICAL'],
|
||||||
],
|
],
|
||||||
|
fru => [
|
||||||
|
['OK', 'OK'],
|
||||||
|
['.*', 'CRITICAL'],
|
||||||
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
$self->{components_path} = 'storage::emc::symmetrix::dmx34::local::mode::components';
|
$self->{components_path} = 'storage::emc::symmetrix::dmx34::local::mode::components';
|
||||||
$self->{components_module} = ['director', 'xcm', 'disk', 'memory', 'config', 'environment', 'test'];
|
$self->{components_module} = ['director', 'xcm', 'disk', 'memory', 'config', 'test', 'fru'];
|
||||||
}
|
}
|
||||||
|
|
||||||
sub check_options {
|
sub check_options {
|
||||||
@ -100,17 +104,19 @@ sub read_files {
|
|||||||
$self->{output}->add_option_msg(short_msg => "Please set option --file-health and --file-health-env.");
|
$self->{output}->add_option_msg(short_msg => "Please set option --file-health and --file-health-env.");
|
||||||
$self->{output}->option_exit();
|
$self->{output}->option_exit();
|
||||||
}
|
}
|
||||||
$self->{content_file_health} = do {
|
|
||||||
|
foreach (('file_health', 'file_health_env')) {
|
||||||
|
$self->{'content_' . $_} = do {
|
||||||
local $/ = undef;
|
local $/ = undef;
|
||||||
if (!open my $fh, "<", $self->{option_results}->{file_health}) {
|
if (!open my $fh, "<", $self->{option_results}->{$_}) {
|
||||||
$self->{output}->add_option_msg(short_msg => "Could not open file $self->{option_results}->{file_health} : $!");
|
$self->{output}->add_option_msg(short_msg => "Could not open file $self->{option_results}->{$_} : $!");
|
||||||
$self->{output}->option_exit();
|
$self->{output}->option_exit();
|
||||||
}
|
}
|
||||||
<$fh>;
|
<$fh>;
|
||||||
};
|
};
|
||||||
|
|
||||||
# We remove color syntax
|
# We remove color syntax
|
||||||
$self->{content_file_health} =~ s/\x{1b}\[.*?m|\r//msg;
|
$self->{'content_' . $_} =~ s/\x{1b}\[.*?m|\r//msg;
|
||||||
|
}
|
||||||
|
|
||||||
# *****************************************************************
|
# *****************************************************************
|
||||||
#* Health Check Run From Scheduler Version 2.0 *
|
#* Health Check Run From Scheduler Version 2.0 *
|
||||||
@ -247,7 +253,7 @@ Check hardware.
|
|||||||
=item B<--component>
|
=item B<--component>
|
||||||
|
|
||||||
Which component to check (Default: '.*').
|
Which component to check (Default: '.*').
|
||||||
Can be: 'director', 'xcm', 'disk', 'memory', 'config', 'environment', 'test'
|
Can be: 'director', 'xcm', 'disk', 'memory', 'config', 'fru', 'test'
|
||||||
|
|
||||||
=item B<--filter>
|
=item B<--filter>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user