Install OpenNMS Network Monitoring Platform on Ubuntu 16.04 | 18.04
OpenNMS is an open-source, enterprise-grade platform to build network monitoring solutions and you gain insights from your networking devices so you can make sense of their logs….
It helps you monitor, search and analyze the vast amount of data, (especially in a larger environments) into a simple format that you can easily read and digest….
OpenNMS automatically discover your entire network using CDP, FDP, LLDP, OSPF, BGP, SNMP and ARP and provide you alerts via email, slack, support for Microblog notifications via Identica / StatusNet / Twitter and more…
Majority of the network devices in use today support protocols that work with OpenNMS — from many major manufacturers… including vast majority of the networking devices deployed…
This brief tutorial is going to show students and new users how to install OpenNMS software on Ubuntu 16.04 | 18.04 LTS servers…
For more about OpenNMS, please check its homepage…
Since OpenNMS is based on Java and requires Java in order to function, you’ll want to install Java JDK… The open source version of JavaJDK works great, so use the steps below to install and configure it on Ubuntu…
Step 1: Install OpenJDK on Ubuntu
Run the commands below to install OpenJDK on Ubuntu desktop….
sudo apt update sudo apt install default-jdk
That should install the latest OpenJDK on Ubuntu… At the time of this writing the latest OpenJDK version was at 11….
After installing OpenJDK, run the commands below to configure it as the default JDK runtime for Ubuntu… To find out which version of JDK to run, type the commands below:
sudo update-alternatives --config java
If you have multiple versions, you’ll see OpenJDK on the list… If only OpenJDK is installed, you should see a message that there is only one alternative for Java…
There is only one alternative in link group java (providing /usr/bin/java): /usr/lib/jvm/java-11-openjdk-amd64/bin/java
Nothing to configure.
Take notes of where JAVA is located…
Next, copy the installation path of your preferred JDK home. Next, open the /etc/environment file:
sudo nano /etc/environment
Add the following line, at the end of the file:
JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64"
Close out and save… Then run the commands below to apply…
source /etc/environment
When you’re done, OpenJDK should be installed and ready to use…
Step 2: Downloading OpenNMS
After installing OpenJDK to your system, run the commands below to Add apt repository in /etc/apt/sources.list.d/opennms.list and add GPG key…
To do that, run the commands below to create a new opennms.list file…
sudo nano /etc/apt/sources.list.d/opennms.list
Then copy and paste the lines below into the file and save..
deb https://debian.opennms.org stable main deb-src https://debian.opennms.org stable main
After that, run the commands below to add the repository PGP key..
wget -O - https://debian.opennms.org/OPENNMS-GPG-KEY | sudo apt-key add -
Finally, run the commands below to install OpenNMS packages including all dependencies..
sudo apt update sudo apt install opennms
The above commands will install the opennms meta package together with all built-in dependencies such as jicmp6 and jicmp, opennms-core, opennms-webapp-jetty, postgresql and postgresql-libs.
With the successful installed packages the OpenNMS Horizon is installed in the following directory structure:
[root@localhost /usr/share/opennms]# tree -L 1 . └── opennms ├── bin ├── data ├── deploy ├── etc -> /etc/opennms ├── instances ├── jetty-webapps ├── lib -> ../java/opennms ├── logs -> /var/log/opennms ├── share -> /var/lib/opennms └── system
With the successful installed packages the OpenNMS Horizon is installed in the following directory structure:
The Debian package installs the PostgreSQL database and is already initialized… The PostgreSQL service is already added in the runlevel configuration for system startup.
Startup PostgreSQL database by running the commands below:
sudo systemctl start postgresql
After installing PostgreSQL, it’s a good idea to create / change the default PostgreSQL user password… Run the commands below to create / change the user password in the bash shell and not PostgreSQL interactive shell..
Set password for Linux user (postgres)
sudo passwd postgres
You should be prompted to create a new Linux password for postgres user..
Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully
After setting a new password, every time you want to access PostgreSQL interactive shell, you’ll be prompted to confirm the password you created after running the commands above…
Next, create an opennms database user with a password and create an opennms database which is owned by the user opennms
sudo su -l postgres createuser -P opennms createdb -O opennms opennms
Set a password for Postgres super user
psql -c "ALTER USER postgres WITH PASSWORD 'YOUR-POSTGRES-PASSWORD';"
exit
Next, configure database access in OpenNMS Horizon
sudo nano /etc/opennms/opennms-datasources.xml
Make the highlighted changes below, then save..
<jdbc-data-source name="opennms" database-name="opennms" class-name="org.postgresql.Driver" url="jdbc:postgresql://localhost:5432/opennms" user-name="opennms" password="YOUR-OPENNMS-PASSWORD"/> <jdbc-data-sourcename="opennms-admin" database-name="template1" class-name="org.postgresql.Driver" url="jdbc:postgresql://localhost:5432/template1" user-name="postgres" password="YOUR-POSTGRES-PASSWORD"/>
- Set credentials to access the PostgreSQL database
- Set the database name OpenNMS Horizon should use
- Set the user name to access the opennms database table
- Set the password to access the opennms database table
- Set the postgres user for administrative access to PostgreSQL
- Set the password for administrative access to PostgreSQL
Save and exit..
Detect of Java environment and persist in /usr/share/opennms/etc/java.conf
$ sudo /usr/share/opennms/bin/runjava -s
You should see an output as below:
Output: runjava: Looking for an appropriate JVM... runjava: Checking for an appropriate JVM in JAVA_HOME... runjava: Found: "/usr/lib/jvm/java-11-openjdk-amd64/bin/java" is an appropriate JVM. runjava: Value of "/usr/lib/jvm/java-11-openjdk-amd64/bin/java" stored in configuration file.
If you getting error starting OpenNMS, manually add the JAVA_HOME settings using the commands below:
sudo nano /etc/default/opennms
Then add the highlighted line in the file and save
# Set JAVA_HOME if it cannot be auto-detected
#JAVA_HOME=/usr/lib/jvm/java-8-oracle
JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64/bin/java
Initialize the database and detect system libraries persisted in /opt/opennms/etc/libraries.properties
$ sudo /usr/share/opennms/bin/install -dis
You should see an output similar to below:
Output: Processing DiscoveryConfigurationLocationMigratorOffline: Changes the name for the default location from 'localhost' to 'Default'. See HZN-940. - Running pre-execution phase Backing up discovery-configuration.xml Zipping /usr/share/opennms/etc/discovery-configuration.xml - Running execution phase - Saving the execution state - Running post-execution phase Removing backup /usr/share/opennms/etc/discovery-configuration.xml.zip Finished in 0 seconds Upgrade completed successfully!
Configure systemd to start OpenNMS Horizon on system boot
sudo systemctl enable opennms sudo systemctl start opennms
Finally, OpenNMS web application at http://localhost:8980/opennms… The default login user is admin and the password is initialized to admin.
Username: admin
Password: admin

Login and start configuring your settings…

Enjoy!
You may also like the post below:
Hi man
just want to say thanks for sharing and your time
it works perfect and straightforward
thanks a lot, stay healthy n safe 05/6/20