]> git.sesse.net Git - nms/blobdiff - clients/dhcptail.pl
Lower the sleep interval.
[nms] / clients / dhcptail.pl
index 044c81750e3b14d86d1a889bdbdb834c1c41b6b5..6a529de940caa23aa252afe5e4b5972f6c41c754 100755 (executable)
@@ -1,11 +1,13 @@
 #! /usr/bin/perl
 use DBI;
 use POSIX;
+use lib '../include';
+use nms;
 use strict;
 use warnings;
 
 # WARNING: CHANGE THIS! :-P
-my $year = 2005;
+my $year = 2007;
 
 my %months = (
        Jan => 1,
@@ -28,9 +30,8 @@ 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";
-               $q = $dbh->prepare("UPDATE dhcp SET last_ack=? WHERE inet ? << network AND ( last_ack < ? OR last_ack IS NULL )")
+               $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";
        }