From 313f36e38e891880c948cf7307d1a3f30eedd465 Mon Sep 17 00:00:00 2001 From: qgarnier Date: Thu, 11 Feb 2021 15:35:58 +0100 Subject: [PATCH] fix watchguard if no traffic tunnel (#2587) --- network/watchguard/snmp/mode/ipsectunnel.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/network/watchguard/snmp/mode/ipsectunnel.pm b/network/watchguard/snmp/mode/ipsectunnel.pm index d97c2d36e..0730dfbe5 100644 --- a/network/watchguard/snmp/mode/ipsectunnel.pm +++ b/network/watchguard/snmp/mode/ipsectunnel.pm @@ -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};