We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

Learn how to – How To Install OpenNMS on Debian 11 / Debian 10

Learn how to – How To Install OpenNMS on Debian 11 / Debian 10.

Monitoring is one of the key areas in computing. It is quite crucial to be able to always know how servers or networks are doing in a computing environment. It is one of the crucial ways of ensuring business continuity since we are able to point out anything going wrong at any given time. This is the reason why most companies have a dedicated team for monitoring whose work is to look out for any possible issues in the system and report them to the relevant teams. There are quite a number of powerful tools that offer effective monitoring metrics and dashboards. Most of these tools are free and open source but still offer the desired information. Your choice of monitoring tool depends on what you wish to monitor as well as the information you need displayed on the dashboards.

OpenNMS (Open Network Management System) is a powerful free and opensource java-based network monitoring tool which gathers critical information on local and remote hosts for monitoring using SNMP (Simple network Management Protocol) and JMX (Java Management Extensions). It is enterprise class, highly customizable and scalable therefore integrates easily with core business applications and workflows. OpenNMS offers traffic monitoring, performance monitoring, alarms and sends alerts via email.

Features of OpenNMS

Some of the features/ advantages of OpenNMS include:

  • Service Assurance
  • Surveillance View
  • Service Monitors
  • Performance Management
  • Event-Driven
  • Critical Service
  • Geographical Map
  • Grafana Support
  • Elastic search Forwarder
  • Business Service Monitoring
  • Business Service Hierarchy
  • Root Cause and Impact Analysis
  • Alarms and Notifications
  • Easy Integration
  • Resource Graph Viewer
  • Service Heatmap
  • Backshift Graph Visualization
  • Provisioning
  • Typology Discovery
  • Supports Layer 2 Network Topologies
  • Supports Layer 3 Network Topologies

System Requirements

Before installation, consider have the ollowing system requirements:

  • 2 CPU, 2GB RAM, 20GB Hard Disk
  • Non-root user with sudo privileges

once you confirm the above, follow the next steps to have OpenNMS installed on Debian 10|9

Step 1: System update

Ensure to have the latest system packages before installations to prevent possible issues with dependencies

sudo apt-get update
sudo apt-get upgrade

You can consider performing a system reboot once the upgrade is successful:

sudo reboot

Step 2: Install OpenJDK 11 on Debian

We require a certain packages to facilitate a successful installation of OpenNMS on Debian 10| 9. Install OpenJDK on Debian 10| 9 as below

sudo apt update
sudo apt install default-jdk -y

When installed, confirm version and set Java environment

$ java -version
openjdk version "11.0.18" 2023-01-17
OpenJDK Runtime Environment (build 11.0.18+10-post-Debian-1deb11u1)
OpenJDK 64-Bit Server VM (build 11.0.18+10-post-Debian-1deb11u1, mixed mode, sharing)

Setting Java environment

$ sudo vim /etc/profile
export JAVA_HOME=/usr/lib/jvm/default-java

$ source /etc/profile

Step 3: Install OpenNMS Horizon on Debian

We are going to add OpernNMS repository and GPG key to our Debian system to install from.

Add OpenNMS APT repository:

cat << EOF | sudo tee /etc/apt/sources.list.d/opennms.list
deb https://debian.opennms.org stable main
EOF

Import GPG key:

curl -fsSL https://debian.opennms.org/OPENNMS-GPG-KEY|sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/opennms.gpg

Update package index and install openms packages:

sudo apt update
sudo apt install opennms

Accept the prompts to proceed with package installation:

....
0 upgraded, 30 newly installed, 0 to remove and 32 not upgraded.
Need to get 874 MB of archives.
After this operation, 1,268 MB of additional disk space will be used.
Do you want to continue? [Y/n] y

You can optionally disable OpenNMS APT repository to avoid updates during set up

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

Step 4: Set up PostgreSQL Database

OpenNMS uses PostGgreSQL database. Once you install OpenNMS, it automatically installs PostgreSQL. Start PostgreSQL and confirm its status as below:

