diff options
author | Kristian Lyngstol <kristian@bohemians.org> | 2016-04-12 18:01:32 +0200 |
---|---|---|
committer | Kristian Lyngstol <kristian@bohemians.org> | 2016-04-12 18:01:32 +0200 |
commit | 09ea945c3908fd42e90eb64c194d9af11d174206 (patch) | |
tree | 8bcf0f98113ea4a92effa1c39344730c7e6f50b0 /web/api/public/dhcp | |
parent | c3ebdbda43c23ade1e49dfd9f546fba1d15f9941 (diff) |
Actual initial import
Fetched from tgmanage.
Diffstat (limited to 'web/api/public/dhcp')
-rwxr-xr-x | web/api/public/dhcp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/web/api/public/dhcp b/web/api/public/dhcp new file mode 100755 index 0000000..7b048d1 --- /dev/null +++ b/web/api/public/dhcp @@ -0,0 +1,20 @@ +#! /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; + +nms::web::setwhen('60m'); +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'} = "10"; +$nms::web::cc{'stale-while-revalidate'} = "30"; +finalize_output(); |