Tuesday, 16 April 2013

Manual Netdisco Installation

**********UPDATE (2013/04/18)**********
MIBS download/install problem solved
************************************************

Full manual installation off Netdisco - Network Management tool [English]

Netdisco Installation guide
(Last Edit: 2013-04-15)

To start with, this installation is not supporting systems that are NOT based on Debian. Like Redhat for example. Since the guide will be using apt-get and we havn’t tried yum.
We preformed this installation three times on Ubuntu and Linux Mint without any problems.
We recommend you being sudo or root user during the whole installation.


1. Start of by updating and upgrading your system.
#apt-get update
#apt-get upgrade


2. Install needed packets for netdisco to run proper
apt-get install postgresql-9.1 postgresql-server-dev-9.1 apache2 libperl-dev graphviz libnet-snmp-perl libapache2-mod-perl2 libapache-session-wrapper-perl libhtml-mason-perl libdbd-pg-perl libgraphviz-perl perl-modules libapache2-request-perl libnet-nbname-perl libsnmp-info-perl libapache-dbi-perl libmasonx-request-withapachesession-perl libparallel-forkmanager-perl libgraph-perl vim make build-essential libdb5.1-dev netdisco-common netdisco-frontend netdisco-backend netdisco-mibs-installer


3. Check apache2 is working and the two modules are loaded.
#service apache2 restart
#a2enmod perl
#a2enmod apreq


You might get an error here about netdisco.pm which means you are using the latest perl version. This will be fixed later on in the guide.
You might also get errors about the apreq and perl modules, this is because the two modules are sat on Auto-start in more than one configuration file. When it warns you simply ignore it.


4. Create a backup file for the postgresql configuration.
#cp /etc/postgresql/9.1/main/pg_hba.conf /etc/postgresql/9.1/main/pg_hba.conf.orig


5. Next up, edit the pg_hba.conf file with any editor of your choice (we are using vim).
#vim /etc/postgresql/9.1/main/pg_hba.conf       


When you are inside the file you are gonna locate the following configuration line:
#TYPE        DATABASE        USER        ADDRESS        METHOD


Add the following user beneath it to look like this:
#TYPE        DATABASE        USER        ADDRESS        METHOD
local            netdisco              netdisco                               trust


There is going to be other kinds of information and configuration but what you just did, is you added the following local user netdisco to be allowed in the sql database.


6. Now restart your database.
#service postgresql restart


7. Now we will start with the netdisco configuration. Move yourself into the netdisco folder(should be in /usr/share/doc/ if you installed it with apt-get):
#cd /usr/share/doc/netdisco-common/contrib/


unzip the configuration file.
#gunzip netdisco.conf.example.gz


Then make a backup and copy the netdisco.conf.example to netdisco.conf, if anything goes wrong you got a backup called netdisco.conf.example
#cp netdisco.conf.example /etc/netdisco/netdisco.conf


Next up edit the netdisco.conf file with any editor of your choice(we use vim)
#vim /etc/netdisco/netdisco.conf


Locate the following lines in the netdisco.conf:
db_Pg_user    netdisco
db_Pg_pw       PASSWORD


And change the “PASSWORD” to netdisco.
db_Pg_user    netdisco
db_Pg_pw    netdisco


8. Next up we are gonna change the files so they agree with the apache2, postgresql and netdisco. Start by copying /usr/share/doc/netdisco-backends/sql to /usr/lib/netdisco
#cp -r /usr/share/doc/netdisco-backend/sql/ /usr/lib/netdisco/


9. Configure the netdisco apache2. Open it up with any editor (we use vim).
#vim /etc/netdisco/netdisco_apache2.conf


Locate the following lines:
      session_user_name      => 'netdisco',
      session_password       => 'PASSWORD',


Change it to:
      session_user_name      => 'netdisco',
      session_password       => 'netdisco',


10. Next add two lines to your apache2.conf you can do this by editing the file or just write the output of a sentence to the file like this:
#echo "Include /etc/netdisco/netdisco_apache2.conf" >> /etc/apache2/apache2.conf
#echo "Include /etc/netdisco/netdisco_apache2_dir.conf" >> /etc/apache2/apache2.conf


This means the sentence “Include /etc/netdisco/netdisco_apache2.conf” and “Include /etc/netdisco/netdisco_apache2_dir.conf” now is located in apache2.conf as a sentence and a configuration.


