Back to the main page

Netdisco (version 2) installation on Oracle Linux 6.6

 Netdisco is a web based ethernet network management tool, it uses SNMP to callect data about a network and place data in PostgreSQL. It's useful for locating server on the network, for example just type a MAC and see switch port where system is pluged in.

Install Netdisco dependencies

[root@myhost ~]# yum install perl-core perl-DBD-Pg net-snmp-perl net-snmp-devel make automake gcc postgresql postgresql-server

Installed:
  automake.noarch 0:1.11.1-4.el6          net-snmp-devel.x86_64 1:5.5-50.0.1.el6_6.1     net-snmp-perl.x86_64 1:5.5-50.0.1.el6_6.1
  perl-DBD-Pg.x86_64 0:2.15.1-4.el6_3     perl-core.x86_64 0:5.10.1-136.el6_6.1   postgresql.x86_64 0:8.4.20-3.el6_6  postgresql-server.x86_64
Then create a netdisco user and a postgres user ( superuser for Postgres)
[root@myhost ~]# useradd -m -s /bin/bash netdisco
[root@myhost ~]# id netdisco
uid=1782(netdisco) gid=1782(netdisco) groups=1782(netdisco)
[root@myhost ~]# useradd -m -s /bin/bash postgres
The Postgresql database has to be initialized first before starting postgresql service
[root@myhost ~]# service postgresql initdb
Initializing database: mkdir: cannot create directory `/var/lib/pgsql/data/pg_log': File exists
                                                           [FAILED]
Fix here is to remove this directory
[root@myhost ~]# cd /var/lib/pgsql/data/
[root@myhost ~]# rmdir pg_log/

[root@myhost ~]# service postgresql initdb
Initializing database:          [  OK  ]

[root@myhost ~]# service postgresql start
Starting postgresql service:    [  OK  ]

[root@myhost ~]# chkconfig --level 235 postgresql on
[root@myhost ~]# chkconfig --list postgresql
postgresql      0:off   1:off   2:on    3:on    4:off   5:on    6:off
Change to Postgresql superuser, which is postgres. And create new PostgreSQL user for Netdisco application.
[root@myhost ~]# su - postgres

[postgres@myhost ~]$ createuser -DRSP netdisco
Enter password for new role: zzzzz
Enter it again: zzzzz
note:
-D = new user cannot create databases
-R = new user cannot create new roles
-S = new user is not superuser
-P = ask for password of the new user
Create database netdisco that's owned by user netdisco.
[postgres@myhost ~]$ createdb -O netdisco netdisco
Take a look files with user and database.
# cat /var/lib/pgsql/data/global/pg_auth
"netdisco" "md5e601b5922478d0b577df8bf97ad3431e" ""
"postgres" "" ""

# cat /var/lib/pgsql/data/global/pg_database
"template1" 1 1663 648
"template0" 11563 1663 648
"postgres" 11564 1663 648
"netdisco" 16385 1663 648

Start the installation

If needed, have environment variable for proxy so you can get to the Internet, like:
[root@myhost ~]# export http_proxy=http://wwwproxy.domain.com:80
[root@myhost ~]# export https_proxy=http://wwwproxy.domain.com:80
Switch to user netdisco and get the offered script to download/install Netdisco/dependencies in /home/netdisco/perl5/
[root@myhost ~]# su - netdisco
[netdisco@myhost ~]$ curl -L http://cpanmin.us/ | perl - --notest --local-lib ~/perl5 App::Netdisco
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  296k  100  296k    0     0   428k      0 --:--:-- --:--:-- --:--:--  428k
--> Working on App::Netdisco
Fetching http://www.cpan.org/authors/id/O/OL/OLIVER/App-Netdisco-2.032006.tar.gz ... OK
==> Found dependencies: ExtUtils::MakeMaker, DBIx::Class
--> Working on ExtUtils::MakeMaker
Fetching http://www.cpan.org/authors/id/B/BI/BINGOS/ExtUtils-MakeMaker-7.04.tar.gz ... OK
Configuring ExtUtils-MakeMaker-7.04 ... OK
Building ExtUtils-MakeMaker-7.04 ... OK
~~~~
shortened
~~~~
Building Number-Format-1.75 ... OK
Successfully installed Number-Format-1.75
Building Template-Plugin-Number-Format-1.06 ... OK
Successfully installed Template-Plugin-Number-Format-1.06
Building App-Netdisco-2.032006 ... OK
Successfully installed App-Netdisco-2.032006
210 distributions installed
Make some symbolic links
[netdisco@myhost perl5]$ cd ~
[netdisco@myhost ~]$ mkdir bin

[netdisco@myhost bin]$ pwd
/home/netdisco/perl5/bin
[netdisco@myhost bin]$ ln -s ~/perl5/bin/{localenv,netdisco-*} ~/bin/

[netdisco@myhost bin]$ ./netdisco-daemon status
Netdisco Daemon                             [Not Running]
Ok, we'll start it later on.

Configuration

Make directory for local configs and copy config templates from the distro.
[netdisco@myhost ~]$ mkdir ~/environments
[netdisco@myhost environments]$ cp -p /home/netdisco/perl5/lib/perl5/auto/share/dist/App-Netdisco/environments/deployment.yml ~/environments/
[netdisco@myhost environments]$ chmod 600 ~/environments/deployment.yml
[netdisco@myhost environments]$ ls -la
total 12
drwxrwxr-x. 2 netdisco netdisco 4096 Jul 28 21:29 .
drwx------. 8 netdisco netdisco 4096 Jul 28 21:27 ..
-rw-------. 1 netdisco netdisco 2253 Jul 27 23:31 deployment.yml
Edt ~/environments/deployment.yml file, pay attention on highlights in red
Ref URL: https://metacpan.org/pod/App::Netdisco::Manual::Configuration
database:
  name: 'netdisco' 
  user: 'netdisco'
  pass: 'zzzzz'
  #host: 'localhost'
safe_password_store: true
domain_suffix: '.etcfstab.com'
snmp_auth:
  - tag: 'default_v2_readonly'
    community: 'etcfstab-public'
    read: true
    write: false
schedule:
  discoverall:
    when: '5 7 * * *'
  macwalk:
    when:
      min: 20
  arpwalk:
    when:
      min: 50
  nbtwalk:
    when: '0 8,13,21 * * *'
  expire:
    when: '20 23 * * *'
dns:
  max_outstanding: 50
The new database needs configuring. Vendor MAC address prefixes (OUI data) and some MIBs are also needed. The following script will take care of all this.
[netdisco@myhost bin]$  ~/bin/netdisco-deploy 
This is the Netdisco II deployment script.

Before we continue, the following prerequisites must be in place:
 * Database added to PostgreSQL for Netdisco
 * User added to PostgreSQL with rights to the Netdisco Database
 * "~/environments/deployment.yml" file configured with Database dsn/user/pass
 * A full backup of any existing Netdisco database data
 * Internet access (for OUIs and MIBs)
You will be asked to confirm all changes to your system.

So, is all the above in place? [y/N]: y

Would you like to deploy or upgrade your database schema? [y/N]: y
DBIx::Class::Schema::Versioned::_on_connect(): Your DB is currently unversioned. Please call upgrade on your schema to sync the DB. at /home/netdisco/perl5/lib/perl5/DBICx/Sugar.pm line 85
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "dbix_class_schema_versions_pkey" for table "dbix_class_schema_versions"
...
... shortened
...
DB schema update complete.

We need to create a user for inital login. This user will be a full Administrator.
Afterwards, you can go to Admin -> User Management to manage users.

Username: admin
Password: password
New user created.

Download and update vendor MAC prefixes (OUI data)? [y/N]: y
OUI update complete.

Download and update MIB files? [y/N]: y
MIBs update complete.
Finally start web-app server as daemon, it listens on the port 5000.
[netdisco@myhost ~]$ ~/bin/netdisco-web start
Netdisco Web                                                  [Started]
config watcher: watching /home/netdisco/environments for updates.
If you run nmap on netdisco server, you'll see "5000/tcp open upnp"

Start job control daemon.

[netdisco@myhost bin]$ ./netdisco-daemon start
Netdisco Daemon                                               [Started]
config watcher: watching /home/netdisco/environments for updates.

[netdisco@myhost bin]$ ./netdisco-daemon status
Netdisco Daemon                                               [Running]

Discovery of a Cisco switch

[netdisco@myhost bin]$ ./netdisco-do discover -d 1--.2-.10.35
[27196] 2015-07-29 05:32:27  info discover: started at Tue Jul 28 22:32:27 2015
[27196] 2015-07-29 05:32:29  info discover: finished at Tue Jul 28 22:32:29 2015
[27196] 2015-07-29 05:32:29  info discover: status done: Ended discover for 1--.2-.10.35

Netdisco screenshots after installation






Back to the main page