diff --git a/Netdisco/Changes b/Netdisco/Changes index bfba5a8c..4af8e52f 100644 --- a/Netdisco/Changes +++ b/Netdisco/Changes @@ -1,3 +1,9 @@ +2.008000 - 2013-06-09 + + [BUG FIXES] + + * localenv discovery in scripts is now more reliable + 2.007000_002 - 2013-06-03 [NEW FEATURES] diff --git a/Netdisco/MANIFEST b/Netdisco/MANIFEST index f6414979..cc9f2479 100644 --- a/Netdisco/MANIFEST +++ b/Netdisco/MANIFEST @@ -108,6 +108,7 @@ lib/App/Netdisco/Manual/ReleaseNotes.pod lib/App/Netdisco/Manual/WritingPlugins.pod lib/App/Netdisco/Util/Device.pm lib/App/Netdisco/Util/DNS.pm +lib/App/Netdisco/Util/Noop.pm lib/App/Netdisco/Util/Port.pm lib/App/Netdisco/Util/PortMAC.pm lib/App/Netdisco/Util/SanityCheck.pm @@ -144,7 +145,6 @@ MANIFEST This list of files META.yml share/config.yml share/environments/deployment.yml -share/environments/development.yml share/public/500.html share/public/css/bootstrap.min.css share/public/css/font-awesome.min.css diff --git a/Netdisco/META.yml b/Netdisco/META.yml index c75e0b37..da6c4e11 100644 --- a/Netdisco/META.yml +++ b/Netdisco/META.yml @@ -50,6 +50,7 @@ requires: Starman: 0.3008 Template: 2.24 YAML: 0.84 + YAML::XS: 0.41 namespace::clean: 0.24 perl: 5.10.0 version: 0.9902 @@ -59,4 +60,4 @@ resources: homepage: http://netdisco.org/ license: http://opensource.org/licenses/bsd-license.php repository: git://git.code.sf.net/p/netdisco/netdisco-ng -version: 2.007000_002 +version: 2.008000 diff --git a/Netdisco/Makefile.PL b/Netdisco/Makefile.PL index 8898d0ca..1a58cb1e 100644 --- a/Netdisco/Makefile.PL +++ b/Netdisco/Makefile.PL @@ -35,13 +35,16 @@ requires 'SNMP::Info' => 3.01; requires 'SQL::Translator' => 0.11016; requires 'Template' => 2.24; requires 'YAML' => 0.84; +requires 'YAML::XS' => 0.41; requires 'namespace::clean' => 0.24; requires 'version' => 0.9902; install_share 'share'; +install_script 'bin/nd-import-topology'; install_script 'bin/netdisco-db-deploy'; install_script 'bin/netdisco-deploy'; +install_script 'bin/netdisco-do'; install_script 'bin/netdisco-daemon-fg'; install_script 'bin/netdisco-daemon'; install_script 'bin/netdisco-web-fg'; diff --git a/Netdisco/bin/nd-dbic-versions b/Netdisco/bin/nd-dbic-versions index a41e4e15..92697423 100755 --- a/Netdisco/bin/nd-dbic-versions +++ b/Netdisco/bin/nd-dbic-versions @@ -22,7 +22,7 @@ use Getopt::Long; nd-dbic-versions - Create DB Schema Versions for Netdisco -=head2 USAGE +=head1 USAGE This script creates SQL DDL files of the Netdisco database schema. @@ -33,7 +33,7 @@ If called with the "-p " option, upgrade SQL DDL command files are created between the specified version and the current DBIx::Class specification. -=head2 New Version +=head1 NEW VERSION =over 4 diff --git a/Netdisco/bin/nd-import-topology b/Netdisco/bin/nd-import-topology index 35469c2a..8d6bd182 100755 --- a/Netdisco/bin/nd-import-topology +++ b/Netdisco/bin/nd-import-topology @@ -23,11 +23,11 @@ use Try::Tiny; nd-import-topology - Import a Nedisco 1.x Manual Topology File -=head2 USAGE +=head1 USAGE - ./nd-import-topology /path/to/netdisco-topology.txt + ~/bin/localenv nd-import-topology /path/to/netdisco-topology.txt -=head2 DESCRIPTION +=head1 DESCRIPTION This helper script will read and import the content of a Netdisco 1.x format Manual Topology file into the Netdisco 2.x database's C table. diff --git a/Netdisco/bin/netdisco-daemon b/Netdisco/bin/netdisco-daemon index ed4e1b2b..53b7c3e8 100755 --- a/Netdisco/bin/netdisco-daemon +++ b/Netdisco/bin/netdisco-daemon @@ -3,14 +3,12 @@ use strict; use warnings FATAL => 'all'; -use FindBin; -FindBin::again(); our $home; BEGIN { # try really hard to find a localenv if one isn't already in place. $home = ($ENV{NETDISCO_HOME} || $ENV{HOME}); - eval "use Daemon::Control"; + eval "require App::Netdisco::Util::Noop"; if ($@) { use File::Spec; @@ -22,7 +20,10 @@ BEGIN { } } +use FindBin; +FindBin::again(); use Path::Class; +use Daemon::Control; my $netdisco = file($FindBin::RealBin, 'netdisco-daemon-fg'); my @args = (scalar @ARGV > 1 ? @ARGV[1 .. $#ARGV] : ()); diff --git a/Netdisco/bin/netdisco-daemon-fg b/Netdisco/bin/netdisco-daemon-fg index 523c9f69..e8046468 100755 --- a/Netdisco/bin/netdisco-daemon-fg +++ b/Netdisco/bin/netdisco-daemon-fg @@ -44,15 +44,15 @@ sub build_tasks_list { # NB MCE does not like max_workers => 0 my $tasks = []; - set(daemon_pollers => 2) - if !defined setting('daemon_pollers'); - set(daemon_interactives => 2) - if !defined setting('daemon_interactives'); + setting('workers')->{pollers} = 2 + if !defined setting('workers')->{pollers}; + setting('workers')->{interactives} = 2 + if !defined setting('workers')->{interactives}; push @$tasks, { max_workers => 1, user_begin => worker_factory('Manager'), - } if setting('daemon_pollers') or setting('daemon_interactives'); + } if setting('workers')->{pollers} or setting('workers')->{interactives}; push @$tasks, { max_workers => 1, @@ -60,27 +60,27 @@ sub build_tasks_list { } if setting('housekeeping'); push @$tasks, { - max_workers => setting('daemon_pollers'), + max_workers => setting('workers')->{pollers}, user_begin => worker_factory('Poller'), - } if setting('daemon_pollers'); + } if setting('workers')->{pollers}; push @$tasks, { - max_workers => setting('daemon_interactives'), + max_workers => setting('workers')->{interactives}, user_begin => worker_factory('Interactive'), - } if setting('daemon_interactives'); + } if setting('workers')->{interactives}; info sprintf "MCE will load %s tasks: %s Manager, %s Scheduler, %s Poller, %s Interactive", (scalar @$tasks), - ((setting('daemon_pollers') or setting('daemon_interactives')) ? 1 : 0), + ((setting('workers')->{pollers} or setting('workers')->{interactives}) ? 1 : 0), (setting('housekeeping') ? 1 : 0), - (setting('daemon_pollers') || 0), - (setting('daemon_interactives') || 0); + (setting('workers')->{pollers} || 0), + (setting('workers')->{interactives} || 0); return $tasks; } sub num_workers { - return (setting('daemon_pollers') + setting('daemon_interactives')); + return (setting('workers')->{pollers} + setting('workers')->{interactives}); } sub worker_factory { diff --git a/Netdisco/bin/netdisco-db-deploy b/Netdisco/bin/netdisco-db-deploy index 3a41d017..cfeb3245 100755 --- a/Netdisco/bin/netdisco-db-deploy +++ b/Netdisco/bin/netdisco-db-deploy @@ -21,7 +21,7 @@ use Try::Tiny; netdisco-db-deploy - Database deployment for Netdisco -=head2 USAGE +=head1 USAGE This script upgrades or initialises a Netdisco database schema. @@ -35,7 +35,7 @@ interaction. If there's no Nedisco schema, it is deployed. If there's an unversioned schema then versioning is added, and updates applied. Otherwise only necessary updates are applied to an already versioned schema. -=head2 Versions +=head1 VERSIONS =over 4 diff --git a/Netdisco/bin/netdisco-deploy b/Netdisco/bin/netdisco-deploy index 017f439b..395d7cc2 100755 --- a/Netdisco/bin/netdisco-deploy +++ b/Netdisco/bin/netdisco-deploy @@ -1,13 +1,11 @@ #!/usr/bin/env perl -use FindBin; -FindBin::again(); our $home; BEGIN { # try really hard to find a localenv if one isn't already in place. $home = ($ENV{NETDISCO_HOME} || $ENV{HOME}); - eval "use Daemon::Control"; + eval "require App::Netdisco::Util::Noop"; if ($@) { use File::Spec; @@ -19,11 +17,14 @@ BEGIN { } } +use FindBin; +FindBin::again(); +use Path::Class; + BEGIN { # stuff useful locations into @INC and $PATH my $location = $FindBin::RealBin; - use Path::Class; unshift @INC, dir($location)->parent->subdir('lib')->stringify, dir($location, 'lib')->stringify; @@ -35,6 +36,7 @@ BEGIN { use App::Netdisco; use Dancer ':script'; use Dancer::Plugin::DBIC 'schema'; + info "App::Netdisco version $App::Netdisco::VERSION loaded."; use 5.010_000; @@ -50,7 +52,7 @@ use Try::Tiny; netdisco-deploy - Database, OUI and MIB deployment for Netdisco -=head2 USAGE +=head1 USAGE This script deploys the Netdisco database schema, OUI data, and MIBs. Each of these is an optional service which the user is asked to confirm. @@ -73,11 +75,11 @@ for its use. say 'This is the Netdisco II deployment script.'; say ''; say 'Before we continue, the following prerequisites must be in place:'; -say ' * Internet access'; say ' * Database added to PostgreSQL for Netdisco'; say ' * User added to PostgreSQL with rights to the Netdisco Database'; say ' * "~/environments/deployment.yml" file configured with Database dsn/user/pass'; say ' * A full backup of any existing Netdisco database data'; +say ' * Internet access (for OUIs and MIBs)'; say ''; say 'You will be asked to confirm all changes to your system.'; say ''; diff --git a/Netdisco/bin/netdisco-do b/Netdisco/bin/netdisco-do index 1eac0a46..d8b1019d 100755 --- a/Netdisco/bin/netdisco-do +++ b/Netdisco/bin/netdisco-do @@ -1,5 +1,22 @@ #!/usr/bin/env perl +our $home; + +BEGIN { + # try really hard to find a localenv if one isn't already in place. + $home = ($ENV{NETDISCO_HOME} || $ENV{HOME}); + eval "require App::Netdisco::Util::Noop"; + + if ($@) { + use File::Spec; + my $localenv = File::Spec->catfile($FindBin::RealBin, 'localenv'); + exec($localenv, $0, @ARGV) if -f $localenv; + $localenv = File::Spec->catfile($home, 'perl5', 'bin', 'localenv'); + exec($localenv, $0, @ARGV) if -f $localenv; + die "Sorry, can't find libs required for App::Netdisco.\n"; + } +} + use FindBin; FindBin::again(); use Path::Class 'dir'; @@ -52,6 +69,8 @@ if (!length $action) { with 'App::Netdisco::Daemon::Worker::Poller::Device'; with 'App::Netdisco::Daemon::Worker::Poller::Arpnip'; with 'App::Netdisco::Daemon::Worker::Poller::Macsuck'; + with 'App::Netdisco::Daemon::Worker::Interactive::DeviceActions'; + with 'App::Netdisco::Daemon::Worker::Interactive::PortActions'; } my $worker = MyWorker->new(); @@ -97,3 +116,68 @@ info sprintf '%s: finished at %s', $action, scalar localtime; info sprintf '%s: status %s: %s', $action, $status, $log; exit ($status eq 'done' ? 0 : 1); + +=head1 NAME + +netdisco-do - Run any Netdisco poller job from the command-line. + +=head1 USAGE + + ~/bin/netdisco-do [-D] [-d [-p ] [-e ]] + +Regardless of Netdisco configuration, debug level logging is enabled if the +C<-D> flag is given. + +=head1 DESCRIPTION + +This program allows you to run any Netdisco poller job from the command-line. + +Note that some jobs (C, C, C) simply add +entries to the Netdisco job queue for other jobs, so won't seem to do much +when you trigger them. + +=head1 ACTIONS + +=head2 discover + +Run a discover on the device (specified with C<-d>). + +=head2 macsuck + +Run a macsuck on the device (specified with C<-d>). + +=head2 arpnip + +Run an arpnip on the device (specified with C<-d>). + +=head2 set_location + +Set the SNMP location field on the device (specified with C<-d>). Pass the +location string in the C<-e> extra parameter. + +=head2 set_contact + +Set the SNMP contact field on the device (specified with C<-d>). Pass the +contact name in the C<-e> extra parameter. + +=head2 set_portname + +Set the description on a device port. Requires the C<-d> parameter (device), +C<-p> parameter (port), and C<-e> parameter (description). + +=head2 set_portcontrol + +Set the up/down status on a device port. Requires the C<-d> parameter +(device), C<-p> parameter (port), and C<-e> parameter ("up" or "down"). + +=head2 set_vlan + +Set the native VLAN on a device port. Requires the C<-d> parameter (device), +C<-p> parameter (port), and C<-e> parameter (VLAN number). + +=head2 set_power + +Set the PoE on/off status on a device port. Requires the C<-d> parameter +(device), C<-p> parameter (port), and C<-e> parameter ("true" or "false"). + +=cut diff --git a/Netdisco/bin/netdisco-web b/Netdisco/bin/netdisco-web index ef1b9107..9c86eb78 100755 --- a/Netdisco/bin/netdisco-web +++ b/Netdisco/bin/netdisco-web @@ -3,14 +3,12 @@ use strict; use warnings FATAL => 'all'; -use FindBin; -FindBin::again(); our $home; BEGIN { # try really hard to find a localenv if one isn't already in place. $home = ($ENV{NETDISCO_HOME} || $ENV{HOME}); - eval "use Daemon::Control"; + eval "require App::Netdisco::Util::Noop"; if ($@) { use File::Spec; @@ -22,7 +20,10 @@ BEGIN { } } +use FindBin; +FindBin::again(); use Path::Class; +use Daemon::Control; my $netdisco = file($FindBin::RealBin, 'netdisco-web-fg'); my @args = (scalar @ARGV > 1 ? @ARGV[1 .. $#ARGV] : ()); diff --git a/Netdisco/lib/App/Netdisco.pm b/Netdisco/lib/App/Netdisco.pm index ac497afe..48a69061 100644 --- a/Netdisco/lib/App/Netdisco.pm +++ b/Netdisco/lib/App/Netdisco.pm @@ -7,7 +7,7 @@ use 5.010_000; use File::ShareDir 'dist_dir'; use Path::Class; -our $VERSION = '2.007000_002'; +our $VERSION = '2.008000'; BEGIN { if (not length ($ENV{DANCER_APPDIR} || '') @@ -28,6 +28,15 @@ BEGIN { $ENV{DANCER_PUBLIC} ||= $auto->subdir('public')->stringify; $ENV{DANCER_VIEWS} ||= $auto->subdir('views')->stringify; } + + { + # Dancer 1 uses the broken YAML.pm module + # This is a global sledgehammer - could just apply to Dancer::Config + use YAML; + use YAML::XS; + no warnings 'redefine'; + *YAML::LoadFile = sub { goto \&YAML::XS::LoadFile }; + } } =head1 NAME @@ -41,18 +50,9 @@ network management tool. Pieces are still missing however, so if you're a new user please see L for further information on the project and how to download the current official release. -=over 4 - -=item * - -See the demo at: L - -=back - -L provides a web frontend and a backend daemon to handle -interactive requests such as changing port or device properties. There is not -yet a device poller, so please still use the old Netdisco's discovery, arpnip, -and macsuck. +L provides a web frontend with built-in web server, and a +backend daemon to handle interactive requests such as changing port or device +properties. If you have any trouble getting the frontend running, speak to someone in the C<#netdisco> IRC channel (on freenode). Before installing or upgrading please @@ -139,6 +139,8 @@ take care of all this for you: ~/bin/netdisco-deploy +Answer yes to all questions, if this is a new installation of Netdisco 2. + =head1 Startup Run the following command to start the web-app server as a backgrounded daemon @@ -146,12 +148,17 @@ Run the following command to start the web-app server as a backgrounded daemon ~/bin/netdisco-web start +If the Inventory is empty because this is a new installation, you probably +want to either run some polling jobs from the command-line, or give a web user +some admin rights (see L, below). + Run the following command to start the job control daemon (port control, etc): ~/bin/netdisco-daemon start You should take care not to run this Netdisco daemon and the legacy daemon at -the same time. +the same time. Similarly, if you use the device discovery with Netdisco 2, +disable your system's cron jobs for the Netdisco 1 poller. =head1 Upgrading @@ -161,13 +168,13 @@ Notes|App::Netdisco::Manual::ReleaseNotes>. Then, the process is as follows: # upgrade Netdisco ~/bin/localenv cpanm --notest App::Netdisco - # apply database schema updates (optionally, get latest OIDs/MIBs) + # apply database schema updates ~/bin/netdisco-deploy # restart web service ~/bin/netdisco-web restart - # optionally, restart job daemon if you use it + # restart job daemon (if you use it) ~/bin/netdisco-daemon restart =head1 Tips and Tricks @@ -180,12 +187,30 @@ or MAC addreses, VLAN numbers, and so on. =head2 User Rights -When user authentication is disabled (C) the default username is -"guest", which has no special privilege. To grant port and device control +When user authentication is disabled (C) the default username +is "guest", which has no special privilege. To grant port and device control rights to this user, create a row in the C table of the Netdisco -database with a username of C and the C flag set to true: +database with a username of C and appropriate flags set to true: - netdisco=> insert into users (username, port_control) values ('guest', true); + netdisco=> insert into users (username) values ('guest'); + netdisco=> update users set port_control = true where username = 'guest'; + netdisco=> update users set admin = true where username = 'guest'; + +=head2 Command-Line Device and Port Actions + +To run a device (discover, etc) or port control job from the command-line, use +the bundled L program. For example: + + ~/bin/netdisco-do -D discover -d 192.0.2.1 + +=head2 Import Topology + +Netdisco 1.x had support for a topology information file to fill in device +port relations which could not be discovered. This is now stored in the +database (and edited in the web interface). To import a legacy topology file, +run: + + ~/bin/localenv nd-import-topology /path/to/netdisco-topology.txt =head2 Deployment Scenarios @@ -202,10 +227,8 @@ documentation for further information. =head2 Plugins -App::Netdisco includes a Plugin subsystem for building the web user interface. -Items in the navigation bar and the tabs on pages are loaded as Plugins, and -you have control over their appearance and ordering. See -L for further information. +Netdisco includes a Plugin subsystem for customizing the web user interface. +See L for further information. =head2 Developing @@ -229,7 +252,7 @@ Oliver Gorwits =head1 COPYRIGHT AND LICENSE -This software is copyright (c) 2012 by The Netdisco Developer Team. +This software is copyright (c) 2012, 2013 by The Netdisco Developer Team. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/Netdisco/lib/App/Netdisco/Core/Discover.pm b/Netdisco/lib/App/Netdisco/Core/Discover.pm index 590fd8ad..b3448a97 100644 --- a/Netdisco/lib/App/Netdisco/Core/Discover.pm +++ b/Netdisco/lib/App/Netdisco/Core/Discover.pm @@ -198,7 +198,7 @@ sub store_interfaces { next; } - if (scalar grep {$port =~ m/$_/} @{setting('ignore_interfaces') || []}) { + if (scalar grep {$port =~ m/^$_$/} @{setting('ignore_interfaces') || []}) { debug sprintf ' [%s] interfaces - ignoring %s (%s) (config:ignore_interfaces)', $device->ip, $entry, $port; @@ -807,12 +807,14 @@ sub discover_new_neighbors { my $device = get_device($ip); next if $device->in_storage; - my $remote_type_match = setting('discover_no_type'); - if ($remote_type and $remote_type_match - and $remote_type =~ m/$remote_type_match/) { - debug sprintf ' queue - %s, type [%s] excluded by discover_no_type', - $ip, $remote_type; - next; + if ($remote_type) { + if (scalar grep {$remote_type =~ m/$_/} + @{setting('discover_no_type') || []}) { + debug sprintf + ' queue - %s, type [%s] excluded by discover_no_type', + $ip, $remote_type; + next; + } } # could fail if queued job already exists diff --git a/Netdisco/lib/App/Netdisco/Daemon/Queue.pm b/Netdisco/lib/App/Netdisco/Daemon/Queue.pm index bbec8db0..803d7086 100644 --- a/Netdisco/lib/App/Netdisco/Daemon/Queue.pm +++ b/Netdisco/lib/App/Netdisco/Daemon/Queue.pm @@ -43,8 +43,8 @@ sub capacity_for { }; my $setting_map = { - Poller => 'daemon_pollers', - Interactive => 'daemon_interactives', + Poller => 'pollers', + Interactive => 'interactives', }; my $role = $role_map->{$action}; @@ -52,7 +52,7 @@ sub capacity_for { my $current = $queue->search({role => $role})->count; - return ($current < setting($setting)); + return ($current < setting('workers')->{$setting}); } sub take_jobs { diff --git a/Netdisco/lib/App/Netdisco/Daemon/Worker/Interactive.pm b/Netdisco/lib/App/Netdisco/Daemon/Worker/Interactive.pm index a575e83c..9ee8c485 100644 --- a/Netdisco/lib/App/Netdisco/Daemon/Worker/Interactive.pm +++ b/Netdisco/lib/App/Netdisco/Daemon/Worker/Interactive.pm @@ -49,7 +49,7 @@ sub worker_body { } debug "int ($wid): sleeping now..."; - sleep( setting('daemon_sleep_time') || 5 ); + sleep( setting('workers')->{sleep_time} || 5 ); } } diff --git a/Netdisco/lib/App/Netdisco/Daemon/Worker/Interactive/PortActions.pm b/Netdisco/lib/App/Netdisco/Daemon/Worker/Interactive/PortActions.pm index 5d868c22..227cb722 100644 --- a/Netdisco/lib/App/Netdisco/Daemon/Worker/Interactive/PortActions.pm +++ b/Netdisco/lib/App/Netdisco/Daemon/Worker/Interactive/PortActions.pm @@ -101,7 +101,7 @@ sub set_power { my $ip = $job->device; my $pn = $job->port; - (my $data = $job->subaction) =~ s/-\w+//; + (my $data = $job->subaction) =~ s/-\w+//; # remove -other # snmp connect using rw community my $info = snmp_connect_rw($ip) diff --git a/Netdisco/lib/App/Netdisco/Daemon/Worker/Manager.pm b/Netdisco/lib/App/Netdisco/Daemon/Worker/Manager.pm index 075d09c3..b87a2629 100644 --- a/Netdisco/lib/App/Netdisco/Daemon/Worker/Manager.pm +++ b/Netdisco/lib/App/Netdisco/Daemon/Worker/Manager.pm @@ -84,7 +84,7 @@ sub worker_body { # TODO also check for stale jobs in Netdisco DB debug "mgr ($wid): sleeping now..."; - sleep( setting('daemon_sleep_time') || 5 ); + sleep( setting('workers')->{sleep_time} || 5 ); } } diff --git a/Netdisco/lib/App/Netdisco/Daemon/Worker/Poller.pm b/Netdisco/lib/App/Netdisco/Daemon/Worker/Poller.pm index 3eb00346..22f9d71b 100644 --- a/Netdisco/lib/App/Netdisco/Daemon/Worker/Poller.pm +++ b/Netdisco/lib/App/Netdisco/Daemon/Worker/Poller.pm @@ -51,7 +51,7 @@ sub worker_body { } debug "poll ($wid): sleeping now..."; - sleep( setting('daemon_sleep_time') || 5 ); + sleep( setting('workers')->{sleep_time} || 5 ); } } diff --git a/Netdisco/lib/App/Netdisco/Manual/Configuration.pod b/Netdisco/lib/App/Netdisco/Manual/Configuration.pod index 76f13309..2dde3667 100644 --- a/Netdisco/lib/App/Netdisco/Manual/Configuration.pod +++ b/Netdisco/lib/App/Netdisco/Manual/Configuration.pod @@ -58,59 +58,78 @@ the C (DB name, host, port), C and C. =head2 General Settings -=head3 C +=head3 C -Default: C +Value: C. Default: C. The log level used by Netdisco. It's useful to see warning messages from the backend poller, as this can highlight broken topology. -=head3 C +=head3 C -Default: C +Value: C. Default: C. Destination for log messages. Console means standard ouput. When set to C, the default destination is the C<${HOME}/logs> directory. -=head3 C +=head3 C -Default: C<< '[%P] %L @%D> %m' >> +Value: Format String. Default: C<< '[%P] %L @%D> %m' >>. Structure of the log messages. See L for details. =head2 Web Frontend -=head3 C +=head3 C -Default: None +Value: String. Default: None. Set this to your local site's domain name. This is usually removed from node -names in the web interface to make things more readable. +names in the web interface to make things more readable. Make sure to include +the leading dot character. -=head3 C +=head3 C -Default: C +Value: Boolean. Default: C. Enable this to disable login authentication in the web frontend. The username will be set to C so if you want to allow extended permissions (C -or C, create a dummy user with the appropriate flag, in the +or C, create a dummy user with the appropriate flag in the database: - netdisco=> insert into users (username, port_control) values ('guest', true); + netdisco=> insert into users (username) values ('guest'); + netdisco=> update users set port_control = true where username = 'guest'; + netdisco=> update users set admin = true where username = 'guest'; -=head3 C +=head3 C -Default: C<5000> +Value: Number. Default: C<5000>. Port which the web server listens on. Netdisco comes with a good pre-forking web server, so you can change this to C<80> if you want to use it directly. However the default is designed to work well with servers such as Apache in reverse-proxy mode. -=head3 C +=head3 C -Default: List of L names +Value: String. Default: None. + +Mount point for the Netdisco web frontend. This is usually the root of the web +server. Set this to the path under which all pages live, e.g. C. +As an alternative you can use the C<--path> option to C. + +=head3 C + +Value: Boolean. Default: C. + +A hint to the Netdisco web frontend that it's running behind a reverse proxy. +In that case, Netdisco will pay attention to the C, +C, etc settings in HTML headers. + +=head3 C + +Value: List of Modules. Default: List of bundled L names. Netdisco's plugin system allows the user more control over the user interface. Plugins can be distributed independently from Netdisco and are a better @@ -119,24 +138,462 @@ are used in the default Netdisco distribution. You can override this to set your own list. If you only want to add to the default list then use C, which allows the Netdisco -developers to update C in a future release. +developers to update default C in a future release. -=head3 C +Entries in the list will by default omit the leading +C from the name. To override this for one entry, +prefix it with a C<+> sign. You can also prefix with C to signify the +alternate C namepsace. -Default: None +=head3 C + +Value: List of Modules. Default: Empty List. List of additional L names to load. See also the C setting. =head2 Netdisco Core +=head3 C + +Value: Directory. Default: C<${HOME}/netdisco-mibs>. + +Base directory in which to find C. This is where C +will drop MIB files. + +=head3 C + +Value: List of Directories. Default: All subdirectories of C. + +A list of subdirectories of C from which to load MIB files. You +should always include C. For example: + + mibdirs: + - rfc + - cisco + - foundry + +=head3 C + +Value: List of Strings. Default: C. + +A list of read-only SNMP community strings to try on each device. The working +community will be cached in the database. + +=head3 C + +Value: List of Strings. Default: C. + +A list of read-write SNMP community strings to try on each device. The working +community will be cached in the database. + +=head3 C + +Value: C<1|2|3>. Default: 2. + +Version of the SNMP protocol used when connecting to devices. + +=head3 C + +Value: Number. Default: 1000000. + +Micro-seconds before connection retry in L. 1000000 +micro-seconds = 1 second. + +=head3 C + +Value: Number. Default: 2. + +Number of times to retry connecting to a device before giving up. + +=head3 C + +Value: List of Network Identifiers. Default: Empty List. + +IP addresses in the list will not be visited during device discovery. You can +include hostnames, IP addresses and subnets (IPv4 or IPv6) in the list. + +=head3 C + +Value: List of Network Identifiers. Default: Empty List. + +If present, device discovery will be limited to IP addresses matching entries +in this list. You can include hostnames, IP addresses and subnets (IPv4 and +IPv6). + +=head3 C + +Value: List of Strings. Default: None. + +Place regular expression patterns here to exclude the discovery of certain +devices based on the CDP/LLDP device type information. Good for excluding a +whole device class like lightweight access points or IP phones that have CDP +but don't talk SNMP. For example: + + discover_no_type: + - 'cisco\s+AIR-LAP' + - '(?i)Cisco\s+IP\s+Phone' + +=head3 C + +Value: Boolean. Default: C. + +Set to macsuck all VLANs, not just the ones that are being used on ports. +This is a debug option. Set this if you think that the option of not +macsucking VLANs that aren't in use on device ports is some how interfering. + +=head3 C + +Value: Boolean. Default: C. + +Set to true to skip macsuck-ing on VLANs which have no name set. This option +may be useful on Cisco Catalyst family devices where ports are a member of a +VLAN which is not defined in the VLAN database. + +=head3 C + +Value: Boolean. Default: C. + +Set to true will let nodes accumulate on uplink ports without topology +information. This is a debug option to help you figure out your topology and +generally should not be set. + +=head3 C + +Value: Boolean. Default: C. + +Set to false to skip the wireless client information gathering. This is +captured at macsuck time, so if you aren't using the information you can skip +it. + +=head3 C + +Value: List of Strings. Default: + + ignore_interfaces: + - 'EOBC' + - 'unrouted VLAN' + - 'StackPort' + - 'Control Plane Interface' + - 'SPAN (S|R)P Interface' + - 'StackSub' + - 'netflow' + - 'Vlan\d+-mpls layer' + - 'BRI\S+-Bearer Channel' + - 'BRI\S+-Physical' + - 'BRI\S+-Signalling' + - 'Embedded-Service-Engine\d+\/\d+' + - 'Virtual-Template\d+' + - 'Virtual-Access\d+' + - '(E|T)\d \d\/\d\/\d' + +If present, device ports whose names match fully any of the items in this list +will be ignored by the discovery process. + +Note this may have side effects - connected devices and nodes on those ports +will in turn also not be discovered. + +=head3 C + +Value: Boolean. Default: C. + +Set to true to ignore device interfaces that are part of private nets (RFC +1918). + +=head3 C + +Value: Boolean. Default: C. + +Turn this on to have Netdisco do a reverse lookup of the device C +field to use as the management IP address for a device. + +=head3 C + +Value: Boolean. Default: C. + +Set to false to prevent Netdisco from changing the default VLAN on an +interface. + +=head3 C + +Value: Boolean. Default: C. + +Set to true to make sure an IP Phone port never can be turned off/on. + +=head3 C + +Value: Boolean. Default: C. + +Set to true to allow Netdisco to be able to disable VLAN trunk interfaces. + +B: Turning off a VLAN trunk link could take out most +of your network. + +=head3 C + +Value: Boolean. Default: C. + +Set to true to allow Netdisco to be able to disable Uplinks. (Router +Interfaces too) + +B: Turning off uplinks will take out chunks of your +network. + +=head3 C + +Value: Boolean. Default: C. + +Set to true to disable globally support for Port Control. Mainly useful for +development to suppress web frontend job queue callbacks. + =head2 Backend Daemon +=head3 C + +Value: Settings Tree. Default: + + workers: + interactives: 2 + pollers: 2 + sleep_time: 5 + +Control the activity of the backend daemon with this configuration setting. + +C and C sets how many workers are started for +interactive jobs (port control) and polling jobs (discover, macsuck, arpnip) +on this node, respectively. Other nodes can have different settings. + +C is the number of seconds between polling the database to find +new jobs. This is a balance between responsiveness and database load. + +=head3 C + +Value: Settings Tree. Default: None. + +If set, then this node's backend daemon will schedule polling jobs (discover, +macsuck, arpnip, etc) in the central database. It's fine to have multiple +nodes scheduling work for redundancy (but make sure they all have good NTP). + +Note that this is independent of the Pollers configured in C. It's +okay to have this node schedule housekeeping but not do any of the polling +itself (C). + +Work can be scheduled using C style notation, or a simple weekday and +hour fields (which accept same types as C notation). For example: + + housekeeping: + discoverall: + when: '0 9 * * *' + arpwalk: + when: + min: 30 + macwalk: + when: + hour: '*/2' + =head2 Dancer Internal -=head1 UNSUPPORTED SETTINGS +=head3 C + +Value: String. Default: C. + +See L. + +=head3 C + +Value: Boolean. Default: C. + +Should warnings be considered as critical errors? + +=head3 C + +Value: Boolean. Default: C. + +Whether to show a stack trace when an error is caught in the web frontend. + +=head3 C + +Value: Settings Tree. + +Useful for overriding the Template Toolkit settings, if you want. + +=head3 C + +Value: String. Default: C
. + +Don't touch this. + +=head3 C + +Value: Settings Tree. + +Useful for overriding the Database configuration, but only if you know what +you're doing. + +=head3 C + +Value: String. Default: C. + +How to handle web sessions. Default is to store on disk so they can be shared +between multiple web server processes (although it's slower). + +=head3 C