diff options
Diffstat (limited to 'collectors/snmpfetchng.pl')
-rwxr-xr-x | collectors/snmpfetchng.pl | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/collectors/snmpfetchng.pl b/collectors/snmpfetchng.pl index 3a5ecce..399023b 100755 --- a/collectors/snmpfetchng.pl +++ b/collectors/snmpfetchng.pl @@ -28,7 +28,7 @@ $dbh->{RaiseError} = 1; my $influx = nms::influx_connect(); my $qualification = <<"EOF"; (last_updated IS NULL OR now() - last_updated > poll_frequency) -AND (locked='f' OR now() - last_updated > '15 minutes'::interval) +AND (locked='f' OR now() - last_updated > '5 minutes'::interval) AND (mgmt_v4_addr is not null or mgmt_v6_addr is not null) AND deleted = false EOF @@ -99,11 +99,15 @@ sub inner_loop my $s = SNMP::Session->new(DestHost => $switch{'mgtip'}, Community => $switch{'community'}, UseEnums => 1, - Timeout => 5000000, + Timeout => 10000000, Version => '2'); - my $ret = $s->bulkwalk(0, 10, @nms::config::snmp_objects, sub{ callback(\%switch, @_); }); - if (!defined($ret)) { - mylog("Fudge: ". $s->{'ErrorStr'}); + if (!defined($s)) { + mylog("Fudge, no session defined. Now what?") + } else { + my $ret = $s->bulkwalk(0, 10, @nms::config::snmp_objects, sub{ callback(\%switch, @_); }); + if (!defined($ret)) { + mylog("Fudge: ". $s->{'ErrorStr'}); + } } } mylog( "Polling " . @switches . " switches: $poll_todo"); @@ -235,6 +239,7 @@ sub callback{ on_success => $cv, on_error => sub { $cv->croak("Failed to write data: @_"); + # warn "Failed to write data: @_"; } ); $cv->recv; @@ -242,7 +247,7 @@ sub callback{ warn "caught error: $_"; }; - if ((time - $switch{'start'}) > 5) { + if ((time - $switch{'start'}) > 10) { mylog( "Polled $switch{'sysname'} in " . (time - $switch{'start'}) . "s."); } } else { |