aboutsummaryrefslogtreecommitdiffstats
path: root/web/api/public/dhcp-summary
diff options
context:
space:
mode:
authorroot <root@gondul.tg23.gathering.org>2023-04-09 09:33:48 +0200
committerroot <root@gondul.tg23.gathering.org>2023-04-09 09:33:48 +0200
commit7fb2a008d48931ab7deb6f31a2d7c4289a71f09a (patch)
tree2a21e4a4f811bfb13f025241e55fd3aff513acd1 /web/api/public/dhcp-summary
parentca8a57176f1106fa5dade25174b61c1596ac1820 (diff)
TG23: Throw everything over the wall and run!
Diffstat (limited to 'web/api/public/dhcp-summary')
-rwxr-xr-xweb/api/public/dhcp-summary4
1 files changed, 2 insertions, 2 deletions
diff --git a/web/api/public/dhcp-summary b/web/api/public/dhcp-summary
index 5245f34..beed463 100755
--- a/web/api/public/dhcp-summary
+++ b/web/api/public/dhcp-summary
@@ -6,10 +6,10 @@ use nms::web;
nms::web::setwhen('2h');
-my $q2 = $nms::web::dbh->prepare("select count(distinct data->>'clientmac') as clients from metrics where $nms::web::when;");
+my $q2 = $nms::web::dbh->prepare("select count(DISTINCT data ->> 'clientip') as clients, family(inet (data ->> 'clientip')) as family from metrics where $nms::web::when GROUP by family;");
$q2->execute();
while (my $ref = $q2->fetchrow_hashref()) {
- $nms::web::json{'dhcp'} = $ref;
+ $nms::web::json{'dhcp'}{$ref->{'family'}} = $ref->{'clients'};
}
$nms::web::cc{'max-age'} = "10";
$nms::web::cc{'stale-while-revalidate'} = "15";