fix watchguard if no traffic tunnel (#2587)

This commit is contained in:
qgarnier 2021-02-11 15:35:58 +01:00 committed by GitHub
parent e1b954824d
commit 313f36e38e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -77,7 +77,7 @@ sub custom_traffic_calc {
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'global', type => 0, cb_prefix_output => 'prefix_global_output' },
{ name => 'tunnel', type => 1, cb_prefix_output => 'prefix_tunnel_output', message_multiple => 'All tunnels are ok', skipped_code => { -10 => 1 } }
@ -196,8 +196,8 @@ sub manage_selection {
my @instances = keys %{$self->{tunnel}};
foreach (@instances) {
my $result = $options{snmp}->map_instance(mapping => $mapping2, results => $snmp_result, instance => $_);
$result->{traffic_in} = $result->{traffic_in} * 1024 * 8;
$result->{traffic_out} = $result->{traffic_out} * 1024 * 8;
$result->{traffic_in} = defined($result->{traffic_in}) ? $result->{traffic_in} * 1024 * 8 : 0;
$result->{traffic_out} = defined($result->{traffic_out}) ? $result->{traffic_out} * 1024 * 8 : 0;
my $uuid = $self->{tunnel}->{$_}->{display} . '_' . $result->{selector_local_ip_one} . '_' . $result->{selector_local_ip_two} . '_' .
$result->{selector_remote_ip_one} . '_' . $result->{selector_remote_ip_two};