X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=clients%2Fdhcptail.pl;h=6a529de940caa23aa252afe5e4b5972f6c41c754;hb=40d35b60ae030b1c9c013734675503e83d86cb0e;hp=044c81750e3b14d86d1a889bdbdb834c1c41b6b5;hpb=d6cfbb682b3492d24b6623fbf1345c5b2b95f230;p=nms diff --git a/clients/dhcptail.pl b/clients/dhcptail.pl index 044c817..6a529de 100755 --- a/clients/dhcptail.pl +++ b/clients/dhcptail.pl @@ -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"; }