typo ospf
This commit is contained in:
parent
fadfdf4f93
commit
dc3773ebc6
|
@ -30,24 +30,13 @@ use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_
|
||||||
sub custom_status_output {
|
sub custom_status_output {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
my $msg = 'state : ' . $self->{result_values}->{NbrState};
|
return 'state : ' . $self->{result_values}->{NbrState};
|
||||||
return $msg;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub custom_status_calc {
|
|
||||||
my ($self, %options) = @_;
|
|
||||||
|
|
||||||
$self->{result_values}->{NbrState} = $options{new_datas}->{$self->{instance} . '_NbrState'};
|
|
||||||
$self->{result_values}->{NbrIpAddr} = $options{new_datas}->{$self->{instance} . '_NbrIpAddr'};
|
|
||||||
$self->{result_values}->{NbrRtrId} = $options{new_datas}->{$self->{instance} . '_NbrRtrId'};
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub custom_change_output {
|
sub custom_change_output {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
my $msg = 'Neighbors current : ' . $self->{result_values}->{Total} . ' (last : ' . $self->{result_values}->{TotalLast} . ')';
|
return 'Neighbors current : ' . $self->{result_values}->{Total} . ' (last : ' . $self->{result_values}->{TotalLast} . ')';
|
||||||
return $msg;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub custom_change_calc {
|
sub custom_change_calc {
|
||||||
|
@ -81,15 +70,16 @@ sub set_counters {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ label => 'total-change', threshold => 0, set => {
|
{ label => 'total-change', type => 2, set => {
|
||||||
key_values => [ { name => 'total', diff => 1 } ],
|
key_values => [ { name => 'total', diff => 1 } ],
|
||||||
closure_custom_calc => $self->can('custom_change_calc'),
|
closure_custom_calc => $self->can('custom_change_calc'),
|
||||||
closure_custom_output => $self->can('custom_change_output'),
|
closure_custom_output => $self->can('custom_change_output'),
|
||||||
closure_custom_perfdata => sub { return 0; },
|
closure_custom_perfdata => sub { return 0; },
|
||||||
closure_custom_threshold_check => \&catalog_status_threshold_ng,
|
closure_custom_threshold_check => \&catalog_status_threshold_ng
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
$self->{maps_counters}->{nb} = [
|
$self->{maps_counters}->{nb} = [
|
||||||
{
|
{
|
||||||
label => 'status',
|
label => 'status',
|
||||||
|
@ -97,12 +87,11 @@ sub set_counters {
|
||||||
critical_default => '%{NbrState} =~ /down/i',
|
critical_default => '%{NbrState} =~ /down/i',
|
||||||
set => {
|
set => {
|
||||||
key_values => [ { name => 'NbrIpAddr' }, { name => 'NbrRtrId' }, { name => 'NbrState' } ],
|
key_values => [ { name => 'NbrIpAddr' }, { name => 'NbrRtrId' }, { name => 'NbrState' } ],
|
||||||
closure_custom_calc => $self->can('custom_status_calc'),
|
|
||||||
closure_custom_output => $self->can('custom_status_output'),
|
closure_custom_output => $self->can('custom_status_output'),
|
||||||
closure_custom_perfdata => sub { return 0; },
|
closure_custom_perfdata => sub { return 0; },
|
||||||
closure_custom_threshold_check => \&catalog_status_threshold_ng,
|
closure_custom_threshold_check => \&catalog_status_threshold_ng
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,12 +114,12 @@ my %map_state = (
|
||||||
5 => 'exchangeStart',
|
5 => 'exchangeStart',
|
||||||
6 => 'exchange',
|
6 => 'exchange',
|
||||||
7 => 'loading',
|
7 => 'loading',
|
||||||
8 => 'full',
|
8 => 'full'
|
||||||
);
|
);
|
||||||
my $mapping = {
|
my $mapping = {
|
||||||
NbrIpAddr => { oid => '.1.3.6.1.2.1.14.10.1.1' },
|
NbrIpAddr => { oid => '.1.3.6.1.2.1.14.10.1.1' },
|
||||||
NbrRtrId => { oid => '.1.3.6.1.2.1.14.10.1.3' },
|
NbrRtrId => { oid => '.1.3.6.1.2.1.14.10.1.3' },
|
||||||
NbrState => { oid => '.1.3.6.1.2.1.14.10.1.6', map => \%map_state },
|
NbrState => { oid => '.1.3.6.1.2.1.14.10.1.6', map => \%map_state }
|
||||||
};
|
};
|
||||||
|
|
||||||
my $oid_ospfNbrEntry = '.1.3.6.1.2.1.14.10.1';
|
my $oid_ospfNbrEntry = '.1.3.6.1.2.1.14.10.1';
|
||||||
|
@ -140,8 +129,10 @@ sub manage_selection {
|
||||||
|
|
||||||
$self->{nb} = {};
|
$self->{nb} = {};
|
||||||
$self->{global} = { total => 0 };
|
$self->{global} = { total => 0 };
|
||||||
my $snmp_result = $options{snmp}->get_table(oid => $oid_ospfNbrEntry,
|
my $snmp_result = $options{snmp}->get_table(
|
||||||
nothing_quit => 1);
|
oid => $oid_ospfNbrEntry,
|
||||||
|
nothing_quit => 1
|
||||||
|
);
|
||||||
|
|
||||||
foreach my $oid (keys %{$snmp_result}) {
|
foreach my $oid (keys %{$snmp_result}) {
|
||||||
next if ($oid !~ /^$mapping->{NbrState}->{oid}\.(.*)$/);
|
next if ($oid !~ /^$mapping->{NbrState}->{oid}\.(.*)$/);
|
||||||
|
@ -151,13 +142,13 @@ sub manage_selection {
|
||||||
$self->{global}->{total}++;
|
$self->{global}->{total}++;
|
||||||
$self->{nb}->{$instance} = { %$result };
|
$self->{nb}->{$instance} = { %$result };
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scalar(keys %{$self->{nb}}) <= 0) {
|
if (scalar(keys %{$self->{nb}}) <= 0) {
|
||||||
$self->{output}->add_option_msg(short_msg => "No neighbors found.");
|
$self->{output}->add_option_msg(short_msg => "No neighbors found.");
|
||||||
$self->{output}->option_exit();
|
$self->{output}->option_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$self->{cache_name} = "ospf_" . $self->{mode} . '_' . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() . '_' .
|
$self->{cache_name} = 'ospf_' . $self->{mode} . '_' . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() . '_' .
|
||||||
(defined($self->{option_results}->{filter_counters}) ? md5_hex($self->{option_results}->{filter_counters}) : md5_hex('all'));
|
(defined($self->{option_results}->{filter_counters}) ? md5_hex($self->{option_results}->{filter_counters}) : md5_hex('all'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue