aboutsummaryrefslogtreecommitdiffstats
path: root/web/nms.gathering.org/api
diff options
context:
space:
mode:
authorKristian Lyngstol <kly@kly@.no>2016-03-21 18:50:25 +0100
committerKristian Lyngstol <kly@kly@.no>2016-03-21 18:50:25 +0100
commit2c0576644afc26f4153ad316d2af216919c04fe4 (patch)
treef03344431147485b45a47ed3ead56d7bc1050726 /web/nms.gathering.org/api
parentbe1d1a2ad44bc30993cfda339552b924f5018d72 (diff)
NMS: Tweak searching of switch active ports etc
Diffstat (limited to 'web/nms.gathering.org/api')
-rwxr-xr-xweb/nms.gathering.org/api/public/switch-state13
1 files changed, 8 insertions, 5 deletions
diff --git a/web/nms.gathering.org/api/public/switch-state b/web/nms.gathering.org/api/public/switch-state
index 62d0078..6f7573c 100755
--- a/web/nms.gathering.org/api/public/switch-state
+++ b/web/nms.gathering.org/api/public/switch-state
@@ -20,7 +20,7 @@ while ( my $ref = $q->fetchrow_hashref() ) {
my %port = %{$data{'ports'}{$porti}};
my $smallport = $porti;
$smallport =~ s/[0-9-].*$//;
- if ($porti =~ /ge-0\/0\/4[4-7]/ or $porti eq 'eth0') {
+ if ($porti =~ /ge-0\/0\/4[4-7]/) {
$json{'switches'}{$sysname}{'uplinks'}{'ifHCInOctets'} += $port{'ifHCInOctets'};
$json{'switches'}{$sysname}{'uplinks'}{'ifHCOutOctets'} += $port{'ifHCOutOctets'};
if ($port{'ifOperStatus'} eq "up") {
@@ -29,12 +29,15 @@ while ( my $ref = $q->fetchrow_hashref() ) {
$json{'switches'}{$sysname}{'uplinks'}{'total'} += 1;
}
- $json{'switches'}{$sysname}{$smallport}{'ifHCInOctets'} += $port{'ifHCInOctets'};
- $json{'switches'}{$sysname}{$smallport}{'ifHCOutOctets'} += $port{'ifHCOutOctets'};
+ $json{'switches'}{$sysname}{ifs}{$smallport}{'ifHCInOctets'} += $port{'ifHCInOctets'};
+ $json{'switches'}{$sysname}{ifs}{$smallport}{'ifHCOutOctets'} += $port{'ifHCOutOctets'};
+ $json{'switches'}{$sysname}{totals}{'ifHCInOctets'} += $port{'ifHCInOctets'};
+ $json{'switches'}{$sysname}{totals}{'ifHCOutOctets'} += $port{'ifHCOutOctets'};
if ($port{'ifOperStatus'} eq "up") {
- $json{'switches'}{$sysname}{$smallport}{'live'} += 1;
+ $json{'switches'}{$sysname}{ifs}{$smallport}{'live'} += 1;
+ $json{'switches'}{$sysname}{totals}{'live'} += 1;
}
- $json{'switches'}{$sysname}{$smallport}{'total'} += 1;
+ $json{'switches'}{$sysname}{totals}{'total'} += 1;
}
$json{'switches'}{$sysname}{'time'} = $ref->{'time'};
}