]> git.sesse.net Git - nms/blobdiff - web/showswitch.pl
Use nms::db_connect() everywhere.
[nms] / web / showswitch.pl
index 7dd716c964248ab2123d22d6f13fd08ae181adca..3be8769c34dafdd0127203a52756049fe20bf343 100755 (executable)
@@ -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);