aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristian Lyngstol <Kristian.Lyngstol@telenor.com>2019-04-09 09:57:55 +0200
committerKristian Lyngstol <Kristian.Lyngstol@telenor.com>2019-04-09 09:57:55 +0200
commit54a410289c8d6951c7e1bb730106620c90d39cca (patch)
treef320f815fbdd8fb5820df3c86c25312fcc0843c5
parentecb267e43a5958c747998e833b78fbd49935b03c (diff)
Attempt to avoid loopback in totalts in switch-state
-rwxr-xr-xweb/api/public/switch-state6
1 files changed, 4 insertions, 2 deletions
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;