+ enhance bigip modes

This commit is contained in:
garnier-quentin 2015-07-07 14:32:31 +02:00
parent 6c6506bcba
commit ec77a22f07
3 changed files with 10 additions and 8 deletions

View File

@ -245,13 +245,11 @@ my $mapping = {
AvailState => { oid => '.1.3.6.1.4.1.3375.2.2.4.3.2.1.3', map => \%map_node_status }, AvailState => { oid => '.1.3.6.1.4.1.3375.2.2.4.3.2.1.3', map => \%map_node_status },
EnabledState => { oid => '.1.3.6.1.4.1.3375.2.2.4.3.2.1.4', map => \%map_node_enabled }, EnabledState => { oid => '.1.3.6.1.4.1.3375.2.2.4.3.2.1.4', map => \%map_node_enabled },
StatusReason => { oid => '.1.3.6.1.4.1.3375.2.2.4.3.2.1.6' }, StatusReason => { oid => '.1.3.6.1.4.1.3375.2.2.4.3.2.1.6' },
Name => { oid => '.1.3.6.1.4.1.3375.2.2.4.3.2.1.7' },
}, },
old => { old => {
AvailState => { oid => '.1.3.6.1.4.1.3375.2.2.4.1.2.1.13', map => \%map_node_status }, AvailState => { oid => '.1.3.6.1.4.1.3375.2.2.4.1.2.1.13', map => \%map_node_status },
EnabledState => { oid => '.1.3.6.1.4.1.3375.2.2.4.1.2.1.14', map => \%map_node_enabled }, EnabledState => { oid => '.1.3.6.1.4.1.3375.2.2.4.1.2.1.14', map => \%map_node_enabled },
StatusReason => { oid => '.1.3.6.1.4.1.3375.2.2.4.1.2.1.16' }, StatusReason => { oid => '.1.3.6.1.4.1.3375.2.2.4.1.2.1.16' },
Name => { oid => '.1.3.6.1.4.1.3375.2.2.4.1.2.1.17' },
}, },
}; };
my $oid_ltmNodeAddrStatusEntry = '.1.3.6.1.4.1.3375.2.2.4.3.2.1'; # new my $oid_ltmNodeAddrStatusEntry = '.1.3.6.1.4.1.3375.2.2.4.3.2.1'; # new
@ -277,6 +275,10 @@ sub manage_selection {
my $instance = $1; my $instance = $1;
my $result = $self->{snmp}->map_instance(mapping => $mapping->{$map}, results => $self->{results}->{$branch}, instance => $instance); my $result = $self->{snmp}->map_instance(mapping => $mapping->{$map}, results => $self->{results}->{$branch}, instance => $instance);
$result->{Name} = '';
foreach (split /\./, $instance) {
$result->{Name} .= chr if ($_ >= 32 && $_ <= 126);
}
if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' && if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' &&
$result->{Name} !~ /$self->{option_results}->{filter_name}/) { $result->{Name} !~ /$self->{option_results}->{filter_name}/) {
$self->{output}->output_add(long_msg => "Skipping '" . $result->{Name} . "': no matching filter name."); $self->{output}->output_add(long_msg => "Skipping '" . $result->{Name} . "': no matching filter name.");

View File

@ -39,7 +39,6 @@ use base qw(centreon::plugins::mode);
use strict; use strict;
use warnings; use warnings;
use centreon::plugins::values;
my $thresholds = { my $thresholds = {
pool => [ pool => [
@ -276,8 +275,9 @@ sub manage_selection {
my $result = $self->{snmp}->map_instance(mapping => $mapping->{$map}, results => $self->{results}->{$branch}, instance => $instance); my $result = $self->{snmp}->map_instance(mapping => $mapping->{$map}, results => $self->{results}->{$branch}, instance => $instance);
$result->{Name} = ''; $result->{Name} = '';
$result->{Name} .= chr foreach (split /\./, $instance); foreach (split /\./, $instance) {
$result->{Name} = centreon::plugins::misc::trim($result->{Name}); $result->{Name} .= chr if ($_ >= 32 && $_ <= 126);
}
if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' && if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' &&
$result->{Name} !~ /$self->{option_results}->{filter_name}/) { $result->{Name} !~ /$self->{option_results}->{filter_name}/) {
$self->{output}->output_add(long_msg => "Skipping '" . $result->{Name} . "': no matching filter name."); $self->{output}->output_add(long_msg => "Skipping '" . $result->{Name} . "': no matching filter name.");

View File

@ -40,7 +40,6 @@ use base qw(centreon::plugins::mode);
use strict; use strict;
use warnings; use warnings;
use centreon::plugins::values; use centreon::plugins::values;
use centreon::plugins::misc;
my $thresholds = { my $thresholds = {
vs => [ vs => [
@ -277,8 +276,9 @@ sub manage_selection {
my $result = $self->{snmp}->map_instance(mapping => $mapping->{$map}, results => $self->{results}->{$branch}, instance => $instance); my $result = $self->{snmp}->map_instance(mapping => $mapping->{$map}, results => $self->{results}->{$branch}, instance => $instance);
$result->{Name} = ''; $result->{Name} = '';
$result->{Name} .= chr foreach (split /\./, $instance); foreach (split /\./, $instance) {
$result->{Name} = centreon::plugins::misc::trim($result->{Name}); $result->{Name} .= chr if ($_ >= 32 && $_ <= 126);
}
if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' && if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' &&
$result->{Name} !~ /$self->{option_results}->{filter_name}/) { $result->{Name} !~ /$self->{option_results}->{filter_name}/) {
$self->{output}->output_add(long_msg => "Skipping '" . $result->{Name} . "': no matching filter name."); $self->{output}->output_add(long_msg => "Skipping '" . $result->{Name} . "': no matching filter name.");