This commit is contained in:
garnier-quentin 2020-07-06 09:01:22 +02:00
parent b47977ced8
commit 0cf498cd39
1 changed files with 13 additions and 12 deletions

View File

@ -32,7 +32,7 @@ sub set_counters {
$self->{maps_counters_type} = [
{ name => 'global', type => 0 },
{ name => 'tunnel', type => 1, cb_prefix_output => 'prefix_tunnel_output', message_multiple => 'All tunnels are ok' },
{ name => 'tunnel', type => 1, cb_prefix_output => 'prefix_tunnel_output', message_multiple => 'All tunnels are ok' }
];
$self->{maps_counters}->{global} = [
@ -52,8 +52,8 @@ sub set_counters {
output_template => 'Traffic In : %s %s/s',
output_change_bytes => 2,
perfdatas => [
{ template => '%s', min => 0, unit => 'b/s', label_extra_instance => 1, instance_use => 'display' },
],
{ template => '%s', min => 0, unit => 'b/s', label_extra_instance => 1, instance_use => 'display' }
]
}
},
{ label => 'tunnel-traffic-out', nlabel => 'ipsec.tunnel.traffic.out.bitspersecond', set => {
@ -61,10 +61,10 @@ sub set_counters {
output_template => 'Traffic Out : %s %s/s',
output_change_bytes => 2,
perfdatas => [
{ template => '%s', min => 0, unit => 'b/s', label_extra_instance => 1, instance_use => 'display' },
],
{ template => '%s', min => 0, unit => 'b/s', label_extra_instance => 1, instance_use => 'display' }
]
}
}
},
];
}
@ -104,8 +104,7 @@ sub manage_selection {
my $snmp_result = $options{snmp}->get_table(
oid => $oid_wgIpsecTunnelEntry,
start => $mapping->{wgIpsecTunnelLocalAddr}->{oid},
end => $mapping->{wgIpsecTunnelPeerAddr}->{oid},
nothing_quit => 1
end => $mapping->{wgIpsecTunnelPeerAddr}->{oid}
);
foreach (keys %$snmp_result) {
next if (!/$mapping->{wgIpsecTunnelLocalAddr}->{oid}\.(.*)/);
@ -125,7 +124,9 @@ sub manage_selection {
$options{snmp}->load(oids => [
map($_->{oid}, values(%$mapping2))
],
instances => [keys %{$self->{tunnel}}], instance_regexp => '^(.*)$');
instances => [keys %{$self->{tunnel}}],
instance_regexp => '^(.*)$'
);
$snmp_result = $options{snmp}->get_leef(nothing_quit => 1);
foreach (keys %{$self->{tunnel}}) {
my $result = $options{snmp}->map_instance(mapping => $mapping2, results => $snmp_result, instance => $_);