Files
netdisco/Netdisco/lib/App/Netdisco.pm
Oliver Gorwits 04d89320a8 Squashed commit of the following:
* Support for stuffing other locations into @INC at runtime
* Reports config is now a list (see ReleaseNotes)

commit 19756faf57
Merge: 2e8afbe 29d3ac7
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Thu Jul 31 21:32:30 2014 +0100

    Merge branch 'master' into og-autoload

    Conflicts:
    	Netdisco/share/public/javascripts/netdisco_portcontrol.js

commit 2e8afbeea6
Merge: d340c3b 18f507e
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Wed Jul 23 20:09:18 2014 +0100

    Merge branch 'master' into og-autoload

commit d340c3b135
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Mon Jul 7 22:25:38 2014 +0100

    tweak dirty css

commit 032cd82c46
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Sun Jul 6 23:05:17 2014 +0100

    add dirty classes

commit 2b72c989fa
Merge: 1b8ac7c b77025f
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Fri Jul 4 11:28:01 2014 +0100

    Merge branch 'og-autoload' of ssh://git.code.sf.net/p/netdisco/netdisco-ng into og-autoload

commit b77025f34c
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Thu Jul 3 23:35:35 2014 +0100

    hide save icon

commit 5df5a73aed
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Wed Jul 2 22:31:18 2014 +0100

    blue color

commit a3bf20f074
Merge: 1839f26 db53c00
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Wed Jul 2 15:17:25 2014 +0100

    Merge branch 'master' into og-autoload

commit 1b8ac7ca1f
Merge: 1839f26 db53c00
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Wed Jul 2 09:23:31 2014 +0100

    Merge branch 'master' into og-autoload

commit 1839f2634b
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Wed Jul 2 03:43:53 2014 +0100

    add jquery.fix.clone.js

commit 3eee9f1997
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Wed Jul 2 00:08:27 2014 +0100

    save button css

commit 95b6cb61b3
Merge: 13957e8 58e5d05
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Tue Jul 1 21:50:01 2014 +0100

    Merge branch 'master' into og-autoload

    Conflicts:
    	Netdisco/share/config.yml

commit 13957e82dc
Merge: bedbec6 6abceba
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Mon Jun 30 22:50:40 2014 +0100

    Merge branch 'og-autoload' of ssh://git.code.sf.net/p/netdisco/netdisco-ng into og-autoload

commit bedbec6b4b
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Mon Jun 30 22:49:49 2014 +0100

    css fixes

commit 6e2d5a4b48
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Mon Jun 30 21:30:26 2014 +0100

    css fixes

commit 755fc92c59
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Mon Jun 30 13:05:43 2014 +0100

    reports now a list not a hash

commit 6abcebafbe
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Sun Jun 29 12:41:47 2014 +0100

    start as non-root if port switch not required

commit e5e0c0c8d1
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Sat Jun 28 13:10:51 2014 +0100

    fix err in docs

commit 6d680aabed
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Sat Jun 28 11:10:23 2014 +0100

    move content

commit d2668d6db7
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Fri Jun 27 00:30:54 2014 +0100

    minor styling

commit e46cbd252d
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Thu Jun 26 23:19:19 2014 +0100

    add bootstrap-switch checkbox styling

commit 5b0a723c9f
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Wed Jun 25 22:20:57 2014 +0100

    typo in defaults

commit e45fa89c44
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Tue Jun 24 22:42:45 2014 +0100

    css for configuration pane

commit 62c53a5e49
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Mon Jun 23 23:33:26 2014 +0100

    minor typo

