diff options
Diffstat (limited to 'web/api/public/dhcp')
-rwxr-xr-x | web/api/public/dhcp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/web/api/public/dhcp b/web/api/public/dhcp index 88f1eb5..0b0bb49 100755 --- a/web/api/public/dhcp +++ b/web/api/public/dhcp @@ -8,13 +8,13 @@ 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 . ' order by sysname,time desc;'); +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;'); $q->execute(); while ( my $ref = $q->fetchrow_hashref() ) { my $sysname = $ref->{'sysname'}; $json{'dhcp'}{$ref->{'sysname'}} = $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 group by switches.sysname;"); +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;"); $q2->execute(); while (my $ref = $q2->fetchrow_hashref()) { $nms::web::json{'switches'}{$ref->{sysname}} = $ref; |