Install OpenNMS Network Monitoring in Debian and Ubuntu

OpenNMS (Open Network Management System) is a free and open source, scalable, extensible, enterprise-grade and cross-platform Java-based network management platform was designed to monitor critical services on remote machines and gathers the information of remote hosts data by using SNMP and JMX (Java Management Extensions).

Read Also: Install OpenNMS Network Monitoring Tool in CentOS/RHEL 7

OpenNMS runs on Linux and Windows operating systems and comes with a web-based console for easily administering networks and applications, supported by a Postgres database management system in the backend.

OpenNMS Requirements

  • Debian 9 or higher, Ubuntu 16.04 LTS or higher
  • Installed OpenJDK 11 Development Kit
  • 2 CPU, 2 GB RAM, 20 GB disk

In this article, we will explain how to install and setup the latest OpenNMS Horizon network service monitoring software in Debian and Ubuntu Linux distributions.

Step1: Installing Java – OpenJDK 11 in Ubuntu

First, install the most recent version of OpenJDK Java 11 using the following apt command.

$ sudo apt-get install openjdk-11-jdk

Next, verify the version of Java installed on your system.

$ java -version
Check Java Version in Ubuntu

Check Java Version in Ubuntu

Then set the Java environment variable for all users on boot time, by adding the following line in /etc/profile file.

export JAVA_HOME=/usr/lib/jvm/java-1.11.0-openjdk-amd64

save the file and run the following command to read /etc/profile file.

$ source /etc/profile

Step 2: Install OpenNMS Horizon in Ubuntu

To install OpenNMS Horizon, add the apt repository in /etc/apt/sources.list.d/opennms.list and add GPG key, then update the APT cache using the following commands.

$ cat << EOF | sudo tee /etc/apt/sources.list.d/opennms.list
deb https://debian.opennms.org stable main
deb-src https://debian.opennms.org stable main
EOF
$ wget -O - https://debian.opennms.org/OPENNMS-GPG-KEY | apt-key add -
$ apt update

Next, install OpenNMS Horizon meta-packages (opennms-core and opennms-webapp-jetty) with all built-in dependencies (jicmp6 and jicmp, postgresql and postgresql-libs).

$ sudo apt install opennms

Then verify that the OpenNMS meta packages have been installed in the /usr/share/opennms directory using the tree utility.

$ cd /usr/share/opennms
$ tree -L 1
View OpenNMS Installation Directory

View OpenNMS Installation Directory

Note: It is recommended to disable the OpenNMS Horizon apt repository after installation to prevent upgrades while it is running:

$ sudo apt-mark hold libopennms-java libopennmsdeps-java opennms-common opennms-db

Step 3: Initialize and Setup PostgreSQL

On Debian and Ubuntu, immediately after installing the packages, the installer initializes Postgres database, starts the service and enables it to auto-start at system boot.

To check if the service is up and running, run the following command:

$ sudo systemctl status postgresql
Check Postgres Service Status

Check Postgres Service Status

Next, switch to the postgres user account and create an opennms database user with a password.

$ sudo su - postgres
$ createuser -P opennms
$ createdb -O opennms opennms
Create OpenNMS Database

Create OpenNMS Database

Now secure the postgres default/superuser account by setting a password.

$ psql -c "ALTER USER postgres WITH PASSWORD 'YOUR-POSTGRES-PASSWORD';"
Set Postgres Superuser Password

Set Postgres Superuser Password

At this stage, you need to set up the database access in OpenNMS Horizon configuration file.

$ sudo vim /usr/share/opennms/etc/opennms-datasources.xml

Find the sections below and set credentials to access the PostgreSQL database:

<jdbc-data-source name="opennms"
                    database-name="opennms"
                    class-name="org.postgresql.Driver"
                    url="jdbc:postgresql://localhost:5432/opennms"
                    user-name="opennms-db-username"
                    password="opennms-db-user-passwd” />
<jdbc-data-source name="opennms-admin"
                    database-name="template1"
                    class-name="org.postgresql.Driver"
                    url="jdbc:postgresql://localhost:5432/template1"
                    user-name="postgres"
                    password="postgres-super-user-passwd" />
Configure Database Access

Configure Database Access

Save the changes in the file and close it.

Step 4: Initialize and start OpenNMS Horizon

To initialize OpenNMS, you need to intergrate it with Java. So, run the following command to detect the Java environment and persist in /usr/share/opennms/etc/java.conf configuration file.

$ sudo /usr/share/opennms/bin/runjava -s
Integrate Java with OpenNMS

Integrate Java with OpenNMS

Next, you need to initialize the database and detect system libraries persisted in /opt/opennms/etc/libraries.properties by running the OpenNMS installer.

$ sudo /usr/share/opennms/bin/install -dis
Run OpenNMS Installer

Run OpenNMS Installer

Now start OpenNMS service via systemd for now, then enable it to auto-start at system startup and check its status with these commands.

