diff options
| author | Kristian Lyngstol <kristian@bohemians.org> | 2015-04-14 19:40:13 +0200 | 
|---|---|---|
| committer | Kristian Lyngstol <kristian@bohemians.org> | 2015-04-14 19:40:13 +0200 | 
| commit | 7fa5018f5946aa7d4a7775fe3347825d965b061d (patch) | |
| tree | 1ece734afaea0a8526c45f76b82ce517a1475f7a | |
| parent | 7337ac7e744e978ae93a9cd28a08fea728627287 (diff) | |
NMS: Fix/tweak ping-json2.pl SQL too
| -rwxr-xr-x | web/nms.gathering.org/ping-json2.pl | 2 | 
1 files changed, 1 insertions, 1 deletions
| diff --git a/web/nms.gathering.org/ping-json2.pl b/web/nms.gathering.org/ping-json2.pl index e46140a..2ffe650 100755 --- a/web/nms.gathering.org/ping-json2.pl +++ b/web/nms.gathering.org/ping-json2.pl @@ -16,7 +16,7 @@ my $when =" updated > " . $now . " - '15 secs'::interval and updated < " . $now  my %json = (); -my $q = $dbh->prepare("SELECT DISTINCT ON (updated, sysname) updated,sysname, latency_ms FROM ping NATURAL JOIN switches WHERE $when ORDER BY updated DESC;"); +my $q = $dbh->prepare("SELECT DISTINCT ON (sysname) updated,sysname, latency_ms FROM ping NATURAL JOIN switches WHERE updated in (select max(updated) from ping where $when group by switch)");  $q->execute();  while (my $ref = $q->fetchrow_hashref()) {  	$json{'switches'}{$ref->{'sysname'}}{'latency'} = $ref->{'latency_ms'}; | 