$ sudo systemctl start postgresql
$ sudo systemctl status postgresql
● postgresql.service - PostgreSQL RDBMS
   Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor prese
   Active: active (exited) since Sat 2021-08-14 14:35:46 EAT; 5min ago
  Process: 10542 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
 Main PID: 10542 (code=exited, status=0/SUCCESS)

Aug 14 14:35:46 lorna-pc systemd[1]: Starting PostgreSQL RDBMS...
Aug 14 14:35:46 lorna-pc systemd[1]: Started PostgreSQL RDBMS.

Let’s create a PostgreSQL database and user with a password. First, switch to postgres user to be able to run PostgreSQL commands.

$ sudo su - postgres
postgres@lorna-pc:~$ createuser opennms
postgres@lorna-pc:~$ psql -c "ALTER USER opennms WITH PASSWORD 'opennms';"
ALTER ROLE
postgres@lorna-pc:~$ createdb -O opennms opennms

Create a password for PostgreSQL default user to protect it

postgres@lorna-pc:~$ psql -c "ALTER USER postgres WITH PASSWORD 'StrongPassw0rd';"
ALTER ROLE
postgres@lorna-pc:~$ exit

Next, we set up database access in OpenNMS configuration. Open the configuration file:

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

Set the PostgreeSQL DB user and default user as shown

<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="StrongPassw0rd" />

Step 5: Initialize and Start OpenNMS Horizon

For this, we first need to detect Java environment and persist it since Opennms needs to integrate with Java

$ sudo /usr/share/opennms/bin/runjava -s
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.

To complete the set up, run the below command the will initialize the database and detect system libraries

$ sudo /usr/share/opennms/bin/install -dis
.....
- 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!

Now start and enable OpenNMS as below:

sudo systemctl start opennms
sudo systemctl enable opennms

Confirm OpenNMS status

$ systemctl status opennms
● opennms.service - OpenNMS server
   Loaded: loaded (/lib/systemd/system/opennms.service; enabled; vendor preset: 
   Active: active (running) since Sat 2021-08-14 15:47:43 EAT; 19s ago
 Main PID: 12542 (java)
    Tasks: 60 (limit: 1799)
   Memory: 381.8M
   CGroup: /system.slice/opennms.service
           ├─12541 bash /usr/share/opennms/bin/opennms -s start
           └─12542 /usr/lib/jvm/java-11-openjdk-amd64/bin/java --add-modules=java

Step 6: Configure Firewall using ufw

OpenNMS runs on port 8980. If you are running an active firewall, you need to allow the port as shown

sudo ufw allow 8980/tcp
sudo ufw reload

Step 7: Accessing OpenNMS Horizon from Browser

At this point, we have successfully installed OpenNMS server on Debian 10|9. To access it on the browser, type the url, using either your system IP address or hostname if you configured; http://<your-server-ip>:8980/opennms or http://<your-server-hostname>:8980/opennms. You should see the below page

Access with the default login credentials: username is admin and the password is admin.

Once to login, the first thing you would want to do is to change the default admin password. On the far right of the main navigation menu, click on admin -> change password. Under User Account Self-service, click on change password.

Step 8: Adding a Host in OpenNMS Monitoring

To add a host to monitor, click n the + sign at the far right of the navigation bar. Enter a name for provisioning requisition. I have named Group 1

Next enter the required attributes for the server to be monitored. There are other optional entries which you can fill if you like.

When done, click ‘provision‘ at the bottom of the page. It should tell you that the node has been added successfully

When you go back to home, under ‘Status Overview‘, you should be able to see information about the new node populating.

We have successfully installed OpenNMS Horizon on Debian 10| 9 and have seen how you can quickly add a host to monitor. There is more you can do with OpenNMS to make a powerful monitoring tool that suits your platform. There is a lot of information on OpenNMS official site that can help you with more configuration in order to realize the power of OpenNMS. I hope this guide has been useful in enabling you to install OpenNMS on Debian 10 or 9 and get started with some basic configuration. Enjoy! More useful guides below:

Cart

Your Cart is Empty

Back To Shop