From 7fb2a008d48931ab7deb6f31a2d7c4289a71f09a Mon Sep 17 00:00:00 2001 From: root Date: Sun, 9 Apr 2023 09:33:48 +0200 Subject: TG23: Throw everything over the wall and run! --- web/api/public/dhcp-summary | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'web/api/public/dhcp-summary') 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"; -- cgit v1.2.3