Support for macsuck_no, macsuck_only, arpnip_no, arpnip_only

This commit is contained in:
Oliver Gorwits
2013-08-26 20:45:23 +01:00
parent 864da4c1ec
commit 2f7cc25daf
6 changed files with 44 additions and 20 deletions

View File

@@ -1,6 +1,7 @@
package App::Netdisco::Daemon::Worker::Poller::Arpnip;
use App::Netdisco::Core::Arpnip 'do_arpnip';
use App::Netdisco::Util::Device 'is_arpnipable';
use Role::Tiny;
use namespace::clean;
@@ -8,6 +9,7 @@ use namespace::clean;
with 'App::Netdisco::Daemon::Worker::Poller::Common';
sub arpnip_action { \&do_arpnip }
sub arpnip_filter { \&is_arpnipable }
sub arpnip_layer { 3 }
sub arpwalk { (shift)->_walk_body('arpnip', @_) }

View File

@@ -66,7 +66,14 @@ sub _single_body {
if ($device->in_storage
and $device->vendor and $device->vendor eq 'netdisco') {
return job_done("Skipped $job_type for pseudo-device $host");
return job_done("$job_type skipped: $host is pseudo-device");
}
my $filter_method = $job_type .'_filter';
my $job_filter = $self->$filter_method;
unless ($job_filter->($device->ip)) {
return job_defer("$job_type deferred: $host is not ${job_type}able");
}
my $snmp = snmp_connect($device);

View File

@@ -1,6 +1,7 @@
package App::Netdisco::Daemon::Worker::Poller::Macsuck;
use App::Netdisco::Core::Macsuck 'do_macsuck';
use App::Netdisco::Util::Device 'is_macsuckable';
use Role::Tiny;
use namespace::clean;
@@ -8,6 +9,7 @@ use namespace::clean;
with 'App::Netdisco::Daemon::Worker::Poller::Common';
sub macsuck_action { \&do_macsuck }
sub macsuck_filter { \&is_macsuckable }
sub macsuck_layer { 2 }
sub macwalk { (shift)->_walk_body('macsuck', @_) }

View File

@@ -312,6 +312,20 @@ Value: Number. Default: 0.
Sets the minimum amount of time in seconds which must elapse between any two
discover jobs for a device.
=head3 C<macsuck_no>
Value: List of Network Identifiers. Default: Empty List.
IP addresses in the list will not be visited for macsuck. You can include
hostnames, IP addresses and subnets (IPv4 or IPv6) in the list.
=head3 C<macsuck_only>
Value: List of Network Identifiers. Default: Empty List.
If present, macsuck will be limited to IP addresses matching entries in this
list. You can include hostnames, IP addresses and subnets (IPv4 and IPv6).
=head3 C<macsuck_all_vlans>
Value: Boolean. Default: C<false>.
@@ -343,6 +357,20 @@ Value: Number. Default: 0.
Sets the minimum amount of time in seconds which must elapse between any two
macsuck jobs for a device.
=head3 C<arpnip_no>
Value: List of Network Identifiers. Default: Empty List.
IP addresses in the list will not be visited for arpnip. You can include
hostnames, IP addresses and subnets (IPv4 or IPv6) in the list.
=head3 C<arpnip_only>
Value: List of Network Identifiers. Default: Empty List.
If present, arpnip will be limited to IP addresses matching entries in this
list. You can include hostnames, IP addresses and subnets (IPv4 and IPv6).
=head3 C<arpnip_min_age>
Value: Number. Default: 0.
@@ -583,14 +611,6 @@ These settings are from Netdisco 1.x but are yet to be supported in Netdisco
=item *
C<arpnip_no>
=item *
C<arpnip_only>
=item *
C<bulkwalk_no>
=item *
@@ -623,10 +643,6 @@ C<get_community>
=item *
C<macsuck_no>
=item *
C<macsuck_no_devicevlan>
=item *
@@ -635,10 +651,6 @@ C<macsuck_no_vlan>
=item *
C<macsuck_only>
=item *
C<macsuck_timeout>
=item *

View File

@@ -110,7 +110,7 @@ sub is_discoverable {
if ($device->since_last_discover
and $device->since_last_discover < $discover_since) {
return _bail_msg("is_discoverable: last discover less than discover_min_age");
return _bail_msg("is_discoverable: time since last discover less than discover_min_age");
}
return 1;
@@ -157,7 +157,7 @@ sub is_arpnipable {
if ($device->since_last_arpnip
and $device->since_last_arpnip < $arpnip_since) {
return _bail_msg("is_arpnipable: last arpnip less than arpnip_min_age");
return _bail_msg("is_arpnipable: time since last arpnip less than arpnip_min_age");
}
return 1;
@@ -204,7 +204,7 @@ sub is_macsuckable {
if ($device->since_last_macsuck
and $device->since_last_macsuck < $macsuck_since) {
return _bail_msg("is_macsuckable: last macsuck less than macsuck_min_age");
return _bail_msg("is_macsuckable: time since last macsuck less than macsuck_min_age");
}
return 1;