aboutsummaryrefslogtreecommitdiffstats
path: root/web/api/public/dhcp
diff options
context:
space:
mode:
authorroot <root@colazero.tele.tg18.gathering.org>2018-03-26 13:04:05 +0200
committerroot <root@colazero.tele.tg18.gathering.org>2018-03-26 13:04:05 +0200
commitbe54730288b9925003e88788e65f11199cc8292b (patch)
treef5a96e9b34fa43fb1fc36cc6923c346d75ed9f5f /web/api/public/dhcp
parentd6a5794527b555dca86be61c757d24bb86930dd3 (diff)
Mange dager med rot på TG18
Diffstat (limited to 'web/api/public/dhcp')
-rwxr-xr-xweb/api/public/dhcp10
1 files changed, 5 insertions, 5 deletions
diff --git a/web/api/public/dhcp b/web/api/public/dhcp
index 0b0bb49..f153a49 100755
--- a/web/api/public/dhcp
+++ b/web/api/public/dhcp
@@ -8,16 +8,16 @@ 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 . ' and switches.deleted = false order by sysname,time desc;');
+my $q = $nms::web::dbh->prepare('select distinct on (name) extract(epoch from date_trunc(\'second\',time)) as time,name from dhcp join networks on dhcp.network = networks.network where ' . $nms::web::when . ' order by name,time desc;');
$q->execute();
while ( my $ref = $q->fetchrow_hashref() ) {
- my $sysname = $ref->{'sysname'};
- $json{'dhcp'}{$ref->{'sysname'}} = $ref->{'time'};
+ my $sysname = $ref->{'sname'};
+ $json{'dhcp'}{$ref->{'name'}} = $ref->{'time'};
}
-my $q2 = $nms::web::dbh->prepare("select sysname,count(distinct mac) as clients,count(distinct ip) as addresses,count(mac) as acks from dhcp natural join switches where $nms::web::when and switches.deleted = false group by switches.sysname;");
+my $q2 = $nms::web::dbh->prepare("select name,count(distinct mac) as clients,count(distinct ip) as addresses,count(mac) as acks from dhcp natural join networks where $nms::web::when group by networks.name;");
$q2->execute();
while (my $ref = $q2->fetchrow_hashref()) {
- $nms::web::json{'switches'}{$ref->{sysname}} = $ref;
+ $nms::web::json{'networks'}{$ref->{name}} = $ref;
}
$nms::web::cc{'max-age'} = "10";