How to Install OpenNMS Network Monitoring Solution on Debian 11

OpenNMS is a free and open-source Open Network Management System written in Java. It is a network monitoring application that gathers critical information from local and network hosts using the SNMP protocol. It can be installed on Linux and Windows operating systems and provides a web-based interface to monitor network traffics through a web browser. It offers a rich set of features including, Provisioning, Service Monitoring, Event Management, Charting support and Performance Measurement.

In this post, we will show you how to install OpenNMS on Debian 11.

Prerequisites

  • A server running Debian 11.
  • A root password is configured on the server.

Install Required Dependencies

First, update your system packages to the latest version using the following command:

apt-get update -y

Once all the packages are updated, you will also need to install Java and other required dependencies to your server. You can install all of them by running the following command:

apt-get install default-jdk gnupg2 curl wget -y

Once all the packages are installed, you can verify the Java version with the following command:

java -version

You should see the Java version in the following output:

openjdk version "11.0.12" 2021-07-20
OpenJDK Runtime Environment (build 11.0.12+7-post-Debian-2)
OpenJDK 64-Bit Server VM (build 11.0.12+7-post-Debian-2, mixed mode, sharing)

Once you are finished, you can proceed to the next step.

Add OpenNMS Repository

By default, the OpenNMS package is not included in the Debian 11 default repository. So you will need to add the OpenNMS repository to the APT. You can add it with the following command:

nano /etc/apt/sources.list.d/opennms.list

Add the following lines:

deb https://debian.opennms.org stable main
deb-src https://debian.opennms.org stable main

Save and close the file then add the GPG key with the following command:

wget -O - https://debian.opennms.org/OPENNMS-GPG-KEY | apt-key add -

Once the repository and key is added, update the repository cache with the following command:

apt-get update -y

Once you are finished, you can proceed to the next step.

Install OpenNMS on Debian 11

Now, run the following command to install the OpenNMS package to your system.

apt-get install opennms -y

Once the OpenNMS is installed, you should see the following output:

 *** Installation complete.  You must still run the installer at
 *** $OPENNMS_HOME/bin/install to be sure your database is up
 *** to date before you start OpenNMS.  See the install guide at
 *** http://www.opennms.org/wiki/Installation:Debian and the
 *** release notes for details.

Setting up opennms-webapp-jetty (28.1.1-1) ...
Setting up opennms-source (28.1.1-1) ...
Setting up opennms (28.1.1-1) ...
Setting up liblwp-protocol-https-perl (6.10-1) ...
Setting up libwww-perl (6.52-1) ...
Setting up libxml-parser-perl:amd64 (2.46-2) ...
Setting up libxml-twig-perl (1:3.52-1) ...
Processing triggers for man-db (2.9.4-2) ...
Processing triggers for libc-bin (2.31-13) ...

The above command will also install the PostgreSQL server package automatically. You can start it using the following command:

systemctl start postgresql

Next, check the status of the PostgreSQL using the following command:

systemctl status postgresql

You will get the following output:,/p>

? postgresql.service - PostgreSQL RDBMS
     Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: enabled)
     Active: active (exited) since Sun 2021-10-24 04:56:37 UTC; 1min 9s ago
   Main PID: 17627 (code=exited, status=0/SUCCESS)
      Tasks: 0 (limit: 4679)
     Memory: 0B
        CPU: 0
     CGroup: /system.slice/postgresql.service

Oct 24 04:56:37 debian11 systemd[1]: Starting PostgreSQL RDBMS...
Oct 24 04:56:37 debian11 systemd[1]: Finished PostgreSQL RDBMS.

Once you are finished, you can proceed to the next step.

Create a Database and User for OpenNMS

Next, you will need to create a database and user for OpenNMS. First, log in to PostgreSQL with the following command:

su - postgres

Once you are login, create a user with the following command:

createuser opennms

Next, set a password for the opennms user with the following command:

psql -c "ALTER USER opennms WITH PASSWORD 'opennms';"

Next, create a database for OpenNMS with the following command:

createdb -O opennms opennms

Next, set a password for Postgres user with the following command:

psql -c "ALTER USER postgres WITH PASSWORD 'securepassword';"

Next, exit from the PostgreSQL shell using the following command:

exit

Once you are finished, you can proceed to the next step.

Configure OpenNMS

Next, you will need to edit the OpenNMS data source file and define your database settings.

nano /usr/share/opennms/etc/opennms-datasources.xml

Change the following lines as per your database settings:

<jdbc-data-source name="opennms"
                    database-name="opennms"
                    class-name="org.postgresql.Driver"
                    url="jdbc:postgresql://localhost:5432/opennms"
                    user-name="opennms"
                    password="opennms” />
<jdbc-data-source name="opennms-admin"
                    database-name="template1"
                    class-name="org.postgresql.Driver"
                    url="jdbc:postgresql://localhost:5432/template1"
                    user-name="postgres"
                    password="securepassword" />

Save and close the file when you are finished.

Initialize and start OpenNMS

First, you will need to integrate OpenNMS with Java. You can do it by running the following command:

/usr/share/opennms/bin/runjava -s

You will get the following output:

