commit
877b303b28
|
@ -113,17 +113,28 @@ sub run {
|
|||
#Subject Name
|
||||
} elsif ($self->{option_results}->{validity_mode} eq 'subject') {
|
||||
my @subject_matched = ();
|
||||
my @subject_name = Net::SSLeay::X509_get_subjectAltNames($cert);
|
||||
foreach my $subject_name (@subject_name) {
|
||||
if ($subject_name =~ /$self->{option_results}->{subjectname}/mi) {
|
||||
push @subject_matched, $subject_name;
|
||||
|
||||
my $subject = Net::SSLeay::X509_NAME_get_text_by_NID(
|
||||
Net::SSLeay::X509_get_subject_name($cert), 13); # NID_CommonName
|
||||
$subject =~s{\0$}{}; # work around Bug in Net::SSLeay <1.33
|
||||
if ($subject =~ /$self->{option_results}->{subjectname}/mi) {
|
||||
push @subject_matched, $subject;
|
||||
} else {
|
||||
$self->{output}->output_add(long_msg => sprintf("Subject Name '%s' is also present in Certificate", $subject), debug => 1);
|
||||
}
|
||||
|
||||
my @subject_alt_names = Net::SSLeay::X509_get_subjectAltNames($cert);
|
||||
for (my $i = 0; $i < $#subject_alt_names; $i++) {
|
||||
next if ($i % 2 == 0);
|
||||
if ($subject_alt_names[$i] =~ /$self->{option_results}->{subjectname}/mi) {
|
||||
push @subject_matched, $subject_alt_names[$i];
|
||||
} else {
|
||||
if ($subject_name =~ /[\w\-]+(\.[\w\-]+)*\.\w+/) {
|
||||
$self->{output}->output_add(long_msg => sprintf("Subject Name '%s' is also present in Certificate", $subject_name), debug => 1);
|
||||
}
|
||||
$self->{output}->output_add(long_msg => sprintf("Subject Name '%s' is also present in Certificate", $subject_alt_names[$i]), debug => 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (@subject_matched == 0) {
|
||||
$self->{output}->output_add(severity => 'CRITICAL',
|
||||
short_msg => sprintf("No Subject Name matched '%s' in Certificate", $self->{option_results}->{subjectname}));
|
||||
|
|
|
@ -306,7 +306,7 @@ sub request {
|
|||
$self->{output}->exit();
|
||||
}
|
||||
|
||||
$self->{headers} = $response->{headers};
|
||||
$self->{headers} = $response->headers();
|
||||
$self->{response} = $response;
|
||||
return $response->content;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,270 @@
|
|||
#
|
||||
# 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 network::netasq::snmp::mode::hanodes;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $instance_mode;
|
||||
|
||||
sub custom_node_threshold {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my ($exit, $threshold_value);
|
||||
$threshold_value = defined($instance_mode->{option_results}->{percent}) ? $self->{result_values}->{prct_dead} : $self->{result_values}->{dead_nodes} ;
|
||||
$exit = $self->{perfdata}->threshold_check(value => $threshold_value, threshold => [ { label => 'critical-' . $self->{label}, exit_litteral => 'critical' }, { label => 'warning-'. $self->{label}, exit_litteral => 'warning' } ]);
|
||||
return $exit;
|
||||
}
|
||||
|
||||
sub custom_node_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $msg = sprintf("Dead nodes: absolute: %d/%d - percentage: %.2f%% ",
|
||||
$self->{result_values}->{dead_nodes}, $self->{result_values}->{total_nodes}, $self->{result_values}->{prct_dead});
|
||||
return $msg;
|
||||
}
|
||||
|
||||
sub custom_node_calc {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{result_values}->{dead_nodes} = $options{new_datas}->{$self->{instance} . '_dead_nodes'};
|
||||
$self->{result_values}->{total_nodes} = $options{new_datas}->{$self->{instance} . '_total_nodes'};
|
||||
$self->{result_values}->{prct_dead} = $options{new_datas}->{$self->{instance} . '_prct_dead'};
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub custom_threshold_output {
|
||||
my ($self, %options) = @_;
|
||||
my $status = 'ok';
|
||||
my $message;
|
||||
|
||||
eval {
|
||||
local $SIG{__WARN__} = sub { $message = $_[0]; };
|
||||
local $SIG{__DIE__} = sub { $message = $_[0]; };
|
||||
|
||||
if (defined($instance_mode->{option_results}->{critical_state}) && $instance_mode->{option_results}->{critical_state} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{critical_state}") {
|
||||
$status = 'critical';
|
||||
} elsif (defined($instance_mode->{option_results}->{warning_state}) && $instance_mode->{option_results}->{warning_state} ne '' &&
|
||||
eval "$instance_mode->{option_results}->{warning_state}") {
|
||||
$status = 'warning';
|
||||
}
|
||||
};
|
||||
if (defined($message)) {
|
||||
$self->{output}->output_add(long_msg => 'filter status issue: ' . $message);
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
sub custom_state_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $msg = sprintf("state is '%s'", $self->{result_values}->{state});
|
||||
return $msg;
|
||||
}
|
||||
|
||||
sub custom_state_calc {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{result_values}->{state} = $options{new_datas}->{$self->{instance} . '_state'};
|
||||
$self->{result_values}->{display} = $options{new_datas}->{$self->{instance} . '_display'};
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'global', type => 0 },
|
||||
{ name => 'nodes', type => 1, cb_prefix_output => 'prefix_node_output', message_multiple => 'All HA nodes are OK' },
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{global} = [
|
||||
{ label => 'dead-nodes', set => {
|
||||
key_values => [ { name => 'dead_nodes' }, { name => 'prct_dead' }, { name => 'total_nodes' } ],
|
||||
closure_custom_calc => \&custom_node_calc,
|
||||
closure_custom_output => \&custom_node_output,
|
||||
closure_custom_threshold_check => \&custom_node_threshold,
|
||||
perfdatas => [
|
||||
{ label => 'dead_nodes', value => 'dead_nodes', template => '%d',
|
||||
min => 0, unit => 'nodes' },
|
||||
],
|
||||
}
|
||||
}
|
||||
];
|
||||
$self->{maps_counters}->{nodes} = [
|
||||
{ label => 'state', threshold => 0, set => {
|
||||
key_values => [ { name => 'state' }, { name => 'display' } ],
|
||||
closure_custom_calc => \&custom_state_calc,
|
||||
closure_custom_output => \&custom_state_output,
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => \&custom_threshold_output,
|
||||
}
|
||||
},
|
||||
{ label => 'health', set => {
|
||||
key_values => [ { name => 'health' }, { name => 'display' } ],
|
||||
output_template => 'node health: %s%%',
|
||||
perfdatas => [
|
||||
{ label => 'health', value => 'health_absolute', template => '%d',
|
||||
min => 0, max => 100, label_extra_instance => 1, instance_use => 'display_absolute' },
|
||||
],
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
sub prefix_node_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Node '" . $options{instance_value}->{display} . "' ";
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$self->{version} = '1.0';
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"filter-node:s" => { name => 'filter_node' },
|
||||
"percent" => { name => 'percent' },
|
||||
"warning-state:s" => { name => 'warning_state', default => '' },
|
||||
"critical-state:s" => { name => 'critical_state', default => '%{state} eq "offline"' },
|
||||
});
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub change_macros {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
foreach (('warning_state', 'critical_state')) {
|
||||
if (defined($self->{option_results}->{$_})) {
|
||||
$self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
$self->change_macros();
|
||||
$instance_mode = $self;
|
||||
}
|
||||
|
||||
my %map_status = (
|
||||
1 => 'online',
|
||||
2 => 'offline',
|
||||
);
|
||||
|
||||
my $mapping = {
|
||||
ntqFwSerial => { oid => '.1.3.6.1.4.1.11256.1.11.7.1.2' },
|
||||
ntqHAQuality => { oid => '.1.3.6.1.4.1.11256.1.11.7.1.7' },
|
||||
ntqOnline => { oid => '.1.3.6.1.4.1.11256.1.11.7.1.3', map => \%map_status },
|
||||
};
|
||||
|
||||
my $oid_ntqNodeTable = '.1.3.6.1.4.1.11256.1.11.7';
|
||||
my $oid_ntqNbNode = '.1.3.6.1.4.1.11256.1.11.1';
|
||||
my $oid_ntqNbDeadNode = '.1.3.6.1.4.1.11256.1.11.2';
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
$self->{snmp} = $options{snmp};
|
||||
|
||||
$self->{results} = $options{snmp}->get_multiple_table(oids => [ { oid => $oid_ntqNodeTable },
|
||||
{ oid => $oid_ntqNbNode },
|
||||
{ oid => $oid_ntqNbDeadNode } ],
|
||||
nothing_quit => 1);
|
||||
|
||||
foreach my $oid (keys %{$self->{results}->{$oid_ntqNodeTable}}) {
|
||||
$oid =~ /^$mapping->{ntqOnline}->{oid}\.(.*)$/;
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_ntqNodeTable}, instance => $instance);
|
||||
|
||||
if (defined($self->{option_results}->{filter_node}) && $self->{option_results}->{filter_node} ne '' &&
|
||||
$result->{ntqFwSerial} !~ /$self->{option_results}->{filter_node}/) {
|
||||
$self->{output}->output_add(long_msg => "Skipping '" . $result->{ntqFwSerial} . "': no matching filter.", debug => 1);
|
||||
next;
|
||||
}
|
||||
$self->{nodes}->{$result->{ntqFwSerial}} = { state => $result->{ntqOnline},
|
||||
health => $result->{ntqHAQuality},
|
||||
display => $result->{ntqFwSerial} };
|
||||
}
|
||||
|
||||
my $prct_dead = $self->{results}->{$oid_ntqNbDeadNode}->{$oid_ntqNbDeadNode . '.' . '0'}/$self->{results}->{$oid_ntqNbNode}->{$oid_ntqNbNode . '.' . '0'}*100;
|
||||
|
||||
$self->{global} = { dead_nodes => $self->{results}->{$oid_ntqNbDeadNode}->{$oid_ntqNbDeadNode . '.' . '0'},
|
||||
toatl_nodes => $self->{results}->{$oid_ntqNbDeadNode}->{$oid_ntqNbNode . '.' . '0'},
|
||||
prct_dead => $prct_dead };
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check Netasq dead nodes and state and health of nodes
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--filter-node>
|
||||
|
||||
Filter name with regexp (based on serial)
|
||||
|
||||
=item B<--warning-health>
|
||||
|
||||
Warning on health level. (e.g --warning 90:)
|
||||
|
||||
=item B<--critical-health>
|
||||
|
||||
Critical on health level. (e.g --critical 80:)
|
||||
|
||||
=item B<--warning-dead-nodes>
|
||||
|
||||
Warning on deadnode (absolute unless --percent is used)
|
||||
|
||||
=item B<--critical-dead-nodes>
|
||||
|
||||
Critical on deadnode (absolute unless --percent is used)
|
||||
|
||||
=item B<--warning-state>
|
||||
|
||||
Set warning threshold for status. Use "%{state}" as a special variable.
|
||||
Value can be 'online' or 'offline'.
|
||||
|
||||
=item B<--critical-state>
|
||||
|
||||
Set critical threshold for status. Use "%{state}" as a special variable.
|
||||
Value can be 'online' or 'offline'.
|
||||
|
||||
=item B<--percent>
|
||||
|
||||
Set this option if you want to warn on percent
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -1,105 +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 network::netasq::snmp::mode::hastatus;
|
||||
|
||||
use base qw(centreon::plugins::mode);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$self->{version} = '1.0';
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"warning:s" => { name => 'warning' },
|
||||
"critical:s" => { name => 'critical' },
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::init(%options);
|
||||
|
||||
if (($self->{perfdata}->threshold_validate(label => 'warning', value => $self->{option_results}->{warning})) == 0) {
|
||||
$self->{output}->add_option_msg(short_msg => "Wrong warning threshold '" . $self->{option_results}->{warning} . "'.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
if (($self->{perfdata}->threshold_validate(label => 'critical', value => $self->{option_results}->{critical})) == 0) {
|
||||
$self->{output}->add_option_msg(short_msg => "Wrong critical threshold '" . $self->{option_results}->{critical} . "'.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
}
|
||||
|
||||
sub run {
|
||||
my ($self, %options) = @_;
|
||||
# $options{snmp} = snmp object
|
||||
$self->{snmp} = $options{snmp};
|
||||
|
||||
my $oid_ntqNbNode = '.1.3.6.1.4.1.11256.1.11.1.0';
|
||||
my $oid_ntqNbDeadNode = '.1.3.6.1.4.1.11256.1.11.2.0';
|
||||
my $result = $self->{snmp}->get_leef(oids => [$oid_ntqNbNode, $oid_ntqNbDeadNode], nothing_quit => 1);
|
||||
|
||||
if ($result->{$oid_ntqNbNode} == 1) {
|
||||
$self->{output}->output_add(severity => 'OK',
|
||||
short_msg => "Only one node. No ha.");
|
||||
} else {
|
||||
my $exit = $self->{perfdata}->threshold_check(value => $result->{$oid_ntqNbDeadNode}, threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("%d dead nodes on %d nodes",
|
||||
$result->{$oid_ntqNbDeadNode}, $result->{$oid_ntqNbNode}));
|
||||
$self->{output}->perfdata_add(label => 'dead_nodes',
|
||||
value => $result->{$oid_ntqNbDeadNode},
|
||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
|
||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
|
||||
min => 0, max => $result->{$oid_ntqNbNode});
|
||||
}
|
||||
|
||||
$self->{output}->display();
|
||||
$self->{output}->exit();
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check ha status.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--warning>
|
||||
|
||||
Threshold warning (number of dead nodes).
|
||||
|
||||
=item B<--critical>
|
||||
|
||||
Threshold critical (number of dead nodes).
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -38,7 +38,7 @@ sub new {
|
|||
'interfaces' => 'snmp_standard::mode::interfaces',
|
||||
'list-interfaces' => 'snmp_standard::mode::listinterfaces',
|
||||
'load' => 'snmp_standard::mode::loadaverage',
|
||||
'ha-status' => 'network::netasq::snmp::mode::hastatus',
|
||||
'ha-nodes' => 'network::netasq::snmp::mode::hanodes',
|
||||
'memory' => 'os::freebsd::snmp::mode::memory',
|
||||
'storage' => 'snmp_standard::mode::storage',
|
||||
'swap' => 'snmp_standard::mode::swap',
|
||||
|
|
|
@ -185,6 +185,7 @@ sub send_email {
|
|||
$send_email = 0 if ($status ne 'ok' && defined($prev_output) && $prev_output eq $subject);
|
||||
# recovery email
|
||||
$send_email = 1 if ($status eq 'ok' && defined($prev_status) && $prev_status ne 'ok');
|
||||
$self->{statefile_cache}->write(data => $self->{new_datas});
|
||||
}
|
||||
|
||||
my $smtp_to = '';
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
#
|
||||
# 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::vmax::local::mode::components::cabling;
|
||||
|
||||
use base qw(centreon::plugins::mode);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::plugins::misc;
|
||||
|
||||
#Ethernet cabling: OK
|
||||
#
|
||||
#+--------------------------------------------------+--------+----------------------+--------------------+----------------------+----------------------+------------+--------------+
|
||||
#| Cable Name | Status | Expected 'From' Port | Actual 'From' Port | Expected 'To' Port | Actual 'To' Port | Error Code | Error string |
|
||||
#+--------------------------------------------------+--------+----------------------+--------------------+----------------------+----------------------+------------+--------------+
|
||||
#| Cable from SRV A Adapter to MM-A ES-4 Lower port | OK | SRV A Adapter | SRV A Adapter | MM-A ES-4 Lower port | MM-A ES-4 Lower port | None | |
|
||||
#| Cable from SRV B Adapter to MM-B ES-4 Lower port | OK | SRV B Adapter | SRV B Adapter | MM-B ES-4 Lower port | MM-B ES-4 Lower port | None | |
|
||||
#+--------------------------------------------------+--------+----------------------+--------------------+----------------------+----------------------+------------+--------------+
|
||||
#| Cable Name | Status | Expected 'From' Port | Actual 'From' Port | Expected 'To' Port | Actual 'To' Port | Error Code | Error string |
|
||||
#+--------------------------------------------------+--------+----------------------+--------------------+----------------------+----------------------+------------+--------------+
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking cabling");
|
||||
$self->{components}->{cabling} = {name => 'cabling', total => 0, skip => 0};
|
||||
return if ($self->check_filter(section => 'cabling'));
|
||||
|
||||
if ($self->{content_file_health_env} !~ /Ethernet cabling.*?Ethernet cabling.*?---------.*?Cable Name.*?---------.*?\n(.*?\n)\+---------/msi) {
|
||||
$self->{output}->output_add(long_msg => 'skipping: cannot find cabling');
|
||||
return ;
|
||||
}
|
||||
|
||||
my $content = $1;
|
||||
while ($content =~ /^\|(.*?)\|(.*?)\|.*?\n/msig) {
|
||||
my ($cabling, $status) = (centreon::plugins::misc::trim($1), centreon::plugins::misc::trim($2));
|
||||
|
||||
next if ($self->check_filter(section => 'cabling', instance => $cabling));
|
||||
$self->{components}->{cabling}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("cabling '%s' status is '%s'",
|
||||
$cabling, $status));
|
||||
my $exit = $self->get_severity(label => 'default', section => 'cabling', value => $status);
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Cabling '%s' status is '%s'",
|
||||
$cabling, $status));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -0,0 +1,72 @@
|
|||
#
|
||||
# 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::vmax::local::mode::components::director;
|
||||
|
||||
use base qw(centreon::plugins::mode);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::plugins::misc;
|
||||
|
||||
#Directors status: OK
|
||||
#
|
||||
#+----------+--------+---------+-------------+---------+-----------------+-------------+
|
||||
#| Director | Type | State | Flags | Version | Address | Last Update |
|
||||
#+----------+--------+---------+-------------+---------+-----------------+-------------+
|
||||
#| 07A | DA_4x1 | Online | [ON] (0x80) | 05 | 192.168.177.7 | 1110 |
|
||||
#| 07B | DA_4x1 | Online | [ON] (0x80) | 05 | 192.168.177.23 | 1110 |
|
||||
#| 07C | DA_4x1 | Online | [ON] (0x80) | 05 | 192.168.177.39 | 1110 |
|
||||
#| 07D | DA_4x1 | Online | [ON] (0x80) | 05 | 192.168.177.55 | 1110 |
|
||||
#+----------+--------+---------+-------------+---------+-----------------+-------------+
|
||||
#| Director | Type | State | Flags | Version | Address | Last Update |
|
||||
#+----------+--------+---------+-------------+---------+-----------------+-------------+
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking directors");
|
||||
$self->{components}->{director} = {name => 'directors', total => 0, skip => 0};
|
||||
return if ($self->check_filter(section => 'director'));
|
||||
|
||||
if ($self->{content_file_health_env} !~ /Ethernet cabling.*?Directors status.*?---------.*?Director.*?---------.*?\n(.*?\n)\+---------/msi) {
|
||||
$self->{output}->output_add(long_msg => 'skipping: cannot find directors');
|
||||
return ;
|
||||
}
|
||||
|
||||
my $content = $1;
|
||||
while ($content =~ /^\|(.*?)\|.*?\|(.*?)\|.*?\n/msig) {
|
||||
my ($director, $status) = (centreon::plugins::misc::trim($1), centreon::plugins::misc::trim($2));
|
||||
|
||||
next if ($self->check_filter(section => 'director', instance => $director));
|
||||
$self->{components}->{director}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("director '%s' status is '%s'",
|
||||
$director, $status));
|
||||
my $exit = $self->get_severity(label => 'default', section => 'director', value => $status);
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Director '%s' status is '%s'",
|
||||
$director, $status));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -0,0 +1,91 @@
|
|||
#
|
||||
# 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::vmax::local::mode::components::fabric;
|
||||
|
||||
use base qw(centreon::plugins::mode);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::plugins::misc;
|
||||
|
||||
#Fabric system: OK
|
||||
#
|
||||
#+-------------------------------------------------+---------------------------------+
|
||||
#| Item | Status |
|
||||
#+-------------------------------------------------+---------------------------------+
|
||||
#| Fabric System General Status | OK |
|
||||
#| Usage Mode | Full usage - BOSCO and Ethernet |
|
||||
#| Initialization Status | OK |
|
||||
#| Configuration Status | OK |
|
||||
#| Fabric A Availability | Available |
|
||||
#| Fabric B Availability | Available |
|
||||
#| Directors' Fabric Links Status | OK |
|
||||
#| Dir 7 (RIO 0x0C) | All links are up |
|
||||
#| Link A status | Up |
|
||||
#| Link B status | Up |
|
||||
#+-------------------------------------------------+---------------------------------+
|
||||
#| Item | Status |
|
||||
#+-------------------------------------------------+---------------------------------+
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking fabrics");
|
||||
$self->{components}->{fabric} = {name => 'fabrics', total => 0, skip => 0};
|
||||
return if ($self->check_filter(section => 'fabric'));
|
||||
|
||||
if ($self->{content_file_health_env} !~ /Ethernet cabling.*?Fabric system.*?---------.*?Item.*?---------.*?\n(.*?\n)\+---------/msi) {
|
||||
$self->{output}->output_add(long_msg => 'skipping: cannot find fabrics');
|
||||
return ;
|
||||
}
|
||||
|
||||
my $content = $1;
|
||||
|
||||
my $total_components = 0;
|
||||
my @stack = ({ indent => 0, long_instance => '' });
|
||||
while ($content =~ /^\|([ \t]+)(.*?)\|(.*?)\|\n/msig) {
|
||||
my ($indent, $name, $status) = (length($1), centreon::plugins::misc::trim($2), centreon::plugins::misc::trim($3));
|
||||
|
||||
pop @stack while ($indent <= $stack[$#stack]->{indent});
|
||||
|
||||
my $long_instance = $stack[$#stack]->{long_instance} . '>' . $name;
|
||||
if ($indent > $stack[$#stack]->{indent}) {
|
||||
push @stack, { indent => $indent,
|
||||
long_instance => $stack[$#stack]->{long_instance} . '>' . $name };
|
||||
}
|
||||
|
||||
next if ($name !~ /status/i);
|
||||
|
||||
next if ($self->check_filter(section => 'fabric', instance => $long_instance));
|
||||
$self->{components}->{fabric}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("fabric '%s' status is '%s'",
|
||||
$long_instance, $status));
|
||||
my $exit = $self->get_severity(label => 'default', section => 'fabric', value => $status);
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Fabric '%s' status is '%s'",
|
||||
$long_instance, $status));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -0,0 +1,71 @@
|
|||
#
|
||||
# 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::vmax::local::mode::components::module;
|
||||
|
||||
use base qw(centreon::plugins::mode);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::plugins::misc;
|
||||
|
||||
#Modules status (alarms): OK
|
||||
#+-------------------------------------------------------------------+-----------+----------+--------+------------+
|
||||
#| Module | Ctrl dirs | Rep dirs | Status | Rel Status |
|
||||
#+-------------------------------------------------------------------+-----------+----------+--------+------------+
|
||||
#| Engine 4 | 07A,08A | 07A,08A | OK | |
|
||||
#| Engine SPS 4A | 07A | 07A | OK | |
|
||||
#| Engine SPS 4B | 08A | 08A | OK | |
|
||||
#| Engine Power Supply A of ES-4 | 07A | 07A | OK | |
|
||||
#+-------------------------------------------------------------------+-----------+----------+--------+------------+
|
||||
#| Module | Ctrl dirs | Rep dirs | Status | Rel Status |
|
||||
#+-------------------------------------------------------------------+-----------+----------+--------+------------+
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking modules");
|
||||
$self->{components}->{module} = {name => 'modules', total => 0, skip => 0};
|
||||
return if ($self->check_filter(section => 'module'));
|
||||
|
||||
if ($self->{content_file_health_env} !~ /Ethernet cabling.*?Modules status.*?---------.*?Module.*?---------.*?\n(.*?\n)\+---------/msi) {
|
||||
$self->{output}->output_add(long_msg => 'skipping: cannot find modules');
|
||||
return ;
|
||||
}
|
||||
|
||||
my $content = $1;
|
||||
while ($content =~ /^\|(.*?)\|.*?\|.*?\|(.*?)\|.*?\n/msig) {
|
||||
my ($module, $status) = (centreon::plugins::misc::trim($1), centreon::plugins::misc::trim($2));
|
||||
|
||||
next if ($self->check_filter(section => 'module', instance => $module));
|
||||
$self->{components}->{module}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("module '%s' status is '%s'",
|
||||
$module, $status));
|
||||
my $exit = $self->get_severity(label => 'default', section => 'module', value => $status);
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Module '%s' status is '%s'",
|
||||
$module, $status));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -0,0 +1,95 @@
|
|||
#
|
||||
# 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::vmax::local::mode::components::power;
|
||||
|
||||
use base qw(centreon::plugins::mode);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::plugins::misc;
|
||||
|
||||
#Power system: OK
|
||||
#
|
||||
#+--------------------------------------------------------+--------------------------------------+
|
||||
#| Item | Status |
|
||||
#+--------------------------------------------------------+--------------------------------------+
|
||||
#| Power input type | Three Phases |
|
||||
#| System Bay AC Zones Status | OK |
|
||||
#| AC Status Zone A | Zone AC OK |
|
||||
#| AC Status Zone B | Zone AC OK |
|
||||
#| Power modules status | OK |
|
||||
#| System Bay 1 | OK |
|
||||
#| Engine SPS 4A | OK |
|
||||
#| General Status | OK |
|
||||
#| Detailed Status | OK |
|
||||
#| Condition Register | OK |
|
||||
#| Battery Life (sec) | 600 |
|
||||
#| Days of Operation | Unknown |
|
||||
#| Slot | Slot B |
|
||||
#| Manufacturer Information | ASTEC,AA23540,7E, 04/11/2008 |
|
||||
#+--------------------------------------------------------+--------------------------------------+
|
||||
#| Item | Status |
|
||||
#+--------------------------------------------------------+--------------------------------------+
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking powers");
|
||||
$self->{components}->{power} = {name => 'powers', total => 0, skip => 0};
|
||||
return if ($self->check_filter(section => 'power'));
|
||||
|
||||
if ($self->{content_file_health_env} !~ /Ethernet cabling.*?Power system.*?---------.*?Item.*?---------.*?\n(.*?\n)\+---------/msi) {
|
||||
$self->{output}->output_add(long_msg => 'skipping: cannot find powers');
|
||||
return ;
|
||||
}
|
||||
|
||||
my $content = $1;
|
||||
|
||||
my $total_components = 0;
|
||||
my @stack = ({ indent => 0, long_instance => '' });
|
||||
while ($content =~ /^\|([ \t]+)(.*?)\|(.*?)\|\n/msig) {
|
||||
my ($indent, $name, $status) = (length($1), centreon::plugins::misc::trim($2), centreon::plugins::misc::trim($3));
|
||||
|
||||
pop @stack while ($indent <= $stack[$#stack]->{indent});
|
||||
|
||||
my $long_instance = $stack[$#stack]->{long_instance} . '>' . $name;
|
||||
if ($indent > $stack[$#stack]->{indent}) {
|
||||
push @stack, { indent => $indent,
|
||||
long_instance => $stack[$#stack]->{long_instance} . '>' . $name };
|
||||
}
|
||||
|
||||
next if ($name !~ /status/i);
|
||||
|
||||
next if ($self->check_filter(section => 'power', instance => $long_instance));
|
||||
$self->{components}->{power}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("power '%s' status is '%s'",
|
||||
$long_instance, $status));
|
||||
my $exit = $self->get_severity(label => 'default', section => 'power', value => $status);
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Power '%s' status is '%s'",
|
||||
$long_instance, $status));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -0,0 +1,62 @@
|
|||
#
|
||||
# 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::vmax::local::mode::components::sparedisk;
|
||||
|
||||
use base qw(centreon::plugins::mode);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
#06/15/2016 09:26:42.015 Verify Spare Status Test
|
||||
#There are 1 non available Spare[s], deferred service is ON.
|
||||
#06/15/2016 09:26:42.046 Verify Spare Status: Test Succeeded.
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking spare disks");
|
||||
$self->{components}->{sparedisk} = {name => 'spare disks', total => 0, skip => 0};
|
||||
return if ($self->check_filter(section => 'sparedisk'));
|
||||
|
||||
if ($self->{content_file_health} !~ /There are (\d+) non available Spare/msi) {
|
||||
$self->{output}->output_add(long_msg => 'skipping: cannot find spare disks');
|
||||
return ;
|
||||
}
|
||||
|
||||
my $value = $1;
|
||||
$self->{components}->{sparedisk}->{total}++;
|
||||
|
||||
my ($exit, $warn, $crit) = $self->get_severity_numeric(section => 'sparedisk', instance => '1', value => $value);
|
||||
$self->{output}->output_add(long_msg => sprintf("'%s' spare disk non availabled",
|
||||
$value));
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("'%s' spare disk non availabled",
|
||||
$value));
|
||||
}
|
||||
|
||||
$self->{output}->perfdata_add(label => "disk_spare_non_available",
|
||||
value => $value,
|
||||
warning => $warn,
|
||||
critical => $crit, min => 0);
|
||||
}
|
||||
|
||||
1;
|
|
@ -0,0 +1,74 @@
|
|||
#
|
||||
# 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::vmax::local::mode::components::temperature;
|
||||
|
||||
use base qw(centreon::plugins::mode);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::plugins::misc;
|
||||
|
||||
#Temperatures check: OK
|
||||
#
|
||||
#+-------------------+------------+------------+------------------+--------+
|
||||
#| Module | Temp [°C] | Temp [°F] | High Limit [°C] | Status |
|
||||
#+-------------------+------------+------------+------------------+--------+
|
||||
#| ES-PWS-A ES-4 | 24 | 75 | | OK |
|
||||
#| ES-PWS-B ES-4 | 22 | 71 | | OK |
|
||||
#| DIR-7 ES-4 | 34 | 93 | | OK |
|
||||
#| DIR-8 ES-4 | 36 | 96 | | OK |
|
||||
#| DIMM-0 DIR-7 ES-4 | 43 | 109 | 88 | OK |
|
||||
#| DIMM-1 DIR-7 ES-4 | 48 | 118 | 91 | OK |
|
||||
#+-------------------+------------+------------+------------------+--------+
|
||||
#| Module | Temp [°C] | Temp [°F] | High Limit [°C] | Status |
|
||||
#+-------------------+------------+------------+------------------+--------+
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking temperatures");
|
||||
$self->{components}->{temperature} = {name => 'temperatures', total => 0, skip => 0};
|
||||
return if ($self->check_filter(section => 'temperature'));
|
||||
|
||||
if ($self->{content_file_health_env} !~ /Ethernet cabling.*?Temperatures check.*?---------.*?Module.*?---------.*?\n(.*?\n)\+---------/msi) {
|
||||
$self->{output}->output_add(long_msg => 'skipping: cannot find temperatures');
|
||||
return ;
|
||||
}
|
||||
|
||||
my $content = $1;
|
||||
while ($content =~ /^\|(.*?)\|.*?\|.*?\|.*?\|(.*?)\|.*?\n/msig) {
|
||||
my ($temperature, $status) = (centreon::plugins::misc::trim($1), centreon::plugins::misc::trim($2));
|
||||
|
||||
next if ($self->check_filter(section => 'temperature', instance => $temperature));
|
||||
$self->{components}->{temperature}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("temperature '%s' status is '%s'",
|
||||
$temperature, $status));
|
||||
my $exit = $self->get_severity(label => 'default', section => 'temperature', value => $status);
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Temperature '%s' status is '%s'",
|
||||
$temperature, $status));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -0,0 +1,55 @@
|
|||
#
|
||||
# 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::vmax::local::mode::components::voltage;
|
||||
|
||||
use base qw(centreon::plugins::mode);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::plugins::misc;
|
||||
|
||||
#Voltages check: OK
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking voltage");
|
||||
$self->{components}->{voltage} = {name => 'voltage', total => 0, skip => 0};
|
||||
return if ($self->check_filter(section => 'voltage'));
|
||||
|
||||
if ($self->{content_file_health_env} !~ /Voltages check:(.*?)\n/msi) {
|
||||
$self->{output}->output_add(long_msg => 'skipping: cannot find voltage');
|
||||
return ;
|
||||
}
|
||||
|
||||
my $content = centreon::plugins::misc::trim($1);
|
||||
$self->{components}->{voltage}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("voltage status is '%s'",
|
||||
$content));
|
||||
my $exit = $self->get_severity(label => 'default', section => 'voltage', value => $content);
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Voltage status is '%s'",
|
||||
$content));
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -0,0 +1,273 @@
|
|||
#
|
||||
# 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::vmax::local::mode::hardware;
|
||||
|
||||
use base qw(centreon::plugins::templates::hardware);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::plugins::misc;
|
||||
use centreon::plugins::statefile;
|
||||
|
||||
sub set_system {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{regexp_threshold_numeric_check_section_option} = '^(sparedisk)$';
|
||||
|
||||
$self->{cb_hook1} = 'read_files';
|
||||
$self->{cb_hook4} = 'send_email';
|
||||
|
||||
$self->{thresholds} = {
|
||||
default => [
|
||||
['Recoverable Error', 'OK'], # Fabric
|
||||
['Online', 'OK'],
|
||||
['Up', 'OK'],
|
||||
['OK', 'OK'],
|
||||
['.*', 'CRITICAL'],
|
||||
],
|
||||
};
|
||||
|
||||
$self->{components_path} = 'storage::emc::symmetrix::vmax::local::mode::components';
|
||||
$self->{components_module} = ['module', 'temperature', 'director', 'cabling', 'power', 'fabric', 'voltage', 'sparedisk'];
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
$self->{statefile_cache}->check_options(%options);
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, no_absent => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$self->{version} = '1.0';
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"file-health:s" => { name => 'file_health' },
|
||||
"file-health-env:s" => { name => 'file_health_env' },
|
||||
# Email
|
||||
"email-warning:s" => { name => 'email_warning' },
|
||||
"email-critical:s" => { name => 'email_critical' },
|
||||
"email-smtp-host:s" => { name => 'email_smtp_host' },
|
||||
"email-smtp-username:s" => { name => 'email_smtp_username' },
|
||||
"email-smtp-password:s" => { name => 'email_smtp_password' },
|
||||
"email-smtp-from:s" => { name => 'email_smtp_from' },
|
||||
"email-smtp-options:s@" => { name => 'email_smtp_options' },
|
||||
"email-memory" => { name => 'email_memory' },
|
||||
});
|
||||
|
||||
$self->{statefile_cache} = centreon::plugins::statefile->new(%options);
|
||||
$self->{components_exec_load} = 0;
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub read_files {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
if (!defined($self->{option_results}->{file_health}) || !defined($self->{option_results}->{file_health_env})) {
|
||||
$self->{output}->add_option_msg(short_msg => "Please set option --file-health and --file-health-env.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
||||
foreach (('file_health', 'file_health_env')) {
|
||||
$self->{'content_' . $_} = do {
|
||||
local $/ = undef;
|
||||
if (!open my $fh, "<", $self->{option_results}->{$_}) {
|
||||
$self->{output}->add_option_msg(short_msg => "Could not open file $self->{option_results}->{$_} : $!");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
<$fh>;
|
||||
};
|
||||
# We remove color syntax
|
||||
$self->{'content_' . $_} =~ s/\x{1b}\[.*?m|\r//msg;
|
||||
}
|
||||
|
||||
#Health Check Results Log:
|
||||
#Service Processor Date: 06/15/2016 09:26:41
|
||||
#Symmetrix Date from director 07c: 06/15/2016 09:33:45
|
||||
#The time difference between Service Processor and Symmetrix is : 00:07:03.672
|
||||
#System SN: 000292602920
|
||||
#System Model: VMAX20K
|
||||
#mCode Level: 5876.288
|
||||
my ($serial) = ('unknown');
|
||||
$serial = $1 if ($self->{content_file_health} =~ /System SN:\s*(\S+)/msi);
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf('serial number: %s', $serial));
|
||||
}
|
||||
|
||||
#
|
||||
# maybe we should add it in core (with cleaner code ;)
|
||||
#
|
||||
|
||||
sub send_email {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
#######
|
||||
# Check SMTP options
|
||||
return if (!((defined($self->{option_results}->{email_warning}) && $self->{option_results}->{email_warning} ne '')
|
||||
|| (defined($self->{option_results}->{email_critical}) && $self->{option_results}->{email_critical} ne '')));
|
||||
|
||||
if (!defined($self->{option_results}->{email_smtp_host})) {
|
||||
$self->{output}->add_option_msg(short_msg => "Please set the --email-smtp-host option");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
if (!defined($self->{option_results}->{email_smtp_from})) {
|
||||
$self->{output}->add_option_msg(short_msg => "Please set --email-smtp-from option");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
||||
my %smtp_options = ('-auth' => 'none');
|
||||
if (defined($self->{option_results}->{email_smtp_username}) && $self->{option_results}->{email_smtp_username} ne '') {
|
||||
$smtp_options{-login} = $self->{option_results}->{email_smtp_username};
|
||||
delete $smtp_options{-auth};
|
||||
}
|
||||
if (defined($self->{option_results}->{email_smtp_username}) && defined($self->{option_results}->{email_smtp_password})) {
|
||||
$smtp_options{-pass} = $self->{option_results}->{email_smtp_password};
|
||||
}
|
||||
foreach my $option (@{$self->{option_results}->{email_smtp_options}}) {
|
||||
next if ($option !~ /^(.+?)=(.+)$/);
|
||||
$smtp_options{-$1} = $2;
|
||||
}
|
||||
|
||||
#######
|
||||
# Get current data
|
||||
my $stdout;
|
||||
{
|
||||
local *STDOUT;
|
||||
open STDOUT, '>', \$stdout;
|
||||
$self->{output}->display(force_long_output => 1);
|
||||
}
|
||||
|
||||
$stdout =~ /^(.*?)(\||\n)/msi;
|
||||
my $subject = $1;
|
||||
my $status = lc($self->{output}->get_litteral_status());
|
||||
|
||||
my $send_email = 0;
|
||||
$send_email = 1 if ($status ne 'ok');
|
||||
#######
|
||||
# Check memory file
|
||||
if (defined($self->{option_results}->{email_memory})) {
|
||||
$self->{new_datas} = { status => $status, output => $subject };
|
||||
$self->{statefile_cache}->read(statefile => "cache_emc_symmetrix_vmax_email");
|
||||
my $prev_status = $self->{statefile_cache}->get(name => 'status');
|
||||
my $prev_output = $self->{statefile_cache}->get(name => 'output');
|
||||
# non-ok output is the same
|
||||
$send_email = 0 if ($status ne 'ok' && defined($prev_output) && $prev_output eq $subject);
|
||||
# recovery email
|
||||
$send_email = 1 if ($status eq 'ok' && defined($prev_status) && $prev_status ne 'ok');
|
||||
$self->{statefile_cache}->write(data => $self->{new_datas});
|
||||
}
|
||||
|
||||
my $smtp_to = '';
|
||||
$smtp_to = $self->{option_results}->{email_warning} if ($status eq 'warning' && defined($self->{option_results}->{email_warning} && $self->{option_results}->{email_warning}) ne '');
|
||||
$smtp_to = $self->{option_results}->{email_critical} if ($status eq 'critical' && defined($self->{option_results}->{email_critical} && $self->{option_results}->{email_critical}) ne '');
|
||||
if ($send_email == 1 && $status eq 'ok') {
|
||||
my $append = '';
|
||||
foreach (('email_warning', 'email_critical')) {
|
||||
if (defined($self->{option_results}->{$_}) && $self->{option_results}->{$_} ne '') {
|
||||
$smtp_to .= $append . $self->{option_results}->{$_};
|
||||
$append .= ',';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($send_email == 0) {
|
||||
$self->{output}->add_option_msg(severity => 'OK', short_msg => "No email to send");
|
||||
return ;
|
||||
}
|
||||
|
||||
centreon::plugins::misc::mymodule_load(output => $self->{output}, module => 'Email::Send::SMTP::Gmail',
|
||||
error_msg => "Cannot load module 'Email::Send::SMTP::Gmail'.");
|
||||
my ($mail, $error) = Email::Send::SMTP::Gmail->new(-smtp => $self->{option_results}->{email_smtp_host},
|
||||
%smtp_options);
|
||||
if ($mail == -1) {
|
||||
$self->{output}->add_option_msg(short_msg => "session error: " . $error);
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
my $result = $mail->send(-to => $smtp_to,
|
||||
-from => $self->{option_results}->{email_smtp_from},
|
||||
-subject => $subject,
|
||||
-body => $stdout,
|
||||
-attachments => $self->{option_results}->{file_health_env});
|
||||
$mail->bye();
|
||||
if ($result == -1) {
|
||||
$self->{output}->add_option_msg(severity => 'UNKNOWN', short_msg => "problem to send the email");
|
||||
} else {
|
||||
$self->{output}->add_option_msg(severity => 'OK', short_msg => "email sent");
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check hardware.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--component>
|
||||
|
||||
Which component to check (Default: '.*').
|
||||
Can be: 'module', 'temperature', 'director, 'cabling', 'power', 'voltage', 'sparedisk'.
|
||||
|
||||
=item B<--filter>
|
||||
|
||||
Exclude some parts (comma seperated list) (Example: --filter=temperature --filter=module)
|
||||
Can also exclude specific instance: --filter=temperature,ES-PWS-A ES-4
|
||||
|
||||
=item B<--no-component>
|
||||
|
||||
Return an error if no compenents are checked.
|
||||
If total (with skipped) is 0. (Default: 'critical' returns).
|
||||
|
||||
=item B<--threshold-overload>
|
||||
|
||||
Set to overload default threshold values (syntax: section,[instance,]status,regexp)
|
||||
It used before default thresholds (order stays).
|
||||
Example: --threshold-overload='director,WARNING,^(?!(OK)$)'
|
||||
|
||||
=item B<--warning>
|
||||
|
||||
Set warning threshold for disk (syntax: type,regexp,threshold)
|
||||
Example: --warning='sparedisk,.*,5:'
|
||||
|
||||
=item B<--critical>
|
||||
|
||||
Set critical threshold for disk (syntax: type,regexp,threshold)
|
||||
Example: --critical='sparedisk,.*,3:'
|
||||
|
||||
=item B<--file-health>
|
||||
|
||||
The location of the global storage file status (Should be something like: C:/xxxx/HealthCheck.log).
|
||||
|
||||
=item B<--file-health-env>
|
||||
|
||||
The location of the environment storage file status (Should be something like: C:/xxxx/sumpl_env_health.log).
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
#
|
||||
# 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::vmax::local::plugin;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use base qw(centreon::plugins::script_simple);
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$self->{version} = '0.1';
|
||||
%{$self->{modes}} = (
|
||||
'hardware' => 'storage::emc::symmetrix::vmax::local::mode::hardware',
|
||||
);
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 PLUGIN DESCRIPTION
|
||||
|
||||
Check vmax storage. The plugin needs to be installed on Windows Management.
|
||||
|
||||
=cut
|
|
@ -44,18 +44,17 @@ sub check_options {
|
|||
$self->SUPER::init(%options);
|
||||
|
||||
if (($self->{perfdata}->threshold_validate(label => 'warning', value => $self->{option_results}->{warning})) == 0) {
|
||||
$self->{output}->add_option_msg(short_msg => "Wrong warning threshold '" . $self->{option_results}->{warning} . "'.");
|
||||
$self->{output}->option_exit();
|
||||
$self->{output}->add_option_msg(short_msg => "Wrong warning threshold '" . $self->{option_results}->{warning} . "'.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
if (($self->{perfdata}->threshold_validate(label => 'critical', value => $self->{option_results}->{critical})) == 0) {
|
||||
$self->{output}->add_option_msg(short_msg => "Wrong critical threshold '" . $self->{option_results}->{critical} . "'.");
|
||||
$self->{output}->option_exit();
|
||||
$self->{output}->add_option_msg(short_msg => "Wrong critical threshold '" . $self->{option_results}->{critical} . "'.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
}
|
||||
|
||||
sub run {
|
||||
my ($self, %options) = @_;
|
||||
# $options{snmp} = snmp object
|
||||
$self->{snmp} = $options{snmp};
|
||||
|
||||
my $oid_cacheAge = ".1.3.6.1.4.1.789.1.2.2.23.0";
|
||||
|
@ -63,13 +62,13 @@ sub run {
|
|||
my $result = $self->{snmp}->get_leef(oids => [$oid_cacheAge],
|
||||
nothing_quit => 1);
|
||||
|
||||
my $exit = $self->{perfdata}->threshold_check(value => $results->{$oid_cacheAge},
|
||||
my $exit = $self->{perfdata}->threshold_check(value => $result->{$oid_cacheAge},
|
||||
threshold => [ { label => 'critical', 'exit_litteral' => 'critical' },
|
||||
{ label => 'warning', exit_litteral => 'warning' } ]);
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Cache age is '%s' minutes", $results->{$oid_cacheAge}));
|
||||
short_msg => sprintf("Cache age is '%s' minutes", $result->{$oid_cacheAge}));
|
||||
$self->{output}->perfdata_add(label => 'cache_age', unit => 'm',
|
||||
value => $results->{$oid_cacheAge},
|
||||
value => $result->{$oid_cacheAge},
|
||||
warning => $self->{option_results}->{warning},
|
||||
critical => $self->{option_results}->{critical},
|
||||
min => 0);
|
||||
|
|
Loading…
Reference in New Issue