From bb862773d69bc5997bd1628a3f0505827e7cfe5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20Lyngst=C3=B8l?= Date: Mon, 10 Apr 2017 14:06:23 +0200 Subject: TG17 stuff ? --- web/api/public/switch-state | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'web/api/public/switch-state') diff --git a/web/api/public/switch-state b/web/api/public/switch-state index 8e98205..36dfeaf 100755 --- a/web/api/public/switch-state +++ b/web/api/public/switch-state @@ -40,7 +40,7 @@ while ( my $ref = $q->fetchrow_hashref() ) { $json{'switches'}{$sysname}{ifs}{$smallport}{'ifAlias'} = $port{'ifAlias'}; } if ($data{'ports'}{$porti}{'ifType'} ne "propVirtual" and - $data{'ports'}{$porti}{'ifAlias'} =~ m/trunk/i) { + $data{'ports'}{$porti}{'ifAlias'} =~ m/LAG member/i) { $json{'switches'}{$sysname}{'uplinks'}{'ifHCInOctets'} += $port{'ifHCInOctets'}; $json{'switches'}{$sysname}{'uplinks'}{'ifHCOutOctets'} += $port{'ifHCOutOctets'}; if ($port{'ifOperStatus'} eq "up") { @@ -48,6 +48,15 @@ while ( my $ref = $q->fetchrow_hashref() ) { } $json{'switches'}{$sysname}{'uplinks'}{'total'} += 1; } + if ($data{'ports'}{$porti}{'ifType'} ne "propVirtual" and + $data{'ports'}{$porti}{'ifAlias'} =~ m/Clients/i) { + $json{'switches'}{$sysname}{'clients'}{'ifHCInOctets'} += $port{'ifHCInOctets'}; + $json{'switches'}{$sysname}{'clients'}{'ifHCOutOctets'} += $port{'ifHCOutOctets'}; + if ($port{'ifOperStatus'} eq "up") { + $json{'switches'}{$sysname}{'clients'}{'live'} += 1; + } + $json{'switches'}{$sysname}{'clients'}{'total'} += 1; + } $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; @@ -91,7 +100,7 @@ while ( my $ref = $q2->fetchrow_hashref() ) { $json{'then'}{$sysname}{ifs}{$smallport}{'ifAlias'} = $port{'ifAlias'}; } if ($data{'ports'}{$porti}{'ifType'} ne "propVirtual" and - $data{'ports'}{$porti}{'ifAlias'} =~ m/trunk/i) { + $data{'ports'}{$porti}{'ifAlias'} =~ m/LAG member/i) { $json{'then'}{$sysname}{'uplinks'}{'ifHCInOctets'} += $port{'ifHCInOctets'}; $json{'then'}{$sysname}{'uplinks'}{'ifHCOutOctets'} += $port{'ifHCOutOctets'}; if ($port{'ifOperStatus'} eq "up") { @@ -99,6 +108,15 @@ while ( my $ref = $q2->fetchrow_hashref() ) { } $json{'then'}{$sysname}{'uplinks'}{'total'} += 1; } + if ($data{'ports'}{$porti}{'ifType'} ne "propVirtual" and + $data{'ports'}{$porti}{'ifAlias'} =~ m/Clients/i) { + $json{'then'}{$sysname}{'clients'}{'ifHCInOctets'} += $port{'ifHCInOctets'}; + $json{'then'}{$sysname}{'clients'}{'ifHCOutOctets'} += $port{'ifHCOutOctets'}; + if ($port{'ifOperStatus'} eq "up") { + $json{'then'}{$sysname}{'clients'}{'live'} += 1; + } + $json{'then'}{$sysname}{'clients'}{'total'} += 1; + } $json{'then'}{$sysname}{ifs}{$smallport}{'ifHCInOctets'} += $port{'ifHCInOctets'} || 0; $json{'then'}{$sysname}{ifs}{$smallport}{'ifHCOutOctets'} += $port{'ifHCOutOctets'} || 0; -- cgit v1.2.3