$ sudo systemctl start opennms
$ sudo systemctl enable opennms
$ sudo systemctl status opennms
Start and Verify OpenNSM Service

Start and Verify OpenNSM Service

If you have a UFW firewall running on your system, you need to open the port 8980 in your firewall.

$ sudo ufw allow 8980/tcp
$ sudo ufw reload

Step 5: Access OpenNMS Web Console and Login

Now open a web browser and point it to the following URL to access the OpenNMS web console.

http://SERVER_IP:8980/opennms
OR 
http://FDQN-OF-YOUR-SERVER:8980/opennms

After the login interface shows up as shown in the following image, use the default login credentials: username is admin and the password is admin.

OpenNMS Web Console Login

OpenNMS Web Console Login

Once you have successfully logged on for the first time, you will access the admin dashboard.

OpenNMS Default Admin Dashboard

OpenNMS Default Admin Dashboard

Next, you need to change the default admin password by going to the main navigation menu, click “adminChange Password, under User Account Self-Service, click “Change Password“.

Enter the current/default password, set a new password and confirm it, then Click “Submit“. Afterwards logout and login with your new password.

Finally, learn how to set up, configure, and maintain an OpenNMS Horizon via the web interface, add nodes and application by consulting the OpenNMS Administrators Guide.

Read Also: How to Add Hosts in OpenNMS Monitoring Server

OpenNMS is an enterprise-grade network and application monitoring tool. As usual, reach us through the feedback form below for any questions or comments about this article.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

Aaron Kili

Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

4 Responses

  1. Nelson says:

    Trying to install the last version of OpenNMS in the last stable version of Debian leads to an apt error with the repositories:

    [email protected]:~# apt update
    Ign:1 http://nightly.odoo.com/12.0/nightly/deb ./ InRelease
    Ign:2 https://debian.opennms.org stable InRelease
    Hit:3 http://nightly.odoo.com/12.0/nightly/deb ./ Release
    Hit:4 https://debian.opennms.org stable Release
    Hit:7 http://ftp.debian.org/debian buster-backports InRelease
    Hit:8 http://deb.debian.org/debian buster InRelease
    Hit:9 http://repo.mysql.com/apt/debian stretch InRelease
    Hit:10 http://deb.debian.org/debian-security buster/updates InRelease
    Hit:11 http://deb.debian.org/debian buster-updates InRelease
    Hit:12 http://linorg.usp.br/debian-marillat stable InRelease
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    All packages are up to date.
    W: Conflicting distribution: https://debian.opennms.org stable Release 
    (expected stable but got opennms-24)
    [email protected]:~#
    

    That error can be fixed just changing the stable keyword in /etc/apt/sources.list.d/opennms.list repository file with opennms-24.

    [email protected]:~# apt update
    Hit:1 http://repo.mysql.com/apt/debian stretch InRelease
    Hit:2 http://deb.debian.org/debian buster InRelease
    Hit:3 http://deb.debian.org/debian-security buster/updates InRelease
    Hit:4 http://ftp.debian.org/debian buster-backports InRelease
    Ign:5 http://nightly.odoo.com/12.0/nightly/deb ./ InRelease
    Hit:6 http://deb.debian.org/debian buster-updates InRelease
    Hit:7 http://nightly.odoo.com/12.0/nightly/deb ./ Release
    Hit:9 http://linorg.usp.br/debian-marillat stable InRelease
    Ign:10 https://debian.opennms.org opennms-24 InRelease
    Get:11 https://debian.opennms.org opennms-24 Release [11.2 kB]
    Get:12 https://debian.opennms.org opennms-24 Release.gpg [224 B]
    Get:13 https://debian.opennms.org opennms-24/main Sources [3,696 B]
    Get:14 https://debian.opennms.org opennms-24/main i386 Packages [25.8 kB]
    Get:15 https://debian.opennms.org opennms-24/main i386 Contents (deb) [97.6 kB]
    Fetched 138 kB in 18s (7,643 B/s)
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    All packages are up to date.
    

    But after that I get dependency errors from apt when I’m trying to install OpenNMS (trying to install those packages leads to another dependency package errors).

    [email protected]:~# apt install opennms
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    Some packages could not be installed. This may mean that you have
    requested an impossible situation or if you are using the unstable
    distribution that some required packages have not yet been created
    or been moved out of Incoming.
    The following information may help to resolve the situation:
    
    The following packages have unmet dependencies:
     opennms : Depends: opennms-server (= 24.1.2-1) but it is not going to be installed
               Depends: opennms-webapp-jetty (= 24.1.2-1) but it is not going to be installed
               Recommends: opennms-source (= 24.1.2-1) but it is not going to be installed
    E: Unable to correct problems, you have held broken packages.
    

    Changing the repository from opennms-24 to opennms-23 or opennms-22 leads to another unmet dependency errors with PostgreSQL.

    Seems obvious the Debian OpenNMS repository has broken dependency packages, so, there’s any other alternative to this or just have to wait to be fixed…?

Leave a Reply to Nelson Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.