aboutsummaryrefslogtreecommitdiffstats
path: root/web/api
diff options
context:
space:
mode:
Diffstat (limited to 'web/api')
-rwxr-xr-xweb/api/public/dhcp-summary2
-rwxr-xr-xweb/api/write/switches5
2 files changed, 6 insertions, 1 deletions
diff --git a/web/api/public/dhcp-summary b/web/api/public/dhcp-summary
index 18a7f69..5245f34 100755
--- a/web/api/public/dhcp-summary
+++ b/web/api/public/dhcp-summary
@@ -6,7 +6,7 @@ use nms::web;
nms::web::setwhen('2h');
-my $q2 = $nms::web::dbh->prepare("select count(distinct mac) as clients,count(distinct ip) as addresses,count(mac) as acks from dhcp where $nms::web::when;");
+my $q2 = $nms::web::dbh->prepare("select count(distinct data->>'clientmac') as clients from metrics where $nms::web::when;");
$q2->execute();
while (my $ref = $q2->fetchrow_hashref()) {
$nms::web::json{'dhcp'} = $ref;
diff --git a/web/api/write/switches b/web/api/write/switches
index 1f91d48..e0ee950 100755
--- a/web/api/write/switches
+++ b/web/api/write/switches
@@ -63,6 +63,11 @@ foreach my $tmp2 (@tmp) {
} else {
%placement = %{convertplace($switch{'placement'})};
}
+ if (defined($switch{'tags'})) {
+ # MY GOD I HATE THIS
+ # But I'm too lazy to improve it more for now.
+ $switch{'tags'} = "[". join(",", map { "\"".$_."\"" } @{$switch{'tags'}})."]";
+ }
my ($x1,$x2,$y1,$y2);
$x1 = $placement{'x1'};
$y1 = $placement{'y1'};