mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-28 16:14:21 +02:00
+ add moduleport in hp vc plugin
This commit is contained in:
parent
a513ea83b2
commit
28ab247fce
@ -0,0 +1,74 @@
|
|||||||
|
#
|
||||||
|
# Copyright 2015 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::hp::vc::snmp::mode::components::moduleport;
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use network::hp::vc::snmp::mode::components::resources qw($map_moduleport_loop_status $map_moduleport_protection_status);
|
||||||
|
|
||||||
|
my $mapping = {
|
||||||
|
vcModulePortBpduLoopStatus => { oid => '.1.3.6.1.4.1.11.5.7.5.2.3.1.1.6.1.3', map => $map_moduleport_loop_status },
|
||||||
|
vcModulePortProtectionStatus => { oid => '.1.3.6.1.4.1.11.5.7.5.2.3.1.1.6.1.4', map => $map_moduleport_protection_status },
|
||||||
|
};
|
||||||
|
my $oid_vcModulePortEntry = '.1.3.6.1.4.1.11.5.7.5.2.3.1.1.6.1';
|
||||||
|
|
||||||
|
sub load {
|
||||||
|
my ($self) = @_;
|
||||||
|
|
||||||
|
push @{$self->{request}}, { oid => $oid_vcModulePortEntry };
|
||||||
|
}
|
||||||
|
|
||||||
|
sub check {
|
||||||
|
my ($self) = @_;
|
||||||
|
|
||||||
|
$self->{output}->output_add(long_msg => "Checking module ports");
|
||||||
|
$self->{components}->{moduleport} = { name => 'module ports', total => 0, skip => 0 };
|
||||||
|
return if ($self->check_filter(section => 'moduleport'));
|
||||||
|
|
||||||
|
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_vcModulePortEntry}})) {
|
||||||
|
next if ($oid !~ /^$mapping->{vcModulePortBpduLoopStatus}->{oid}\.(.*)$/);
|
||||||
|
my $instance = $1;
|
||||||
|
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_vcModulePortEntry}, instance => $instance);
|
||||||
|
|
||||||
|
next if ($self->check_filter(section => 'moduleport', instance => $instance));
|
||||||
|
$self->{components}->{moduleport}->{total}++;
|
||||||
|
|
||||||
|
$self->{output}->output_add(long_msg => sprintf("module port '%s' loop status is '%s' [instance: %s, protection status: %s].",
|
||||||
|
$instance, $result->{vcModulePortBpduLoopStatus},
|
||||||
|
$instance, $result->{vcModulePortProtectionStatus}
|
||||||
|
));
|
||||||
|
my $exit = $self->get_severity(section => 'moduleport.loop', value => $result->{vcModulePortBpduLoopStatus});
|
||||||
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
|
$self->{output}->output_add(severity => $exit,
|
||||||
|
short_msg => sprintf("Module port '%s' loop status is '%s'",
|
||||||
|
$instance, $result->{vcModulePortBpduLoopStatus}));
|
||||||
|
}
|
||||||
|
|
||||||
|
$exit = $self->get_severity(section => 'moduleport.protection', value => $result->{vcModulePortProtectionStatus});
|
||||||
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
|
$self->{output}->output_add(severity => $exit,
|
||||||
|
short_msg => sprintf("Module port '%s' protection status is '%s'",
|
||||||
|
$instance, $result->{vcModulePortProtectionStatus}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
@ -26,9 +26,11 @@ use Exporter;
|
|||||||
|
|
||||||
our $map_managed_status;
|
our $map_managed_status;
|
||||||
our $map_reason_code;
|
our $map_reason_code;
|
||||||
|
our $map_moduleport_loop_status;
|
||||||
|
our $map_moduleport_protection_status;
|
||||||
|
|
||||||
our @ISA = qw(Exporter);
|
our @ISA = qw(Exporter);
|
||||||
our @EXPORT_OK = qw($map_managed_status $map_reason_code);
|
our @EXPORT_OK = qw($map_managed_status $map_reason_code $map_moduleport_loop_status $map_moduleport_protection_status);
|
||||||
|
|
||||||
$map_managed_status = {
|
$map_managed_status = {
|
||||||
1 => 'unknown',
|
1 => 'unknown',
|
||||||
@ -103,4 +105,15 @@ $map_reason_code = {
|
|||||||
901 => 'vcDomainPortMonitorIndirectlyDisabled',
|
901 => 'vcDomainPortMonitorIndirectlyDisabled',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$map_moduleport_protection_status = {
|
||||||
|
1 => 'ok',
|
||||||
|
2 => 'pause-flood-detected',
|
||||||
|
3 => 'in-pause-condition',
|
||||||
|
};
|
||||||
|
|
||||||
|
$map_moduleport_loop_status = {
|
||||||
|
1 => 'ok',
|
||||||
|
2 => 'loop-dectected',
|
||||||
|
};
|
||||||
|
|
||||||
1;
|
1;
|
@ -28,7 +28,7 @@ use warnings;
|
|||||||
sub set_system {
|
sub set_system {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
$self->{regexp_threshold_overload_check_section_option} = '^(domain|enclosure|module|port|physicalserver|enet|fc|profile)$';
|
$self->{regexp_threshold_overload_check_section_option} = '^(domain|enclosure|module|port|moduleport|physicalserver|enet|fc|profile)$';
|
||||||
|
|
||||||
$self->{cb_hook2} = 'snmp_execute';
|
$self->{cb_hook2} = 'snmp_execute';
|
||||||
|
|
||||||
@ -43,10 +43,19 @@ sub set_system {
|
|||||||
['disabled', 'OK'],
|
['disabled', 'OK'],
|
||||||
['info', 'OK'],
|
['info', 'OK'],
|
||||||
],
|
],
|
||||||
|
'moduleport.loop' => [
|
||||||
|
['ok', 'OK'],
|
||||||
|
['loop-detected', 'CRITICAL'],
|
||||||
|
],
|
||||||
|
'moduleport.protection' => [
|
||||||
|
['ok', 'OK'],
|
||||||
|
['pause-flood-detected', 'CRITICAL'],
|
||||||
|
['in-pause-condition', 'WARNING'],
|
||||||
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
$self->{components_path} = 'network::hp::vc::snmp::mode::components';
|
$self->{components_path} = 'network::hp::vc::snmp::mode::components';
|
||||||
$self->{components_module} = ['domain', 'enclosure', 'module', 'port', 'physicalserver', 'enet', 'fc', 'profile'];
|
$self->{components_module} = ['domain', 'enclosure', 'module', 'moduleport', 'port', 'physicalserver', 'enet', 'fc', 'profile'];
|
||||||
}
|
}
|
||||||
|
|
||||||
sub snmp_execute {
|
sub snmp_execute {
|
||||||
@ -82,7 +91,7 @@ Check Hardware.
|
|||||||
=item B<--component>
|
=item B<--component>
|
||||||
|
|
||||||
Which component to check (Default: '.*').
|
Which component to check (Default: '.*').
|
||||||
Can be: 'domain', 'enclosure', 'module', 'port', 'physicalserver', 'enet', 'fc', 'profile'.
|
Can be: 'domain', 'enclosure', 'module', 'moduleport', 'port', 'physicalserver', 'enet', 'fc', 'profile'.
|
||||||
|
|
||||||
=item B<--filter>
|
=item B<--filter>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user