diff options
Diffstat (limited to 'web/api/public/ping')
-rwxr-xr-x | web/api/public/ping | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/web/api/public/ping b/web/api/public/ping deleted file mode 100755 index 52dffbc..0000000 --- a/web/api/public/ping +++ /dev/null @@ -1,35 +0,0 @@ -#! /usr/bin/perl -use lib '/opt/gondul/include'; -use strict; -use warnings; -use nms::web; - -nms::web::setwhen('25s'); - -my $q = $nms::web::dbh->prepare("SELECT DISTINCT ON (sysname) (" . $nms::web::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)"); - -$q->execute(); -while (my $ref = $q->fetchrow_hashref()) { - $nms::web::json{'switches'}{$ref->{'sysname'}}{'latency4'} = $ref->{'latency_ms'}; - # Get seconds, without decimlas, from timestamp. - # '00:01:01.435601' => 61 seconds. - my ( $h, $m, $s ) = split( ':|\.', $ref->{'age'} ); - $nms::web::json{'switches'}{$ref->{'sysname'}}{'age4'} = ($h*60*60) + ($m*60) + $s; # $$ref->{'age'}; -} - -my $q2 = $nms::web::dbh->prepare("SELECT DISTINCT ON (sysname) (" . $nms::web::now . " - time) as age,sysname, latency_ms FROM ping_secondary_ip NATURAL JOIN switches WHERE time in (select max(time) from ping where " - . $nms::web::when . " group by switch)"); - -$q2->execute(); -while (my $ref = $q2->fetchrow_hashref()) { - $nms::web::json{'switches'}{$ref->{'sysname'}}{'latency6'} = $ref->{'latency_ms'}; - # Get seconds, without decimlas, from timestamp. - # '00:01:01.435601' => 61 seconds. - my ( $h, $m, $s ) = split( ':|\.', $ref->{'age'} ); - $nms::web::json{'switches'}{$ref->{'sysname'}}{'age6'} = ($h*60*60) + ($m*60) + $s; # $$ref->{'age'}; -} - -$nms::web::cc{'max-age'} = "1"; -$nms::web::cc{'stale-while-revalidate'} = "5"; -finalize_output(); |