aboutsummaryrefslogtreecommitdiffstats
path: root/web/nms-public.gathering.org/api/public/dhcp-summary
diff options
context:
space:
mode:
authorNicolai Tellefsen <niccofyren@gmail.com>2016-03-21 20:33:44 +0100
committerNicolai Tellefsen <niccofyren@gmail.com>2016-03-21 20:33:44 +0100
commit5ba657e0bca0e4970b08583f6dfc94bfae34741c (patch)
tree44ed77deecd40ca984aae4bfa1bb949cb87bf7a0 /web/nms-public.gathering.org/api/public/dhcp-summary
parentd528cad67897dd2c3b98ec15a82868ac2764e2c7 (diff)
parent727e4ab31aa6d1a754711d4cd29dbcefae2e952a (diff)
Merge branch 'master' of https://github.com/tech-server/tgmanage
Diffstat (limited to 'web/nms-public.gathering.org/api/public/dhcp-summary')
-rwxr-xr-xweb/nms-public.gathering.org/api/public/dhcp-summary21
1 files changed, 21 insertions, 0 deletions
diff --git a/web/nms-public.gathering.org/api/public/dhcp-summary b/web/nms-public.gathering.org/api/public/dhcp-summary
new file mode 100755
index 0000000..dd643b2
--- /dev/null
+++ b/web/nms-public.gathering.org/api/public/dhcp-summary
@@ -0,0 +1,21 @@
+#! /usr/bin/perl
+use lib '../../../../include';
+use strict;
+use warnings;
+use nms::web;
+
+nms::web::setwhen('2h');
+my $q = $nms::web::dbh->prepare("select count(distinct mac) as clients,count(distinct ip) as addresses,count(mac) as acks from dhcp;");
+$q->execute();
+while (my $ref = $q->fetchrow_hashref()) {
+ $nms::web::json{'dhcp'}{'total'} = $ref;
+}
+
+my $q2 = $nms::web::dbh->prepare("select count(distinct mac) as clients,count(distinct ip) as addresses,count(mac) as acks from dhcp where $nms::web::when;");
+$q2->execute();
+while (my $ref = $q2->fetchrow_hashref()) {
+ $nms::web::json{'dhcp'}{'recent'} = $ref;
+}
+$nms::web::cc{'max-age'} = "10";
+$nms::web::cc{'stale-while-revalidate'} = "15";
+finalize_output();