From 806e74ba7c4a12f7a0d827911259e209d5f842f7 Mon Sep 17 00:00:00 2001 From: qgarnier Date: Mon, 24 Jul 2017 15:34:03 +0200 Subject: [PATCH] fix l2tp nokia mode --- network/nokia/timos/snmp/mode/l2tpusage.pm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/network/nokia/timos/snmp/mode/l2tpusage.pm b/network/nokia/timos/snmp/mode/l2tpusage.pm index 580fb419a..33519309c 100644 --- a/network/nokia/timos/snmp/mode/l2tpusage.pm +++ b/network/nokia/timos/snmp/mode/l2tpusage.pm @@ -79,8 +79,12 @@ sub custom_total_sessions_calc { next if (!defined($options{old_datas}->{$_})); my $old_total = $options{old_datas}->{$_}; - $total_sessions += $new_total - $old_total; - $total_sessions += $old_total if ($total_sessions <= 0); + my $diff_sessions += $new_total - $old_total; + if ($diff_sessions < 0) { + $total_sessions += $old_total; + } else { + $total_sessions += $diff_sessions; + } } } @@ -196,7 +200,7 @@ sub prefix_peer_output { sub new { my ($class, %options) = @_; - my $self = $class->SUPER::new(package => __PACKAGE__, %options); + my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1); bless $self, $class; $self->{version} = '1.0';