From 7fa5018f5946aa7d4a7775fe3347825d965b061d Mon Sep 17 00:00:00 2001 From: Kristian Lyngstol Date: Tue, 14 Apr 2015 19:40:13 +0200 Subject: NMS: Fix/tweak ping-json2.pl SQL too --- web/nms.gathering.org/ping-json2.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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'}; -- cgit v1.2.3