aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorroot <root@frank.tg14.gathering.org>2014-04-17 18:09:54 +0200
committerroot <root@frank.tg14.gathering.org>2014-04-17 18:09:54 +0200
commitda381311eed480894faa065d6411584dfb7ba439 (patch)
tree932584d45a5d704cbc3812361d830d06a532601a
parent8458a6aba1c7f1528e1fd8a0fa49ab34d7e6b3c9 (diff)
Somewhat better error handling.
-rwxr-xr-xclients/snmpfetch.pl12
1 files changed, 11 insertions, 1 deletions
diff --git a/clients/snmpfetch.pl b/clients/snmpfetch.pl
index 009c155..4064b1c 100755
--- a/clients/snmpfetch.pl
+++ b/clients/snmpfetch.pl
@@ -119,7 +119,17 @@ sub poll_loop {
my $community = $switch->{'community'};
my $start = [Time::HiRes::gettimeofday];
- my $session = nms::snmp_open_session($ip, $community, 1);
+ my $session;
+ eval {
+ $session = nms::snmp_open_session($ip, $community, 1);
+ };
+ if ($@) {
+ warn "Couldn't open session (even an async one!) to $ip: $!";
+ $qunlock->execute($switch->{'switch'})
+ or die "Couldn't unlock switch";
+ $dbh->commit;
+ next;
+ };
my @ports = expand_ports($switch->{'ports'});
my $switch_status = {