From 4ea3a099b05fa910498bfbf1b2d7387118355472 Mon Sep 17 00:00:00 2001 From: "Ole Mathias Aa. Heggem" Date: Sun, 13 Apr 2025 07:18:45 +0200 Subject: Upgrade bootstrap and rewrite API (#230) --- web/api/public/ping | 35 ----------------------------------- 1 file changed, 35 deletions(-) delete mode 100755 web/api/public/ping (limited to 'web/api/public/ping') 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(); -- cgit v1.2.3