11. Next up we are going to add some perl modules through CPAN.
Start with entering the cpan shell:
#perl -MCPAN -e shell
And your prompt should have changed to comthing like this: cpan[1]>
Now start the installations by typing in:


>install CPAN                 (installs/updates to the latest CPAN)
>install Digest::MD5                           
>install Bundle::DBI               
>install Apache::DBI
>install DBD::Pg
>install DB_File                   
>install Apache::Session
>install HTML::Entities
>install HTML::Mason
>force install MasonX::Request::WithApacheSession
>install Graph        
>install GraphViz     
>install Compress::Zlib
>install Parallel::ForkManager
>install Net::NBName
>install Net::LDAP
>install Net::SSLeay
>install IO::Socket::SSL
>install Apache2::Request


12. Next up we are going to create the database, there will be alot of text and information running through hopefully it will be made without any errors.
#/usr/bin/npg --init


13.Now chrown the netdisco user and create a admin for the netdisco.
#chown -R netdisco:netdisco /usr/share/netdisco
#chown -R www-data:www-data /usr/share/netdisco/html
#chown -R www-data:www-data /var/lib/netdisco/mason


#/usr/bin/netdisco -u admin
When your making the admin you will be promted and asked for four questions like this
n e t  d i s c o
--------------------------------------------------
Enter new password for admin [no change]: <YOURPASSWORD!>
Give admin Port Control [no change]? yes
Give admin Admin Rights [no change]? yes
User Full Name [none]? admin
Added user admin. (1)


14. Go into MIBS directory.
#cd /usr/share/netdsico/mibs/


When you located yourself to the /usr/share/netdisco/mibs directory start downloading all the mibs.
#wget http://downloads.sourceforge.net/project/netdisco/netdisco-mibs/1.3/netdisco-mibs-1.3.tar.gz


The file you just downloaded needs to untar and moved.
#tar -zxvf netdisco-mibs-1.3.tar.gz


And then move the files inside the one you just opened to the right directory.
#mv /usr/share/netdisco/mibs/netdisco-mibs-1.3/* /usr/share/netdisco/mibs/


Remove the one file you downloaded.
#rm -r netdisco-mibs-1.3 netdisco-mibs-1.3.tar.gz


15. Next we gonna edit the snmp.conf file with any editor (we use vim).
#vim /usr/share/netdisco/mibs/snmp.conf


Inside the file the snmp configuration is set to /usr/local which aint the right directory we sat it too since we installed it from apt-get. So you are going to replace every /usr/local to /usr/share.
A fast way to do that is by using a vim command to change all the local too /share:
:%s/local/share/g


After that copy the snmp.conf file
#cp /usr/share/netdisco/mibs/snmp.conf /etc/snmp/


And then install the up to date version of snmp from the internet.
#wget http://sourceforge.net/projects/net-snmp/files/net-snmp/5.7.2/net-snmp-5.7.2.tar.gz/download


locate yourself to the download section usually /home/USERNAME/Downloads
and tar the downloaded file:
#tar -zxvf net-snmp-5.7.2.tar.gz


Locate yourself to the downloaded file
#cd /net-snmp-5.7.2


Then run the final installation of snmp
./configure --with-perl-modules --enable-shared
make
make install


#cd /perl
perl Makefile.PL
make
make install


16. Check what version of perl you got installed:
#perl -v


IF YOU ARE RUNNING 5.14.X OR NEWER VERSION OF PERL YOU WILL HAVE TO DO SOME CHANGES. IF NOT ONLY CHECK SO THEY ARE CONFIGURED THE RIGHT WAY.


Edit this file and locate yourself to row 337
#vim /usr/share/perl5/netdisco.pm


Here you will edit the line:
qw(booleans array_refs hash_refs array_refs_mult hash_refs_mult)


To look like:
(qw(booleans array_refs hash_refs array_refs_mult hash_refs_mult))


Save and edit another file:
#vim /usr/share/netdisco/html/device.html


locate yourself to row 570 in the file


Edit the line:
qw(fw hw sw)


To look like this:
(qw(fw hw sw))


Now restart apache2, postgresql and netdisco:
#service apache2 restart
#service postgresql restart
#netdisco -p restart


You shouldn’t get any kind of errors and if you didn’t just open up any kind of browser and enter localhost to check the apache2 and then localhost/netdisco to enter the WEBUI.


And your done!