runjava: Looking for an appropriate JVM...
runjava: Checking for an appropriate JVM in JAVA_HOME...
runjava: Skipping... JAVA_HOME not set.
runjava: Checking JVM in the PATH: "/etc/alternatives/java"...
runjava: Did not find an appropriate JVM in the PATH: "/etc/alternatives/java"
runjava: Searching for a good JVM...
runjava: Found a good JVM in "/usr/lib/jvm/java-11-openjdk-amd64/bin/java".
runjava: Value of "/usr/lib/jvm/java-11-openjdk-amd64/bin/java" stored in configuration file.

Next, initialize the database and detect system libraries using the following command:

/usr/share/opennms/bin/install -dis

You will get the following output:

Processing RemotePollerServiceConfigMigratorOffline: Remove deprecated RemotePoller service entry from service-configuration.xml, see NMS-12684
- Running pre-execution phase
  Creating backup of /usr/share/opennms/etc/service-configuration.xml
    Zipping /usr/share/opennms/etc/service-configuration.xml
- Running execution phase
  Current configuration: 32 services.
  A service entry named 'OpenNMS:Name=PerspectivePoller' already exists.
  Final configuration: 32 services.
- Saving the execution state
- Running post-execution phase
  Removing backup /usr/share/opennms/etc/service-configuration.xml.zip

Finished in 0 seconds
Upgrade completed successfully!

Finally, start the OpenNMS and enable it to start at system reboot:

systemctl start opennms
systemctl enable opennms

You can also verify the status of the OpenNMS with the following command:

systemctl status opennms

You should see the following output:

? opennms.service - OpenNMS server
     Loaded: loaded (/lib/systemd/system/opennms.service; disabled; vendor preset: enabled)
     Active: active (running) since Sun 2021-10-24 05:00:11 UTC; 3s ago
    Process: 22231 ExecStart=/usr/share/opennms/bin/opennms -s start (code=exited, status=0/SUCCESS)
   Main PID: 23326 (java)
      Tasks: 43 (limit: 4679)
     Memory: 212.8M
        CPU: 21.168s
     CGroup: /system.slice/opennms.service
             ??23325 bash /usr/share/opennms/bin/opennms -s start
             ??23326 /usr/lib/jvm/java-11-openjdk-amd64/bin/java --add-modules=java.base,java.compiler,java.datatransfer,java.desktop,java.ins>

Oct 24 05:00:13 debian11 opennms[23326]: [DEBUG] System property 'opennms.library.jicmp' set to '/usr/lib/jni/libjicmp.so.  Attempting to load>
Oct 24 05:00:13 debian11 opennms[23326]: [INFO] Successfully loaded jicmp library.
Oct 24 05:00:13 debian11 opennms[23326]: [DEBUG] System property 'opennms.library.jicmp' set to '/usr/lib/jni/libjicmp.so.  Attempting to load>
Oct 24 05:00:13 debian11 opennms[23326]: [INFO] Successfully loaded jicmp library.
Oct 24 05:00:13 debian11 opennms[23326]: [DEBUG] System property 'opennms.library.jicmp6' set to '/usr/lib/jni/libjicmp6.so.  Attempting to lo>
Oct 24 05:00:13 debian11 opennms[23326]: [INFO] Successfully loaded jicmp6 library.
Oct 24 05:00:13 debian11 opennms[23326]: [DEBUG] System property 'opennms.library.jicmp' set to '/usr/lib/jni/libjicmp.so.  Attempting to load>
Oct 24 05:00:13 debian11 opennms[23326]: [INFO] Successfully loaded jicmp library.
Oct 24 05:00:13 debian11 opennms[23326]: [DEBUG] System property 'opennms.library.jicmp6' set to '/usr/lib/jni/libjicmp6.so.  Attempting to lo>
Oct 24 05:00:13 debian11 opennms[23326]: [INFO] Successfully loaded jicmp6 library.

At this point, OpenNMS is started and listens on port 8980. You can check it with the following command:

ss -antpl | grep 8980

You will get the following output:

LISTEN 0      50                      *:8980             *:*    users:(("java",pid=23326,fd=815)) 

Access OpenNMS Web Interface

Now, open your web browser and access the OpenNMS web console using the URL http://your-server-ip:8980/opennms. You should see the OpenNMS login page:

OpenNMS Login

Provide the default admin username and password as admin/admin and click on the Login button. You should see the OpenNMS dashboard on the following page:

OpenNMS dashboard

Now, click on the + icon to add the new host. You should see the following page:

Add new node

Provide the name of your requisition and click on the OK. You should see the following page:

Node settings

Device settings

Provide your remote host's name, IP, username, password, access method and click on the Provision button. Once the host is added, you will get the following screen:

Node added successfully

Click on the Ok button. You should see your newly added host on the following screen:

OpenNMS Network Monitoring

Conclusion

Congratulations! you have successfully installed and configured OpenNMS on Debian 11. You can now add more hosts to the OpenNMS and start monitoring them from the web-based interface.

Share this page:

Suggested articles

2 Comment(s)

Add comment

Comments

By: Chris at: 2021-10-31 20:16:59

"using the SNPM protocol".  U mean SNMP?

By: till at: 2021-11-01 07:26:56

Thank you for the pointer. I've corrected the typo.