X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=web%2Fnettkart-text.pl;h=23e5cad1898c810930e21181da494f3c3792fcbd;hb=cdd60722550e4c3fc22faf1d00b0214f0d08bce8;hp=6ac1d9f9667b7beb6a5812b8b0e64ad1e023e804;hpb=d6cfbb682b3492d24b6623fbf1345c5b2b95f230;p=nms diff --git a/web/nettkart-text.pl b/web/nettkart-text.pl index 6ac1d9f..23e5cad 100755 --- a/web/nettkart-text.pl +++ b/web/nettkart-text.pl @@ -1,11 +1,12 @@ #! /usr/bin/perl use CGI; use DBI; +use lib '../include'; +use nms; my $cgi = CGI->new; -my $dbh = DBI->connect("dbi:Pg:dbname=snmpfetch;host=violet.tg05.gathering.org", "snmpfetch", "removed") - or die "Couldn't connect to database"; -print $cgi->header(-type=>'text/html', -refresh=>'10; http://nms.tg05.gathering.org/nettkart-text.pl'); +my $dbh = nms::db_connect(); +print $cgi->header(-type=>'text/html; charset=utf-8', -refresh=>'10; http://nms.tg07.gathering.org/nettkart-text.pl'); print <<"EOF"; @@ -16,10 +17,7 @@ print <<"EOF"; EOF -my $q = $dbh->prepare('select * from switches natural join placements natural left join -( select switch,sum(bytes_in)/count(*) as -bytes_in,sum(bytes_out)/count(*) as bytes_out from get_datarate() group -by switch ) t1'); +my $q = $dbh->prepare('select * from switches natural join placements'); $q->execute(); while (my $ref = $q->fetchrow_hashref()) { $ref->{'placement'} =~ /\((\d+),(\d+)\),\((\d+),(\d+)\)/;