We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

Learn how to – How To Install OpenNMS on Rocky Linux 9 / AlmaLinux 9

Learn how to – How To Install OpenNMS on Rocky Linux 9 / AlmaLinux 9.

The presence of monitoring stacks in an environment is very important. It helps identify the health and performance issues of applications and servers in an infrastructure. This helps identify problems before they occur and send alerts to the response team in time. The commonly used monitoring stacks today are Observium, Dynatrace, New Relic, Zenoss, N-able RMM, PRTG Network Monitor, Datadog Infrastructure Monitoring, Nagios, Prometheus, Zabbix, Elastic Stack e.t.c

OpenNMS is a free and open-source enterprise-grade network monitoring tool. This tool is developed by the OpenNMS Group and a dedicated community of developers and users. It also offers commercial services with training and support. OpenNMS is designed to manage an innumerable number of devices from a single server. The main aim of this project is to be a distributed, scalable management application platform for all the FCAPS network management mode aspects.

OpenNMS is made up of the following components:

  • OpenNMS Horizon with:
    • Core (server that drives Horizon)
    • Minion (distritubed monitoring)
    • Sentinel (scalability)
  • Helm (customized dashboards)
  • Architecture for Learning Enabled Correlation (ALEC) (alarm triage)
  • Provisioning Integration Server (PRIS) (extracted data integration)

OpenNMS provided the following features and benefits:

  • Discovery: finding out the equipment on your network, and adding them to the database
  • Events: receiving, correlating, and sending notifications
  • Data Collection: It collects, stores, and provides reports of various network available data points.
  • Monitoring: it helps keep track of the status of the networked equipment
  • Scalable: It offers massive scalability for data processing. You can monitor tens of thousands of data points via a distributed and tiered system.
  • Extensible: Its event-driven architecture allows the extension of service polling and data collection frameworks and flexible workflow integration. It supports Elasticsearch and LDAP/AD integration.
  • Open Source: OpenNMS is a fully open source solution, published under the AGPLv3 license.

In this tutorial, we will learn how to install and configure OpenNMS on Rocky Linux 9 / AlmaLinux 9.

Step 1 – Update System and Install Java

It is vital to work with an updated server. To update the Rocky Linux 9 / AlmaLinux 9 system, issue the command:

sudo dnf -y update

Also, install the required packages:

sudo dnf install -y vim  curl wget

Since OpenNMS is developed in Java, you need to install it on Rocky Linux 9 / AlmaLinux 9.

sudo dnf install java-11-openjdk-devel -y

Verify the installation.

$ java -version
openjdk version "11.0.16" 2022-07-19 LTS
OpenJDK Runtime Environment (Red_Hat-11.0.16.0.8-1.el9_0) (build 11.0.16+8-LTS)
OpenJDK 64-Bit Server VM (Red_Hat-11.0.16.0.8-1.el9_0) (build 11.0.16+8-LTS, mixed mode, sharing)

Step 2 – Install OpenNMS Horizon

The default Rocky Linux 9 / AlmaLinux 9 repositories do not provide the OpenNMS packages. To be able to install the packages, we need to add the repository to the system.

First, import the GPG key

sudo rpm --import https://yum.opennms.org/OPENNMS-GPG-KEY

Now add the OpenNMS(Rhel-8)repository with the command:

sudo dnf install https://yum.opennms.org/repofiles/opennms-repo-stable-rhel8.noarch.rpm

Once the repository has been added, install OpenNMS with all its dependency packages:

sudo dnf install opennms

Sample Output:

....
Transaction Summary
=====================================================================
Install  9 Packages

Total download size: 632 M
Installed size: 857 M
Is this ok [y/N]: y

The installed dependency packages are:

  • PostgreSQL and postgresql-libs : PostgreSQL database server from distribution repository.
  • opennms-core: to provide OpenNMS Horizon core services, e.g. Provisiond, Pollerd, and Collectd.
  • opennms-webapp-jetty: it provided the OpenNMS Horizon web application services
  • jicmp6 and jicmp: this is the Java bridge that allows sending ICMP messages from the OpenNMS Horizon repository.

Step 3 – Configure PostgreSQL for OpenNMS

Once PostgreSQL has been installed as a dependency, we need to configure it and create the required databases for OpenNMS.

Begin by initializing PostgreSQL:

sudo postgresql-setup --initdb --unit postgresql

Start and enable the PostgreSQL service:

sudo systemctl enable postgresql
sudo systemctl start postgresql

Verify of the service is up:

