From 54a410289c8d6951c7e1bb730106620c90d39cca Mon Sep 17 00:00:00 2001 From: Kristian Lyngstol Date: Tue, 9 Apr 2019 09:57:55 +0200 Subject: Attempt to avoid loopback in totalts in switch-state --- web/api/public/switch-state | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'web/api') diff --git a/web/api/public/switch-state b/web/api/public/switch-state index 528bf7d..7e696e5 100755 --- a/web/api/public/switch-state +++ b/web/api/public/switch-state @@ -67,8 +67,10 @@ while ( my $ref = $q->fetchrow_hashref() ) { } $json{'switches'}{$sysname}{ifs}{$smallport}{'ifHCInOctets'} += $port{'ifHCInOctets'} || 0; $json{'switches'}{$sysname}{ifs}{$smallport}{'ifHCOutOctets'} += $port{'ifHCOutOctets'} || 0; - $json{'switches'}{$sysname}{totals}{'ifHCInOctets'} += $port{'ifHCInOctets'} || 0; - $json{'switches'}{$sysname}{totals}{'ifHCOutOctets'} += $port{'ifHCOutOctets'} || 0; + if ($smallport ne "loopback") { + $json{'switches'}{$sysname}{totals}{'ifHCInOctets'} += $port{'ifHCInOctets'} || 0; + $json{'switches'}{$sysname}{totals}{'ifHCOutOctets'} += $port{'ifHCOutOctets'} || 0; + } if ($port{'ifOperStatus'} eq "up") { $json{'switches'}{$sysname}{ifs}{$smallport}{'live'} += 1; $json{'switches'}{$sysname}{totals}{'live'} += 1; -- cgit v1.2.3