diff options
author | Magnus Kirø <magnuskiro@gmail.com> | 2016-03-22 11:14:46 +0100 |
---|---|---|
committer | Magnus Kirø <magnuskiro@gmail.com> | 2016-03-22 11:14:46 +0100 |
commit | 7806081670c8c9807fc8b6628b3d7a6eff841ded (patch) | |
tree | 082e522b99cd5b864a8963523f2b3889f6cff808 /web/nms.gathering.org/api/public/dhcp | |
parent | e501dd7dd88bf52edd914a8f078141b91d53939b (diff) | |
parent | 2d19233ba32fd23ad7182d3cccb58cec9e377a75 (diff) |
MERGE fix.
Diffstat (limited to 'web/nms.gathering.org/api/public/dhcp')
-rwxr-xr-x | web/nms.gathering.org/api/public/dhcp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/web/nms.gathering.org/api/public/dhcp b/web/nms.gathering.org/api/public/dhcp new file mode 100755 index 0000000..d432af0 --- /dev/null +++ b/web/nms.gathering.org/api/public/dhcp @@ -0,0 +1,19 @@ +#! /usr/bin/perl +# vim:ts=8:sw=8 + +use lib '../../../../include'; +use nms::web qw (%json finalize_output); +use strict; +use warnings; +use Data::Dumper; + +my $q = $nms::web::dbh->prepare('select distinct on (sysname) extract(epoch from date_trunc(\'second\',time)) as time,sysname from dhcp join switches on dhcp.switch = switches.switch where ' . $nms::web::when . ' order by sysname,time desc;'); +$q->execute(); +while ( my $ref = $q->fetchrow_hashref() ) { + my $sysname = $ref->{'sysname'}; + $json{'dhcp'}{$ref->{'sysname'}} = $ref->{'time'}; +} + +$nms::web::cc{'max-age'} = "5"; +$nms::web::cc{'stale-while-revalidate'} = "30"; +finalize_output(); |