diff options
Diffstat (limited to 'web')
-rwxr-xr-x | web/nms-public.gathering.org/api/public/dhcp-summary | 7 | ||||
-rwxr-xr-x | web/nms-public.gathering.org/api/public/ping | 6 | ||||
-rwxr-xr-x | web/nms.gathering.org/api/public/dhcp | 2 | ||||
-rwxr-xr-x | web/nms.gathering.org/api/public/dhcp-summary | 7 | ||||
-rwxr-xr-x | web/nms.gathering.org/api/public/ping | 6 | ||||
-rwxr-xr-x | web/nms.gathering.org/api/public/switch-state | 6 | ||||
-rw-r--r-- | web/nms.gathering.org/js/nms-info-box.js | 10 |
7 files changed, 22 insertions, 22 deletions
diff --git a/web/nms-public.gathering.org/api/public/dhcp-summary b/web/nms-public.gathering.org/api/public/dhcp-summary index dd643b2..a0e5609 100755 --- a/web/nms-public.gathering.org/api/public/dhcp-summary +++ b/web/nms-public.gathering.org/api/public/dhcp-summary @@ -5,16 +5,11 @@ use warnings; use nms::web; nms::web::setwhen('2h'); -my $q = $nms::web::dbh->prepare("select count(distinct mac) as clients,count(distinct ip) as addresses,count(mac) as acks from dhcp;"); -$q->execute(); -while (my $ref = $q->fetchrow_hashref()) { - $nms::web::json{'dhcp'}{'total'} = $ref; -} my $q2 = $nms::web::dbh->prepare("select count(distinct mac) as clients,count(distinct ip) as addresses,count(mac) as acks from dhcp where $nms::web::when;"); $q2->execute(); while (my $ref = $q2->fetchrow_hashref()) { - $nms::web::json{'dhcp'}{'recent'} = $ref; + $nms::web::json{'dhcp'} = $ref; } $nms::web::cc{'max-age'} = "10"; $nms::web::cc{'stale-while-revalidate'} = "15"; diff --git a/web/nms-public.gathering.org/api/public/ping b/web/nms-public.gathering.org/api/public/ping index ba572af..db46b00 100755 --- a/web/nms-public.gathering.org/api/public/ping +++ b/web/nms-public.gathering.org/api/public/ping @@ -4,7 +4,7 @@ use strict; use warnings; use nms::web; -#nms::web::setwhen('1s'); +nms::web::setwhen('10s'); my $q = $nms::web::dbh->prepare("SELECT DISTINCT ON (sysname) (now() - time) as age,sysname, latency_ms FROM ping NATURAL JOIN switches WHERE time in (select max(time) from ping where " . $nms::web::when . " group by switch)"); @@ -32,6 +32,6 @@ while ( my $ref = $lq->fetchrow_hashref() ) { $nms::web::json{'linknets'}{$ref->{'linknet'}} = [ $ref->{'latency1_ms'}, $ref->{'latency2_ms'} ]; } -$nms::web::cc{'max-age'} = "1"; -$nms::web::cc{'stale-while-revalidate'} = "5"; +$nms::web::cc{'max-age'} = "2"; +$nms::web::cc{'stale-while-revalidate'} = "15"; finalize_output(); diff --git a/web/nms.gathering.org/api/public/dhcp b/web/nms.gathering.org/api/public/dhcp index 91d52af..7b048d1 100755 --- a/web/nms.gathering.org/api/public/dhcp +++ b/web/nms.gathering.org/api/public/dhcp @@ -15,6 +15,6 @@ while ( my $ref = $q->fetchrow_hashref() ) { $json{'dhcp'}{$ref->{'sysname'}} = $ref->{'time'}; } -$nms::web::cc{'max-age'} = "5"; +$nms::web::cc{'max-age'} = "10"; $nms::web::cc{'stale-while-revalidate'} = "30"; finalize_output(); diff --git a/web/nms.gathering.org/api/public/dhcp-summary b/web/nms.gathering.org/api/public/dhcp-summary index dd643b2..a0e5609 100755 --- a/web/nms.gathering.org/api/public/dhcp-summary +++ b/web/nms.gathering.org/api/public/dhcp-summary @@ -5,16 +5,11 @@ use warnings; use nms::web; nms::web::setwhen('2h'); -my $q = $nms::web::dbh->prepare("select count(distinct mac) as clients,count(distinct ip) as addresses,count(mac) as acks from dhcp;"); -$q->execute(); -while (my $ref = $q->fetchrow_hashref()) { - $nms::web::json{'dhcp'}{'total'} = $ref; -} my $q2 = $nms::web::dbh->prepare("select count(distinct mac) as clients,count(distinct ip) as addresses,count(mac) as acks from dhcp where $nms::web::when;"); $q2->execute(); while (my $ref = $q2->fetchrow_hashref()) { - $nms::web::json{'dhcp'}{'recent'} = $ref; + $nms::web::json{'dhcp'} = $ref; } $nms::web::cc{'max-age'} = "10"; $nms::web::cc{'stale-while-revalidate'} = "15"; diff --git a/web/nms.gathering.org/api/public/ping b/web/nms.gathering.org/api/public/ping index ba572af..db46b00 100755 --- a/web/nms.gathering.org/api/public/ping +++ b/web/nms.gathering.org/api/public/ping @@ -4,7 +4,7 @@ use strict; use warnings; use nms::web; -#nms::web::setwhen('1s'); +nms::web::setwhen('10s'); my $q = $nms::web::dbh->prepare("SELECT DISTINCT ON (sysname) (now() - time) as age,sysname, latency_ms FROM ping NATURAL JOIN switches WHERE time in (select max(time) from ping where " . $nms::web::when . " group by switch)"); @@ -32,6 +32,6 @@ while ( my $ref = $lq->fetchrow_hashref() ) { $nms::web::json{'linknets'}{$ref->{'linknet'}} = [ $ref->{'latency1_ms'}, $ref->{'latency2_ms'} ]; } -$nms::web::cc{'max-age'} = "1"; -$nms::web::cc{'stale-while-revalidate'} = "5"; +$nms::web::cc{'max-age'} = "2"; +$nms::web::cc{'stale-while-revalidate'} = "15"; finalize_output(); diff --git a/web/nms.gathering.org/api/public/switch-state b/web/nms.gathering.org/api/public/switch-state index 0e28cfd..a6caea9 100755 --- a/web/nms.gathering.org/api/public/switch-state +++ b/web/nms.gathering.org/api/public/switch-state @@ -19,6 +19,9 @@ while ( my $ref = $q->fetchrow_hashref() ) { for my $porti (keys %{$data{'ports'}}) { my %port = %{$data{'ports'}{$porti}}; my $smallport = $porti; + if ($porti =~ m/\.0$/) { + next; + } if (not $smallport =~ m/^ae/ and not $smallport =~ m/^et/) { $smallport =~ s/[0-9-].*$//; } else { @@ -59,6 +62,9 @@ while ( my $ref = $q2->fetchrow_hashref() ) { for my $porti (keys %{$data{'ports'}}) { my %port = %{$data{'ports'}{$porti}}; my $smallport = $porti; + if ($porti =~ m/\.0$/) { + next; + } if (not $smallport =~ m/^ae/ and not $smallport =~ m/^et/) { $smallport =~ s/[0-9-].*$//; } else { diff --git a/web/nms.gathering.org/js/nms-info-box.js b/web/nms.gathering.org/js/nms-info-box.js index 1728d81..03d0838 100644 --- a/web/nms.gathering.org/js/nms-info-box.js +++ b/web/nms.gathering.org/js/nms-info-box.js @@ -618,6 +618,7 @@ nmsInfoBox._searchSmart = function(id, sw) { return true; } } catch (e) {} + try { if (id.match("active")) { var limit = id; limit = limit.replace("active>",""); @@ -625,21 +626,24 @@ nmsInfoBox._searchSmart = function(id, sw) { limit = limit.replace("active=",""); var operator = id.replace("active","")[0]; if (limit == parseInt(limit)) { + var ports = parseInt(nmsData.switchstate.switches[sw].ifs.ge.live); + limit = parseInt(limit); if (operator == ">" ) { - if (nmsData.switchstate.switches[sw]['totals'].live > limit) { + if (ports > limit) { return true; } } else if (operator == "<") { - if (nmsData.switchstate.switches[sw]['totals'].live < limit) { + if (ports < limit) { return true; } } else if (operator == "=") { - if (nmsData.switchstate.switches[sw]['totals'].live == limit) { + if (ports == limit) { return true; } } } } + } catch (e) {} try { if (nmsData.smanagement.switches[sw].mgmt_v4_addr.match(id)) { return true; |