From bb862773d69bc5997bd1628a3f0505827e7cfe5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20Lyngst=C3=B8l?= Date: Mon, 10 Apr 2017 14:06:23 +0200 Subject: TG17 stuff ? --- web/api/public/distro-tree | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 web/api/public/distro-tree (limited to 'web/api/public/distro-tree') diff --git a/web/api/public/distro-tree b/web/api/public/distro-tree new file mode 100755 index 0000000..5d93e1b --- /dev/null +++ b/web/api/public/distro-tree @@ -0,0 +1,25 @@ +#! /usr/bin/perl +# vim:ts=8:sw=8 + +use CGI qw(fatalsToBrowser); +use DBI; +use lib '/opt/gondul/include'; +use nms; +use nms::web; +use strict; +use warnings; +use Data::Dumper; + +$nms::web::cc{'max-age'} = "20"; + +my $q2 = $nms::web::dbh->prepare('select sysname,distro_phy_port,distro_name from switches where placement is not null and distro_name is not null and distro_phy_port is not null'); + +$q2->execute(); +while (my $ref = $q2->fetchrow_hashref()) { + my $sysname = $ref->{'sysname'}; + my $phy = $ref->{'distro_phy_port'}; + my $distro = $ref->{'distro_name'}; + $nms::web::json{'distro-tree'}{$distro}{$phy} = $sysname; +} + +finalize_output(); -- cgit v1.2.3