This guide is written by Marcus Persson & Adnan Tukic.


If you get any kind of errors or have any troubles with the installation feel free to let us know, and hopefully we will be able to answer you ASAP.

Any problems? Leave a comment or mail
persson.marcus92@gmail.com
tukic.adnan@gmail.com

17 comments:

  1. PROBLEM:

    # netdisco -p restart

    Please install it and try again.

    Can't load '/usr/local/lib/perl/5.14.2/auto/NetSNMP/default_store/default_store.so' for module NetSNMP::default_store: libnetsnmp.so.30: cannot open shared object file: No such file or directory at /usr/lib/perl/5.14/DynaLoader.pm line 184.
    at /usr/local/lib/perl/5.14.2/SNMP.pm line 19
    Compilation failed in require at /usr/local/lib/perl/5.14.2/SNMP.pm line 19.
    BEGIN failed--compilation aborted at /usr/local/lib/perl/5.14.2/SNMP.pm line 19.
    Compilation failed in require at /usr/share/perl5/SNMP/Info.pm line 15.
    BEGIN failed--compilation aborted at /usr/share/perl5/SNMP/Info.pm line 15.
    Compilation failed in require at (eval 10) line 2.
    BEGIN failed--compilation aborted at (eval 10) line 2.


    FIX, install the libraries in correct place (/usr/lib):

    ./configure --with-perl-modules --enable-shared --prefix=/usr

    ReplyDelete
    Replies
    1. An NetSnmp error, try running cpan and then type

      cpan[1]> install Net::SNMP

      Cheers.

      Delete
    2. I'm also getting the same error above, but I do have Net::SNMP installed already - when I run the install in CPAN I get:

      Net::SNMP is up to date (v6.0.1)

      How can I correct this?

      Thanks!

      Delete
    3. I've also tried Install SNMP::Info, and it is up to date as well (3.03).

      Delete
    4. The problem is that /usr/local/lib is not in the include path. Just install local::lib via CPAN (step 11) before compiling net-snmp-5.7.2 manually (step 15).

      Delete
  2. i have a problem after run this..

    root@redes:/usr/local/netdisco# ./netdisco -d device -D
    n e t d i s c o
    --------------------------------------------------
    Using Config File : /usr/local/netdisco/netdisco.conf
    Loading topology information from /usr/local/netdisco/netdisco-topology.txt
    0 entries loaded
    Loading manual topology information from database
    DBNEA 1: SELECT dev1,port1,dev2,port2 FROM topologylación «topology»
    ^ at /usr/local/netdisco/netdisco.pm line 2061.
    Can't use an undefined value as an ARRAY reference at /usr/local/lib/perl/5.10.1/DBI.pm line 2059.

    ReplyDelete
    Replies
    1. If you could go into the netdisco.pm file and copy the line 2061 back here so i can take a look at it, that would be great.

      Cheers.

      Delete
  3. Its really informative the facts and the other informative points mentioned here are quite considerable and to the point, would be so far better idea to look for more of that kind.

    Construction Service Management Software

    ReplyDelete
  4. #14 is wrong!
    #cd /usr/share/netdsico/mibs/

    it should stand
    #cd /usr/share/netdisco/mibs/

    ReplyDelete
  5. Installed according to your instructions on Ubuntu 13.10 with but when I try to discover a device from the GUI i get the following in the log (the x's are numbers, I just didn't want to paste them). I have the mibs in the right directory and edited snmp.conf the way you show to point to /usr/share so not sure what's wrong:

    n e t d i s c o
    --------------------------------------------------
    [x.xx.xxx.x] Discover starting
    get_device(x.xx.xxx.x)
    create_device(x.xx.xxx.x,c,2,AutoSpecify,bw:default)
    SNMP::Info::_global layers : sysServices.0
    SNMP::Info::_global description : sysDescr.0
    [x.xx.xxx.x] [Trying SNMP Version 1]
    create_device(x.xx.xxx.x,c,1)
    SNMP::Info::_global layers : sysServices.0
    SNMP::Info::_global description : sysDescr.0
    Can't connect to x.xx.xxx.x
    create_device(x.xx.xxx.x,2,2,AutoSpecify,bw:default)
    SNMP::Info::_global layers : sysServices.0
    SNMP::Info::_global description : sysDescr.0
    [x.xx.xxx.x] [Trying SNMP Version 1]
    create_device(x.xx.xxx.x,2,1)
    SNMP::Info::_global layers : sysServices.0
    SNMP::Info::_global description : sysDescr.0
    Can't connect to x.xx.xxx.x
    create_device(x.xx.xxx.x,3,2,AutoSpecify,bw:default)
    SNMP::Info::_global layers : sysServices.0
    SNMP::Info::_global description : sysDescr.0
    [x.xx.xxx.x] [Trying SNMP Version 1]
    create_device(x.xx.xxx.x,3,1)
    SNMP::Info::_global layers : sysServices.0
    SNMP::Info::_global description : sysDescr.0
    Can't connect to x.xx.xxx.x
    ! Device Not Supported or I can't connect to it via SNMP.

    ReplyDelete
  6. The requested URL /netdisco was not found on this server
    why?

    ReplyDelete
  7. Thank You for great guide! I still have one problem:
    # cat /etc/debian_version
    # 7.1

    /usr/bin/npg --init
    Use of qw(...) as parentheses is deprecated at /usr/bin/npg line 224.
    /usr/bin/npg - Netdisco Postgres Wrapper.
    Use of qw(...) as parentheses is deprecated at /usr/share/perl5/netdisco.pm line 337.
    [ node_ip.sql ]
    [ device_module.sql ]
    [ device_port_vlan.sql ]
    [ node_monitor.sql ]
    [ log.sql ]
    [ complete_bootstrap.sql ]
    [ device_ip.sql ]
    [ users.sql ]
    [ device_port.sql ]
    [ sessions.sql ]
    [ node_wireless.sql ]
    [ device_port_log.sql ]
    [ subnets.sql ]
    [ device_port_wireless.sql ]
    [ node.sql ]
    [ user_log.sql ]
    [ device_power.sql ]
    [ oui.sql ]
    [ device.sql ]
    [ device_port_power.sql ]
    [ device_vlan.sql ]
    [ node_nbt.sql ]
    [ process.sql ]
    [ device_port_ssid.sql ]
    [ admin.sql ]

    Running database commands as postgres user.
    Creating User netdisco.
    CREATE USER netdisco PASSWORD 'netdisco' NOCREATEDB NOCREATEUSER
    CREATE ROLE
    Creating Database netdisco.
    Creating tables and indicies.
    If prompted enter 'netdisco' as password.
    psql: FATAL: Peer authentication failed for user "netdisco"

    This should be OK:
    # grep netdisco /etc/postgresql/9.1/main/pg_hba.conf
    local netdisco netdisco trust

    So what is the cause?

    ReplyDelete
    Replies
    1. Additional info by previous:
      From pg debug:
      "provided user name (netdisco) and authenticated user name (root) do not match"

      Delete
    2. In the step above where you create the credentials in the pg_hba.conf file, be sure that you put it directly under the column heading names as pictured (not at the bottom after all the other credentials). It appears that postgres processes these in a top down order. Once I moved that credential line to the top of the order, the database initilization (and subsequent admin user setup) worked without issue.

      Delete
  8. Hi,
    I am getting the following error...can you give a hand?

    /usr/bin/npg --init
    "my" variable $cmd masks earlier declaration in same statement at /usr/bin/npg line 283.
    "my" variable $b masks earlier declaration in same statement at /usr/bin/npg line 289.
    "my" variable $b masks earlier declaration in same statement at /usr/bin/npg line 289.
    "my" variable $EXIT masks earlier declaration in same scope at /usr/bin/npg line 290.
    syntax error at /usr/bin/npg line 224, near "$user qw(postgres pgsql)"
    syntax error at /usr/bin/npg line 230, near "}"
    syntax error at /usr/bin/npg line 237, near "}"
    syntax error at /usr/bin/npg line 242, near "}"
    syntax error at /usr/bin/npg line 245, near "}"
    syntax error at /usr/bin/npg line 259, near "}"
    syntax error at /usr/bin/npg line 279, near "}"
    syntax error at /usr/bin/npg line 284, near "}"
    syntax error at /usr/bin/npg line 291, near "}"
    Execution of /usr/bin/npg aborted due to compilation errors.

    ReplyDelete
  9. Hi,

    same issue on my installation on database init procedure

    ReplyDelete
  10. If you're running a version of Netdisco prior to 2.x then you should follow the full installation instructions, above. This process is for upgrading version 2.x only.

    goldenslot
    สูตรบาคาร่า

    ReplyDelete