diff options
author | Kristian Lyngstol <Kristian.Lyngstol@telenor.com> | 2019-04-09 09:57:55 +0200 |
---|---|---|
committer | Kristian Lyngstol <Kristian.Lyngstol@telenor.com> | 2019-04-09 09:57:55 +0200 |
commit | 54a410289c8d6951c7e1bb730106620c90d39cca (patch) | |
tree | f320f815fbdd8fb5820df3c86c25312fcc0843c5 /web/api/public/switch-state | |
parent | ecb267e43a5958c747998e833b78fbd49935b03c (diff) |
Attempt to avoid loopback in totalts in switch-state
Diffstat (limited to 'web/api/public/switch-state')
-rwxr-xr-x | web/api/public/switch-state | 6 |
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; |