set snmp driver on macsuck phase workers

This commit is contained in:
Oliver Gorwits
2017-09-09 16:27:58 +01:00
parent 9167e02de5
commit 16a79463cb
3 changed files with 12 additions and 14 deletions

View File

@@ -14,11 +14,15 @@ use Dancer::Plugin::DBIC 'schema';
use Time::HiRes 'gettimeofday';
use Scope::Guard 'guard';
register_worker({ primary => true }, sub {
register_worker({ primary => true, driver => 'snmp' }, sub {
my ($job, $workerconf) = @_;
my $device = $job->device;
my $snmp = App::Netdisco::Transport::SNMP->reader_for($device);
my $snmp = App::Netdisco::Transport::SNMP->reader_for($device)
or return Status->defer("macsuck failed: could not SNMP connect to $host");
return Status->defer("Skipped macsuck for device $host without layer 2 capability")
unless $snmp->has_layer(2);
# would be possible just to use now() on updated records, but by using this
# same value for them all, we can if we want add a job at the end to