X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=web%2Fshowswitch.pl;h=3be8769c34dafdd0127203a52756049fe20bf343;hb=9725b2cf4b9f59d38b6aa2e45c2da91766c90c91;hp=7dd716c964248ab2123d22d6f13fd08ae181adca;hpb=d6cfbb682b3492d24b6623fbf1345c5b2b95f230;p=nms diff --git a/web/showswitch.pl b/web/showswitch.pl index 7dd716c..3be8769 100755 --- a/web/showswitch.pl +++ b/web/showswitch.pl @@ -5,6 +5,8 @@ use Time::HiRes; use POSIX ":sys_wait_h"; use strict; use warnings; +use lib '../include'; +use nms; my $cgi = CGI->new; my $switch = $cgi->param('id'); my $width = $cgi->param('width'); @@ -18,8 +20,7 @@ $height = 250 unless (defined($height)); require './mygraph.pl'; my $start = [Time::HiRes::gettimeofday]; -my $dbh = DBI->connect("dbi:Pg:dbname=snmpfetch;host=violet.tg05.gathering.org", "snmpfetch", "removed") - or die "Couldn't connect to database"; +my $dbh = nms::db_connect(); # Fetch the name my $ref = $dbh->selectrow_hashref('SELECT sysname FROM switches WHERE switch=?', undef, $switch);