commit caedbdadc6
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Mon Jun 23 20:35:30 2014 +0100

    properly search the template path!! [#103]

commit 5742bc7856
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Sun Jun 22 23:13:53 2014 +0100

    fix registering template paths

commit 2b09476f29
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Sun Jun 22 22:19:35 2014 +0100

    allow INC stuffing via NETDISCO_INC env var

commit 7c47a277be
Merge: 128e96f 3a1cd19
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Sun Jun 22 22:17:11 2014 +0100

    Merge branch 'master' into og-autoload

commit 128e96f9a3
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Sun Jun 22 20:48:01 2014 +0100

    use Module::Find to load Auto things and Web
2014-07-31 22:54:28 +01:00

284 lines
8.9 KiB
Perl

package App::Netdisco;
use strict;
use warnings;
use 5.010_000;
our $VERSION = '2.028013';
use App::Netdisco::Configuration;
use Module::Find ();
Module::Find::usesub 'App::NetdiscoE::Init';
=head1 NAME
App::Netdisco - An open source web-based network management tool.
=head1 Introduction
Netdisco is a web-based network management tool designed for network
administrators. Data is collected into a PostgreSQL database using SNMP.
Some of the things you can do with Netdisco:
=over 4
=item *
B<Locate> a machine on the network by MAC or IP and show the switch port it
lives at
=item *
B<Turn off> a switch port, or change the VLAN or PoE status of a port
=item *
B<Inventory> your network hardware by model, vendor, software and operating
system
=item *
B<Pretty pictures> of your network
=back
L<App::Netdisco> provides a web frontend with built-in web server, and a
backend daemon to handle interactive requests such as changing port or device
properties.
=over 4
=item *
See the demo at: L<http://netdisco2-demo.herokuapp.com/>
=back
If you have any trouble getting installed or running, check out the
L<Deployment|App::Netdisco::Manual::Deployment> notes, or speak to someone in
the C<#netdisco> IRC channel (on freenode). Before installing or upgrading
please always review the latest L<Release
Notes|App::Netdisco::Manual::ReleaseNotes>.
=head1 Dependencies
Netdisco has several Perl library dependencies which will be automatically
installed. However it's I<strongly> recommended that you first install
L<DBD::Pg>, L<SNMP>, and a compiler using your operating system packages.
On Ubuntu/Debian:
root:~# apt-get install libdbd-pg-perl libsnmp-perl build-essential
On Fedora/Red-Hat:
root:~# yum install perl-core perl-DBD-Pg net-snmp-perl make automake gcc
With those installed, we can proceed...
Create a user on your system called C<netdisco> if one does not already exist.
We'll install Netdisco and its dependencies into this user's home area, which
will take about 250MB including MIB files.
root:~# useradd -m -p x -s /bin/bash netdisco
Netdisco uses the PostgreSQL database server. Install PostgreSQL (at least
version 8.4) and then change to the PostgreSQL superuser (usually
C<postgres>). Create a new database and PostgreSQL user for the Netdisco
application:
root:~# su - postgres
postgres:~$ createuser -DRSP netdisco
Enter password for new role:
Enter it again:
postgres:~$ createdb -O netdisco netdisco
The default PostgreSQL configuration isn't well tuned for modern server
hardware. We strongly recommend that you use the C<pgtune> Python program to
auto-tune your C<postgresql.conf> file:
=over 4
=item *
L<https://github.com/elitwin/pgtune>
=back
=head1 Installation
The following is a general guide which works well in most circumstances. It
assumes you have a user C<netdisco> on your system, that you want to perform
an on-line installation, and have the application run self-contained from
within that user's home. There are alternatives: see the
L<Deployment|App::Netdisco::Manual::Deployment> documentation for further
details.
To avoid muddying your system, use the following script to download and
install Netdisco and its dependencies into the C<netdisco> user's home area
(C<~netdisco/perl5>):
su - netdisco
curl -L http://cpanmin.us/ | perl - --notest --local-lib ~/perl5 App::Netdisco
Link some of the newly installed apps into a handy location:
mkdir ~/bin
ln -s ~/perl5/bin/{localenv,netdisco-*} ~/bin/
Test the installation by running the following command, which should only
produce a status message (it's just a test - you'll start the daemon properly,
later on):
~/bin/netdisco-daemon status
=head1 Configuration
Make a directory for your local configuration and copy the configuration
template from this distribution:
mkdir ~/environments
cp ~/perl5/lib/perl5/auto/share/dist/App-Netdisco/environments/deployment.yml ~/environments
chmod 600 ~/environments/deployment.yml
Edit the file ("C<~/environments/deployment.yml>") and change the database
connection parameters to match those for your local system (that is, the
C<name>, C<user> and C<pass>).
In the same file uncomment and edit the C<domain_suffix> setting to be
appropriate for your local site.
Change the C<community> string setting if your site has different values, and
uncomment the C<schedule> setting to enable SNMP data gathering from
devices (this replaces cron jobs in Netdisco 1).
Have a quick read of the other settings to make sure you're happy, then move
on. See L<Configuration|App::Netdisco::Manual::Configuration> for further
details.
=head1 Bootstrap
The database either needs configuring if new, or updating from the current
release of Netdisco (1.x). You also need vendor MAC address prefixes (OUI
data) and some MIBs if you want to run the daemon. The following script will
take care of all this for you:
~/bin/netdisco-deploy
If this is a new installation of Netdisco 2, answer yes to all questions. If
you wish to deploy without Internet access, see the
L<Deployment|App::Netdisco::Manual::Deployment> documentation.
=head1 Startup
Run the following command to start the web-app server as a backgrounded daemon
(listening on port 5000):
~/bin/netdisco-web start
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 Netdisco 1.x
daemon at the same time. Similarly, if you use the device discovery with
Netdisco 2, disable your system's cron jobs for the Netdisco 1.x poller.
For further documentation on deployment, see
L<Deployment|App::Netdisco::Manual::Deployment>.
=head1 Upgrading
Before upgrading please review the latest L<Release
Notes|App::Netdisco::Manual::ReleaseNotes>. Then, the process is as follows:
# upgrade Netdisco
~/bin/localenv cpanm --notest App::Netdisco
# apply database schema updates
~/bin/netdisco-deploy
# restart web service
~/bin/netdisco-web restart
# restart job daemon (if you use it)
~/bin/netdisco-daemon restart
=head1 Tips and Tricks
=head2 Searching
The main black navigation bar has a search box which is smart enough to work
out what you're looking for in most cases. For example device names, node IP
or MAC addreses, VLAN numbers, and so on.
=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<netdisco-do> 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 Database API
Bundled with this distribution is a L<DBIx::Class> layer for the Netdisco
database. This abstracts away all the SQL into an elegant, re-usable OO
interface. See the L<Developer|App::Netdisco::Manual::Developing>
documentation for further information.
=head2 Plugins
Netdisco includes a Plugin subsystem for customizing the web user interface.
See L<App::Netdisco::Web::Plugin> for further information.
=head2 Developing
Lots of information about the architecture of this application is contained
within the L<Developer|App::Netdisco::Manual::Developing> documentation.
=head1 AUTHOR
Oliver Gorwits <oliver@cpan.org>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2012, 2013, 2014 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:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the Netdisco Project nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE NETDISCO DEVELOPER TEAM BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=cut
1;