aboutsummaryrefslogtreecommitdiffstats
path: root/web/api/public/switch-state
diff options
context:
space:
mode:
authorKristian Lyngstol <kly@kly.no>2016-07-01 16:38:36 +0200
committerKristian Lyngstol <kly@kly.no>2016-07-01 16:38:36 +0200
commit18be7f053b6a7a8cd19a7340466b68f579eb33cd (patch)
tree5b340a37751ea9c9da799ba124cd0a9a4f4e8344 /web/api/public/switch-state
parentf3e530f42e350f17f42cf3f8f0f310f433effef9 (diff)
Implement tags and various other minor tweaks
Diffstat (limited to 'web/api/public/switch-state')
-rwxr-xr-xweb/api/public/switch-state10
1 files changed, 5 insertions, 5 deletions
diff --git a/web/api/public/switch-state b/web/api/public/switch-state
index 2e82836..47de6d5 100755
--- a/web/api/public/switch-state
+++ b/web/api/public/switch-state
@@ -22,13 +22,13 @@ while ( my $ref = $q->fetchrow_hashref() ) {
if ($porti =~ m/\.0$/) {
next;
}
- if ($data{'ports'}{$porti}{'ifAlias'} =~ m/client/) {
+ if ($data{'ports'}{$porti}{'ifAlias'} =~ m/client/i) {
$smallport =~ s/[0-9-].*$//;
} else {
$json{'switches'}{$sysname}{ifs}{$smallport}{'ifAlias'} = $port{'ifAlias'};
}
- if ($porti =~ /Gi1\/0\/4[78]$/ ||
- $data{'ports'}{$porti}{'ifAlias'} =~ m/uplink/) {
+ if ($data{'ports'}{$porti}{'ifType'} ne "propVirtual" and
+ $data{'ports'}{$porti}{'ifAlias'} =~ m/trunk/i) {
$json{'switches'}{$sysname}{'uplinks'}{'ifHCInOctets'} += $port{'ifHCInOctets'};
$json{'switches'}{$sysname}{'uplinks'}{'ifHCOutOctets'} += $port{'ifHCOutOctets'};
if ($port{'ifOperStatus'} eq "up") {
@@ -71,8 +71,8 @@ while ( my $ref = $q2->fetchrow_hashref() ) {
} else {
$json{'then'}{$sysname}{ifs}{$smallport}{'ifAlias'} = $port{'ifAlias'};
}
- if ($porti =~ /Gi1\/0\/4[78]$/ ||
- $data{'ports'}{$porti}{'ifAlias'} =~ m/uplink/) {
+ if ($data{'ports'}{$porti}{'ifType'} ne "propVirtual" and
+ $data{'ports'}{$porti}{'ifAlias'} =~ m/trunk/i) {
$json{'then'}{$sysname}{'uplinks'}{'ifHCInOctets'} += $port{'ifHCInOctets'};
$json{'then'}{$sysname}{'uplinks'}{'ifHCOutOctets'} += $port{'ifHCOutOctets'};
if ($port{'ifOperStatus'} eq "up") {