I needed to ignore a specific network during discovery so that one of my devices wouldn't use that IP address for it's management interface. I also don't want Netdisco to dig into that network at some point in the future.
I hacked this patch and it appears to work.
=============CUT===============
diff -r -U3 OLD/perl5/lib/perl5/App/Netdisco/Core/Discover.pm perl5/lib/perl5/App/Netdisco/Core/Discover.pm
--- OLD/perl5/lib/perl5/App/Netdisco/Core/Discover.pm 2014-09-12 08:06:21.000000000 -0500
+++ perl5/lib/perl5/App/Netdisco/Core/Discover.pm 2014-11-12 11:01:02.559006083 -0600
@@ -3,7 +3,8 @@
use Dancer qw/:syntax :script/;
use Dancer::Plugin::DBIC 'schema';
-use App::Netdisco::Util::Device qw/get_device is_discoverable/;
+#use App::Netdisco::Util::Device qw/get_device is_discoverable/;
+use App::Netdisco::Util::Device ':all';
use App::Netdisco::Util::DNS ':all';
use App::Netdisco::JobQueue qw/jq_queued jq_insert/;
use NetAddr::IP::Lite ':lower';
@@ -126,6 +127,7 @@
next if $addr eq '0.0.0.0'; next if $ip->within($localnet);
next if check_device_only($addr,'ignore_nets');
next if setting('ignore_private_nets') and $ip->is_rfc1918;
my $iid = $ip_index->{$addr};
diff -r -U3 OLD/perl5/lib/perl5/auto/share/dist/App-Netdisco/config.yml perl5/lib/perl5/auto/share/dist/App-Netdisco/config.yml
--- OLD/perl5/lib/perl5/auto/share/dist/App-Netdisco/config.yml 2014-09-22 13:58:45.000000000 -0500
+++ perl5/lib/perl5/auto/share/dist/App-Netdisco/config.yml 2014-11-12 10:49:15.619491100 -0600
@@ -150,6 +150,8 @@
- 'Virtual-Access\d+'
- '(E|T)\d \d\/\d\/\d'
ignore_private_nets: false
+ignore_nets:
+ - 0.0.0.0/0
reverse_sysname: false
vlanctl: true
portctl_nameonly: false
=============CUT===============
In the configuration, you MUST have at least one network defined, or the "check_device_only" will return true. The solution is to define the network as "0.0.0.0/0" because that is already being ignored to lines above, making it the safe choice. By adding "ignore_nets:" to the environments/deployment.yml with a list of networks to be ignored, these IPs should be ignored for discovery, meaning that no device will receive one of those IPs as it's management IP.
At least, that's what I THINK is happening (it worked for me :).
There is likely some earth-shattering thing that I've missed here, so please review what I did and let me know if I flubbed it.
I'm a bit skeptical about this... it's filtering entries in the device_ip table and not really changing what SNMP::Info::root_ip returns. Surely we still want to see all device IPs? I'd prefer a smarter way to steer root_ip().
Fair enough. It worked for me :).
On Nov 13, 2014 5:47 PM, "Oliver Gorwits" olly_g@users.sf.net wrote:
Ticket moved from /p/netdisco/netdisco2/167/