diff options
author | root <root@gondul.tg23.gathering.org> | 2023-04-09 09:33:48 +0200 |
---|---|---|
committer | root <root@gondul.tg23.gathering.org> | 2023-04-09 09:33:48 +0200 |
commit | 7fb2a008d48931ab7deb6f31a2d7c4289a71f09a (patch) | |
tree | 2a21e4a4f811bfb13f025241e55fd3aff513acd1 /web/api/public/dhcp-summary | |
parent | ca8a57176f1106fa5dade25174b61c1596ac1820 (diff) |
TG23: Throw everything over the wall and run!
Diffstat (limited to 'web/api/public/dhcp-summary')
-rwxr-xr-x | web/api/public/dhcp-summary | 4 |
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"; |