aboutsummaryrefslogtreecommitdiffstats
path: root/clients/snmpfetchng.pl
diff options
context:
space:
mode:
authorNicolai Tellefsen <niccofyren@gmail.com>2016-03-17 22:53:28 +0100
committerNicolai Tellefsen <niccofyren@gmail.com>2016-03-17 22:53:28 +0100
commit8fb5b7047179444b4e08a60b78fa6ad2bcb1cd77 (patch)
tree86c5b2452bfc44130dd27d7ef9105f2e8689d5d4 /clients/snmpfetchng.pl
parenta24f3520a43cf59d0ac88270ba956c9aa67de469 (diff)
parent06b47ddd070fb1b46de53c7187acbf27878b8f07 (diff)
Merge branch 'master' of https://github.com/tech-server/tgmanage
Diffstat (limited to 'clients/snmpfetchng.pl')
-rwxr-xr-xclients/snmpfetchng.pl5
1 files changed, 2 insertions, 3 deletions
diff --git a/clients/snmpfetchng.pl b/clients/snmpfetchng.pl
index 68baddd..e813499 100755
--- a/clients/snmpfetchng.pl
+++ b/clients/snmpfetchng.pl
@@ -29,7 +29,7 @@ EOF
# Borrowed from snmpfetch.pl
our $qswitch = $dbh->prepare(<<"EOF")
SELECT
- *,
+ sysname,switch,host(ip) as ip,community,
DATE_TRUNC('second', now() - last_updated - poll_frequency) AS overdue
FROM
switches
@@ -38,7 +38,6 @@ $qualification
ORDER BY
overdue DESC
LIMIT ?
-FOR UPDATE OF switches
EOF
or die "Couldn't prepare qswitch";
our $qlock = $dbh->prepare("UPDATE switches SET locked='t', last_updated=now() WHERE switch=?")
@@ -95,6 +94,7 @@ sub inner_loop
$switch{'start'} = time;
$qlock->execute($switch{'id'})
or die "Couldn't lock switch";
+ $dbh->commit;
my $s = SNMP::Session->new(DestHost => $switch{'mgtip'},
Community => $switch{'community'},
UseEnums => 1,
@@ -105,7 +105,6 @@ sub inner_loop
$outstanding--;
}
}
- $dbh->commit;
mylog( "Polling " . @switches . " switches: $poll_todo");
SNMP::MainLoop(5);
}