Merge branch 'master' into og-newnetmap
This commit is contained in:
16
Changes
16
Changes
@@ -1,4 +1,17 @@
|
||||
2.036012_003 - EXPERIMENTAL RELEASE
|
||||
2.037002 - 2017-12-14
|
||||
|
||||
[ENHANCEMENTS]
|
||||
|
||||
* Include Connected Device ID in Device Ports sidebar cookie
|
||||
* Improve netdisco-do docs
|
||||
|
||||
2.037001 - 2017-12-14
|
||||
|
||||
[ENHANCEMENTS]
|
||||
|
||||
* Also update stats on running netdisco-deploy
|
||||
|
||||
2.037000 - 2017-12-14
|
||||
|
||||
[NEW FEATURES]
|
||||
|
||||
@@ -11,6 +24,7 @@
|
||||
* Deduplicate neighbors based on lldpRemChassisId
|
||||
* Scheduler config does not need to be uncommented
|
||||
* More efficient polling of the job queue
|
||||
* Better Port search options and results presentation
|
||||
|
||||
[BUG FIXES]
|
||||
|
||||
|
||||
10
META.json
10
META.json
@@ -78,6 +78,7 @@
|
||||
"Sereal" : "0",
|
||||
"Socket6" : "0.23",
|
||||
"Starman" : "0.4008",
|
||||
"Storable" : "0",
|
||||
"Template" : "2.24",
|
||||
"Template::Plugin::CSV" : "0.04",
|
||||
"Template::Plugin::Number::Format" : "1.02",
|
||||
@@ -85,7 +86,8 @@
|
||||
"Term::UI" : "0",
|
||||
"Try::Tiny" : "0",
|
||||
"URI" : "0",
|
||||
"URL::Encode" : "0.01",
|
||||
"URL::Encode" : "0.03",
|
||||
"URL::Encode::XS" : "0",
|
||||
"YAML" : "0.84",
|
||||
"YAML::XS" : "0.41",
|
||||
"aliased" : "0",
|
||||
@@ -103,7 +105,7 @@
|
||||
"provides" : {
|
||||
"App::Netdisco" : {
|
||||
"file" : "lib/App/Netdisco.pm",
|
||||
"version" : "2.036012_003"
|
||||
"version" : "2.037001"
|
||||
},
|
||||
"App::Netdisco::AnyEvent::Nbtstat" : {
|
||||
"file" : "lib/App/Netdisco/AnyEvent/Nbtstat.pm"
|
||||
@@ -740,7 +742,7 @@
|
||||
"file" : "lib/Dancer/Template/NetdiscoTemplateToolkit.pm"
|
||||
}
|
||||
},
|
||||
"release_status" : "testing",
|
||||
"release_status" : "stable",
|
||||
"resources" : {
|
||||
"bugtracker" : {
|
||||
"web" : "https://github.com/netdisco/netdisco/issues"
|
||||
@@ -755,6 +757,6 @@
|
||||
"x_IRC" : "irc://irc.freenode.org/#netdisco",
|
||||
"x_MailingList" : "https://lists.sourceforge.net/lists/listinfo/netdisco-users"
|
||||
},
|
||||
"version" : "2.036012_003",
|
||||
"version" : "2.037001",
|
||||
"x_serialization_backend" : "JSON::PP version 2.94"
|
||||
}
|
||||
|
||||
8
META.yml
8
META.yml
@@ -18,7 +18,7 @@ name: App-Netdisco
|
||||
provides:
|
||||
App::Netdisco:
|
||||
file: lib/App/Netdisco.pm
|
||||
version: 2.036012_003
|
||||
version: '2.037001'
|
||||
App::Netdisco::AnyEvent::Nbtstat:
|
||||
file: lib/App/Netdisco/AnyEvent/Nbtstat.pm
|
||||
App::Netdisco::Backend::Job:
|
||||
@@ -498,6 +498,7 @@ requires:
|
||||
Sereal: '0'
|
||||
Socket6: '0.23'
|
||||
Starman: '0.4008'
|
||||
Storable: '0'
|
||||
Template: '2.24'
|
||||
Template::Plugin::CSV: '0.04'
|
||||
Template::Plugin::Number::Format: '1.02'
|
||||
@@ -505,7 +506,8 @@ requires:
|
||||
Term::UI: '0'
|
||||
Try::Tiny: '0'
|
||||
URI: '0'
|
||||
URL::Encode: '0.01'
|
||||
URL::Encode: '0.03'
|
||||
URL::Encode::XS: '0'
|
||||
YAML: '0.84'
|
||||
YAML::XS: '0.41'
|
||||
aliased: '0'
|
||||
@@ -518,5 +520,5 @@ resources:
|
||||
homepage: http://netdisco.org/
|
||||
license: http://opensource.org/licenses/bsd-license.php
|
||||
repository: https://github.com/netdisco/netdisco
|
||||
version: 2.036012_003
|
||||
version: '2.037001'
|
||||
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
|
||||
|
||||
@@ -40,6 +40,7 @@ use App::Netdisco;
|
||||
use Dancer ':script';
|
||||
use Dancer::Plugin::DBIC 'schema';
|
||||
use Dancer::Plugin::Passphrase;
|
||||
use App::Netdisco::Util::Statistics ();
|
||||
|
||||
info "App::Netdisco $App::Netdisco::VERSION loaded.";
|
||||
|
||||
@@ -139,6 +140,11 @@ sub deploy_db {
|
||||
say 'DB schema update complete.';
|
||||
print color 'reset';
|
||||
|
||||
App::Netdisco::Util::Statistics::update_stats();
|
||||
print color 'bold blue';
|
||||
say 'Statistics updated.';
|
||||
print color 'reset';
|
||||
|
||||
if (not setting('safe_password_store')) {
|
||||
say '';
|
||||
print color 'bold red';
|
||||
|
||||
@@ -166,15 +166,19 @@ netdisco-do - Run any Netdisco job from the command-line.
|
||||
|
||||
This program allows you to run any Netdisco poller job from the command-line.
|
||||
|
||||
The C<-d> option will accept a hostname (that can be resolved to an IP with
|
||||
DNS), an IP address, or IP prefix (subnets in CIDR format). It can be any
|
||||
interface on the device known to Netdisco.
|
||||
=head1 ACTIONS
|
||||
|
||||
Note that some jobs (C<discoverall>, C<macwalk>, C<arpwalk>, C<nbtwalk>)
|
||||
simply add entries to the Netdisco job queue for other jobs, so won't seem
|
||||
to do much when you trigger them.
|
||||
|
||||
=head1 ACTIONS
|
||||
For any action, if you wish to run one of its individual worker stages, then
|
||||
pass C<action::stage> as the first argument to C<netdisco-do>, for example
|
||||
C<discover::neighbors>.
|
||||
|
||||
Any action taking a C<device> parameter can be passed either a hostname or IP
|
||||
of any interface on a known or unknown device, or an IP prefix (subnet) which
|
||||
will cause C<netdisco-do> to run the action for all addresses in that range.
|
||||
|
||||
=head2 discover
|
||||
|
||||
@@ -184,7 +188,7 @@ Run a discover on the device (specified with C<-d>).
|
||||
|
||||
=head2 discoverall
|
||||
|
||||
Run a discover for all known devices.
|
||||
Queue a discover for all known devices.
|
||||
|
||||
=head2 macsuck
|
||||
|
||||
@@ -194,7 +198,7 @@ Run a macsuck on the device (specified with C<-d>).
|
||||
|
||||
=head2 macwalk
|
||||
|
||||
Run a macsuck for all known devices.
|
||||
Queue a macsuck for all known devices.
|
||||
|
||||
=head2 arpnip
|
||||
|
||||
@@ -204,7 +208,7 @@ Run an arpnip on the device (specified with C<-d>).
|
||||
|
||||
=head2 arpwalk
|
||||
|
||||
Run an arpnip for all known devices.
|
||||
Queue an arpnip for all known devices.
|
||||
|
||||
=head2 delete
|
||||
|
||||
@@ -236,7 +240,7 @@ Run an nbtstat on the node (specified with C<-d>).
|
||||
|
||||
=head2 nbtwalk
|
||||
|
||||
Run an nbtstat for all known nodes.
|
||||
Queue an nbtstat for all known nodes.
|
||||
|
||||
=head2 expire
|
||||
|
||||
|
||||
@@ -40,8 +40,7 @@ BEGIN {
|
||||
}
|
||||
|
||||
use App::Netdisco;
|
||||
use App::Netdisco::Core::Arpnip 'store_arp';
|
||||
use App::Netdisco::Util::Node 'check_mac';
|
||||
use App::Netdisco::Util::Node qw/check_mac store_arp/;
|
||||
use App::Netdisco::Util::FastResolver 'hostnames_resolve_async';
|
||||
use Dancer ':script';
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ use strict;
|
||||
use warnings;
|
||||
use 5.010_000;
|
||||
|
||||
our $VERSION = '2.036012_003';
|
||||
our $VERSION = '2.037001';
|
||||
use App::Netdisco::Configuration;
|
||||
|
||||
=head1 NAME
|
||||
@@ -219,13 +219,11 @@ Then the process below should be run for each installation:
|
||||
|
||||
# apply database schema updates, update MIBs and Vendor MACs
|
||||
~/bin/netdisco-deploy
|
||||
~/bin/netdisco-do stats
|
||||
|
||||
# restart web service (if you run it)
|
||||
~/bin/netdisco-web restart
|
||||
|
||||
# stop old daemon and start new backend worker (wherever you run them)
|
||||
~/bin/netdisco-daemon stop
|
||||
# restart the backend workers (wherever you run them)
|
||||
~/bin/netdisco-backend restart
|
||||
|
||||
=head1 Tips and Tricks
|
||||
|
||||
@@ -11,6 +11,7 @@ our @EXPORT = ();
|
||||
our @EXPORT_OK = qw/
|
||||
check_mac
|
||||
is_nbtstatable
|
||||
store_arp
|
||||
/;
|
||||
our %EXPORT_TAGS = (all => \@EXPORT_OK);
|
||||
|
||||
@@ -141,4 +142,54 @@ sub is_nbtstatable {
|
||||
return 1;
|
||||
}
|
||||
|
||||
=head2 store_arp( \%host, $now? )
|
||||
|
||||
Stores a new entry to the C<node_ip> table with the given MAC, IP (v4 or v6)
|
||||
and DNS host name. Host details are provided in a Hash ref:
|
||||
|
||||
{
|
||||
ip => '192.0.2.1',
|
||||
node => '00:11:22:33:44:55',
|
||||
dns => 'myhost.example.com',
|
||||
}
|
||||
|
||||
The C<dns> entry is optional. The update will mark old entries for this IP as
|
||||
no longer C<active>.
|
||||
|
||||
Optionally a literal string can be passed in the second argument for the
|
||||
C<time_last> timestamp, otherwise the current timestamp (C<now()>) is used.
|
||||
|
||||
=cut
|
||||
|
||||
sub store_arp {
|
||||
my ($hash_ref, $now) = @_;
|
||||
$now ||= 'now()';
|
||||
my $ip = $hash_ref->{'ip'};
|
||||
my $mac = NetAddr::MAC->new($hash_ref->{'node'});
|
||||
my $name = $hash_ref->{'dns'};
|
||||
|
||||
return if !defined $mac or $mac->errstr;
|
||||
|
||||
schema('netdisco')->txn_do(sub {
|
||||
my $current = schema('netdisco')->resultset('NodeIp')
|
||||
->search(
|
||||
{ ip => $ip, -bool => 'active'},
|
||||
{ columns => [qw/mac ip/] })->update({active => \'false'});
|
||||
|
||||
schema('netdisco')->resultset('NodeIp')
|
||||
->update_or_create(
|
||||
{
|
||||
mac => $mac->as_ieee,
|
||||
ip => $ip,
|
||||
dns => $name,
|
||||
active => \'true',
|
||||
time_last => \$now,
|
||||
},
|
||||
{
|
||||
key => 'primary',
|
||||
for => 'update',
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
@@ -5,11 +5,10 @@ use App::Netdisco::Worker::Plugin;
|
||||
use aliased 'App::Netdisco::Worker::Status';
|
||||
|
||||
use App::Netdisco::Transport::SNMP ();
|
||||
use App::Netdisco::Util::Node 'check_mac';
|
||||
use App::Netdisco::Util::Node qw/check_mac store_arp/;
|
||||
use App::Netdisco::Util::FastResolver 'hostnames_resolve_async';
|
||||
use Dancer::Plugin::DBIC 'schema';
|
||||
use Time::HiRes 'gettimeofday';
|
||||
use NetAddr::MAC ();
|
||||
|
||||
register_worker({ phase => 'main', driver => 'snmp' }, sub {
|
||||
my ($job, $workerconf) = @_;
|
||||
@@ -64,54 +63,4 @@ sub get_arps {
|
||||
return $resolved_ips;
|
||||
}
|
||||
|
||||
=head2 store_arp( \%host, $now? )
|
||||
|
||||
Stores a new entry to the C<node_ip> table with the given MAC, IP (v4 or v6)
|
||||
and DNS host name. Host details are provided in a Hash ref:
|
||||
|
||||
{
|
||||
ip => '192.0.2.1',
|
||||
node => '00:11:22:33:44:55',
|
||||
dns => 'myhost.example.com',
|
||||
}
|
||||
|
||||
The C<dns> entry is optional. The update will mark old entries for this IP as
|
||||
no longer C<active>.
|
||||
|
||||
Optionally a literal string can be passed in the second argument for the
|
||||
C<time_last> timestamp, otherwise the current timestamp (C<now()>) is used.
|
||||
|
||||
=cut
|
||||
|
||||
sub store_arp {
|
||||
my ($hash_ref, $now) = @_;
|
||||
$now ||= 'now()';
|
||||
my $ip = $hash_ref->{'ip'};
|
||||
my $mac = NetAddr::MAC->new($hash_ref->{'node'});
|
||||
my $name = $hash_ref->{'dns'};
|
||||
|
||||
return if !defined $mac or $mac->errstr;
|
||||
|
||||
schema('netdisco')->txn_do(sub {
|
||||
my $current = schema('netdisco')->resultset('NodeIp')
|
||||
->search(
|
||||
{ ip => $ip, -bool => 'active'},
|
||||
{ columns => [qw/mac ip/] })->update({active => \'false'});
|
||||
|
||||
schema('netdisco')->resultset('NodeIp')
|
||||
->update_or_create(
|
||||
{
|
||||
mac => $mac->as_ieee,
|
||||
ip => $ip,
|
||||
dns => $name,
|
||||
active => \'true',
|
||||
time_last => \$now,
|
||||
},
|
||||
{
|
||||
key => 'primary',
|
||||
for => 'update',
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
true;
|
||||
|
||||
@@ -131,6 +131,7 @@ sidebar_defaults:
|
||||
age_num: { default: 3 }
|
||||
age_unit: { default: months }
|
||||
mac_format: { default: IEEE }
|
||||
neigh_id: { default: null }
|
||||
report_moduleinventory:
|
||||
fruonly: {default: checked }
|
||||
matchall: {default: checked }
|
||||
|
||||
@@ -18,11 +18,6 @@ database:
|
||||
# RECOMMENDED SETTINGS
|
||||
# --------------------
|
||||
|
||||
# will be stripped from fqdn when displayed in the web UI
|
||||
# also, do not forget the leading dot.
|
||||
# ```````````````````````````````````````````````````````
|
||||
#domain_suffix: '.example.com'
|
||||
|
||||
# SNMP community string(s)
|
||||
# ````````````````````````
|
||||
device_auth:
|
||||
@@ -35,6 +30,11 @@ device_auth:
|
||||
# read: false
|
||||
# write: true
|
||||
|
||||
# will be stripped from fqdn when displayed in the web UI
|
||||
# also, do not forget the leading dot.
|
||||
# ```````````````````````````````````````````````````````
|
||||
#domain_suffix: '.example.com'
|
||||
|
||||
|
||||
# ¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸
|
||||
# ¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸
|
||||
|
||||
Reference in New Issue
Block a user