$ systemctl status postgresql
● postgresql.service - PostgreSQL database server
     Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled; vendor preset: disabled)
     Active: active (running) since Sat 2022-09-10 08:42:58 CEST; 41s ago
    Process: 34318 ExecStartPre=/usr/libexec/postgresql-check-db-dir postgresql (code=exited, status=0/SUCCESS)
   Main PID: 34320 (postmaster)
      Tasks: 8 (limit: 23441)
     Memory: 16.9M
        CPU: 41ms
     CGroup: /system.slice/postgresql.service
             ├─34320 /usr/bin/postmaster -D /var/lib/pgsql/data
             ├─34321 "postgres: logger "
             ├─34323 "postgres: checkpointer "
             ├─34324 "postgres: background writer "
             ├─34325 "postgres: walwriter "
             ├─34326 "postgres: autovacuum launcher "
             ├─34327 "postgres: stats collector "
             └─34328 "postgres: logical replication launcher "

Switch to the postgres user

sudo -i -u postgres

Create a user for OpenNMS as shown:

$ createuser -P opennms
Enter password for new role: Passw0rd1
Enter it again: Passw0rd1

Now create the database with the command:

createdb -O opennms opennms

Also, protect the default user with a password:

$ psql -c "ALTER USER postgres WITH PASSWORD 'StrongPassword';"
ALTER ROLE

Exit the shell:

[postgres@localhost ~]$ exit
logout

Now modify the PostgreSQL access policy:

sudo vim /var/lib/pgsql/data/pg_hba.conf

Modify the lines below by replacing ident with MD5 as shown

# IPv4 local connections:
host    all             all             127.0.0.1/32            md5

# IPv6 local connections:
host    all             all             ::1/128                 md5

Save the file and restart the PostgreSQL service:

sudo systemctl restart postgresql

Now we need to define the database credentials on the OpenNMS config:

sudo vim /opt/opennms/etc/opennms-datasources.xml

Find and make the below adjustments:

<jdbc-data-source name="opennms"
                    database-name="opennms"
                    class-name="org.postgresql.Driver"
                    url="jdbc:postgresql://localhost:5432/opennms"
                    user-name="opennms"
                    password="Passw0rd1" />

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

Remember to replace all the usernames, databases, and passwords as created.

Step 4 – Start OpenNMS on Rocky Linux 9 / AlmaLinux 9

We will initialize by adding the Java settings as shown:

sudo /opt/opennms/bin/runjava -s

Sample 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-11.0.16.0.8-1.el9_0.x86_64/bin/java".
runjava: Value of "/usr/lib/jvm/java-11-openjdk-11.0.16.0.8-1.el9_0.x86_64/bin/java" stored in configuration file.

Next, initialize the database and detect system libraries in /opt/opennms/etc/libraries.properties

sudo /opt/opennms/bin/install -dis

Now start and enable the OpenNMS service:

sudo dnf install chkconfig -y
sudo systemctl enable --now opennms

Check the status of the service:

$ systemctl status opennms
● opennms.service - OpenNMS server
     Loaded: loaded (/usr/lib/systemd/system/opennms.service; enabled; vendor preset: disabled)
     Active: active (running) since Sat 2022-09-10 08:58:34 CEST; 5s ago
    Process: 35909 ExecStart=/opt/opennms/bin/opennms -s start (code=exited, status=0/SUCCESS)
   Main PID: 36871 (java)
      Tasks: 18 (limit: 23441)
     Memory: 130.7M
        CPU: 8.837s
     CGroup: /system.slice/opennms.service
             ├─36870 bash /opt/opennms/bin/opennms -s start
             └─36871 /usr/lib/jvm/java-11-openjdk-11.0.16.0.8-1.el9_0.x86_64/bin/java --add-modules=java.base,java.compiler,java.datatransf

By default, the OpenNMS Horizon listens on port 8980. We need to allow this port through the firewall using the commands:

sudo firewall-cmd --permanent --add-port=8980/tcp
sudo firewall-cmd --reload

Allow the port through SELinux

sudo semanage port -a -t http_port_t -p tcp 8980

Step 5 – Access the OpenNMS WebUI

Using your favorite browser, access the OpenNMS WebUI using the URL http://IP_Address:8980/opennms

Login with the default credentials:

Username: admin
Password: admin

You can now change the password to a preferred one by navigating to admin → Change Password

Step 6 – Add Monitoring Targets on OpenNMS

The hosts to be added to OpenNMS need to have

To be able to monitor systems, we need to add them to OpenNMS. Begin by clicking on the “+“ icon as shown below.

Because this setup is new, we are required to add a requisition. You will see the pop-up below.

Provide the name for the new requisition and click OK. Now you will be granted a form to be filled.

Once the required details have been provided, click Provision

After the node has been added, it will apper under InfoNodes

You can now view graphs and create alerts for the device.

Conclusion

This guide has only provided you with basic knowledge on how to install, configure and get started with OpenNMS on Rocky Linux 9 / AlmaLinux. There are more other features no covered in this guide such as monitoring clients using SNMP, configuring minions to return data to the Horizon using message brokers e.t.c

Interested in more?

Cart

Your Cart is Empty

Back To Shop