Install NetDot on Ubuntu 16.10
In this article we will going to install NetDot on Ubuntu 16 only, as the project is discontinued.
As mentioned on the official Netdot website, Netdot is an open source tool designed to help network administrators collect, organize and maintain network documentation.
Netdot is actively developed by the Network and Telecommunication Services group of the University of Oregon.
Netdot features include:
Device discovery via SNMP
Layer 2 topology discovery and graphing, using multiple sources of information: CDP+LLDP, Spanning Tree Protocol, switch forwarding tables, router point-to-point subnets.
IPv4 and IPv6 address space management (also referred to as IPAM), including hierarchical organization, address block visualization and IP and MAC address location and tracking.
Cable plant information including: sites, rooms, jacks, closets, inter and intra-building wiring, circuits, etc.
Contact information for related entities: departments, providers, vendors, etc.
Netdot can generate configuration files for various other tools, including:
Netdot implements role-based access control, allowing tasks such as IP address management, documentation of switch/router ports and updating of contact information to be delegated to specific groups with limited access to the web interface.
Prerequisites:
Fresh installation of Ubuntu 16.04 server
Pre-installed Apache and MySQL
Internet connection
You can follow below instructions to begin the installation process
Login as the ROOT into the system, we will work as the ROOT during the entire process.
Install MySQL Server, and set the root password
apt-get install mysql-server
If it didn't ask for the password, then after the installation you have to change it by executing: mysql_secure_installation and follow the given instructions.
Please remember this root password, as it will be used for the Netdot configuration.
systemctl enable mysql.service systemctl status mysql.service
Install Apache
apt-get install apache2 -y systemctl start apache2.service systemctl enable apache2.service systemctl status apache2.service
- Now check the apache status by browsing the address http://your_host_ip_address/
Netdot Installation:
cd /opt/ git clone https://github.com/cvicente/Netdot.git cd Netdot apt-get install build-essential make apt-install
This will take some time to finish it, please be patient
Type 'mysql' when it asks for the below question
- Which RDBMS do you plan to use as backend: [mysql|Pg]? mysql
Press Y for the following question
We need to add a temporary repository of Netdot dependencies until all packages are in Debian/Ubuntu official repositories.
Would you like to continue? [y/n] y
Also input Y then ENTER for the following questions
We will install the MIB files now. Continue? [y/n] y
A new /etc/snmp/snmp.conf needs to be installed to point to the newly installed MIB files. The current file will be backed up. Continue? [y/n] y
If you get MIBS downloading error, then follow the steps below:
mkdir /tmp/netdisco-mibs cd /tmp/netdisco-mibs wget https://sourceforge.net/projects/netdisco/files/netdisco-mibs/1.0/netdisco-mibs-1.0.tar.gz
cd back to your Netdot directory and execute the following command:
make apt-install
The result of all modules should be ok, otherwise you have to install them manually
To test for missing modules in your system, run: make testdeps
In case you get any missing modules, you can install it by run the following command:
make installdeps
To install the missing modules manually, you can use CPAN to install by execute the following command:
cpan install Module::<Blah> (enter the missing module's name here)
Netdot configuration
Still on Netdot directory. perform the following tasks
cp etc/Default.conf etc/Site.conf vi etc/Site.conf
Please modify the configurations below according to your needs:
NETDOTNAME => 'CAHANGE_ME',
DB_DBA_PASSWORD => 'CAHANGE_ME', //(the password you used when installing mysql)
DEFAULT_SNMPCOMMUNITIES => ['CAHANGE_ME'],
NMS_DEVICE => 'localhost',
DEFAULT_DNSDOMAIN => 'CAHANGE_ME',
DEVICE_NAMING_METHOD_ORDER => [ 'snmp_target', 'sysname', 'highest_ip', 'lowest_loopback' ],
The patches are included in the Netdot distribution. Before applying them, you need to move to the root directory, then use the patch command (adjust the location of your Netdot repository as needed):
cd / patch -p0 < /opt/Netdot/patches/ubuntu-1604/DBI.pm.patch patch -p0 < /opt/Netdot/patches/ubuntu-1604/apache2-init.patch
Install the database application and the Netdot itself (note that some command below is a single line command):
cd /opt/Netdot/ make installdb make install APACHEUSER=www-data APACHEGROUP=www-data ln -s /usr/local/netdot/etc/netdot_apache24_local.conf /etc/apache2/conf-available/netdot.conf a2enconf netdot systemctl restart apache2
If you don't get any error, then you are good to go, otherwise, you'll have to fix the error shown on the screen.
Copy the Netdot's cron to the system:
cp netdot.cron /etc/cron.d/netdot
Login to the Netdot on your browser by typing your_host_ip_address/netdot
Username: admin
Password: admin
Adding the devices:
On the Management>Devices Click on the [new] option on the right side
On the 'Discover Device' under 'Device Tasks' input your desired device IP or domain
* Leave the SNMP version as default
* Choose your SNMP Community according to what you have configured on the Site.conf file.
* Hit the 'Discover' button, it will take a while to search for the device
* After succeed adding the device, you need to change the 'Used by' option to your device type, such as Cisco and hit the 'Update' button
* Congratulations, you have your own Netdot on your system.
Additional information
- If you run apt update and get the error below:
E: The repository 'http://netdot.apt.nsrc.org unstable/ Release' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
Then do some tweaks on the Netdot repository
sudo vi /etc/apt/sources.list.d/netdot.apt.nsrc.org.list
Add "[trusted=yes]" after the "deb" and "deb-src" lines
From:
deb http://netdot.apt.nsrc.org/ unstable/ deb-src http://netdot.apt.nsrc.org/ unstable/
To:
deb [trusted=yes] http://netdot.apt.nsrc.org/ unstable/ deb-src [trusted=yes] http://netdot.apt.nsrc.org/ unstable/
Now you can proceed to the system update.
Aapache2 service auto shutdown everyday
I have been experiencing an issue where the Apache2 service automatically stops every day, requiring me to start the service manually on the server. I am still unsure about the source of the problem. To address this, I have created a bash script that automatically starts the apache2 service every day at 7:00 am. This script can also be used for other services. Please follow the instructions below:
mkdir /root/scripts
cd /root/scripts
vi apache_autostart.sh
Then copy the content below into the files and save it. Please adjust the setting as needed:
#!/bin/bash
serv=apache2
sstat=$(pidof $serv | wc -l )
if [ $sstat -gt 0 ]
then
echo "$serv service is up!!!"
else
echo "$serv is down!!!"
systemctl start $serv
echo "$serv service is up now!!!" | mail -s "$serv service on the $(hostname) server is up again" yourmail@mail.com
fi
chmod +x apache_autostart.sh
crontab -e
Add the below line to your crontab, then save and exit:
0 7 * * * /bin/bash /root/scripts/apache_autostart.sh
Now, the script will check the Apache2 service every day at 7:00 am to ensure that the service is active and operational. Additionally, you will receive a confirmation email regarding the status of the service.
Update the devices via crontab
Run the bellow command directly to update the device databases:
sudo /usr/local/netdot/bin/updatedevices.pl -DIFAT
Or by adding the bellow command to the crontab to start updating the device database at 8 o'clock.
0 8 * * * /usr/local/netdot/bin/updatedevices.pl -DIFAT
Sources: