]> git.sesse.net Git - nms/blobdiff - clients/dhcptail.pl
Use nms::db_connect() everywhere.
[nms] / clients / dhcptail.pl
index 50a51b9feef7aa3804b06ec3cee6fae0a23b0ce0..a1e1c624fa0511a11677980020bf9f2adfdf1a11 100755 (executable)
@@ -1,6 +1,8 @@
 #! /usr/bin/perl
 use DBI;
 use POSIX;
+use lib '../include';
+use nms;
 use strict;
 use warnings;
 
@@ -28,8 +30,7 @@ while (<>) {
        my $date = $year . "-" . $months{$1} . "-" . $2 . " " . $3;
 
        if (!defined($dbh) || !$dbh->ping) {
-               $dbh = DBI->connect("dbi:Pg:dbname=snmpfetch;host=violet.tg05.gathering.org", "snmpfetch", "removed")
-                       or die "Couldn't connect to database";
+               $dbh = nms::db_connect();
                $q = $dbh->prepare("UPDATE dhcp SET last_ack=? WHERE inet ? << network AND ( last_ack < ? OR last_ack IS NULL )")
                        or die "Couldn't prepare query";
        }