Install and configure OpenNMS on CentOS 8

You can download this article in PDF format via the link below to support us. Download the guide in PDF formatClose

The birth of OpenNMS stems from the frustration of its creators about the expensive, inflexible and difficult to deploy existing network management tools. In addition, they observed how customers changed their business processes to adapt to existing tools, not the other way around. This motivated them to create OpenNMS.

OpenNMS is the world’s first fully open source enterprise-level network service management platform. Hundreds of companies use it every day without team help. This is how easy the OpenNMS team makes it to use. As a true open source, it is 100% free.

Unlike traditional network management products that focus on network elements such as interfaces on switches and routers, OpenNMS focuses on the services provided by network resources: web pages, database access, DNS, DHCP, etc. (although information about network elements is also provided).

We will install and configure this excellent tool and check what it can do. Before that, let’s take a look at the hidden content of its package.

Features of OpenNMS

The following are the core functions of OpenNMS:

  • Scalability: It is built for enterprises and can monitor millions of devices from a single instance.
  • Scalability: Use a flexible and scalable architecture to extend the service polling and performance data collection framework
  • Open source: OpenNMS is released under the AGPLv3 license and is a completely open source solution.
  • stand by: Get the support of the majority of users, and provide commercial support by The OpenNMS Group

Now, we should be ready to explore OpenNMS on CentOS 8 machines.

Step 1: Update and prepare our server

Before delving into the deeper content of this setting, it’s best to choose a clean and well-updated platform. Throughout the process, we will update and install the necessary tools required.

sudo dnf -y update
sudo dnf install -y vim  curl wget

OpenNMS is developed using Java, so we need to install Java. Install Java on CentOS 8 using how to set up Java 11-OpenJDK 11- on RHEL 8. CentOS 8 guide

Step 2: Install OpenNMS Horizon​​n

After covering the base layer and ensuring that we are ready to welcome the upcoming package, we can proceed to install OpenNMS Horizon​​n. We will first add the official OpenNMS repository, and then proceed to obtain and install the necessary packages.

Add yum repository and import GPG key

sudo dnf -y install
sudo rpm --import

After adding the repository, we can use all its built-in dependencies to pull and install OpenNMS

sudo dnf -y install opennms

The above command will automatically install the following packages to make work easier:

  • jicmp6 and jicmp: Java bridges that allow sending ICMP messages from the OpenNMS Horizon repository.
  • opennms-core: OpenNMS Horizon core services, for example, provisioning, polling and collecting from the OpenNMS Horizon repository.
  • opennms-webapp-jetty: OpenNMS Horizon web application from the OpenNMS Horizon repository
  • PostgreSQL: PostgreSQL database server in the release repository
  • postgresql-libs: PostgreSQL database in the release library

Step 3: Initialize and set up PostgreSQL

We have already mentioned that the Postgres database will be installed automatically in the previous command. Now, we should use the relevant database, configure it with credentials, and make sure it runs properly.

Initialize the PostgreSQL database

First let us initialize the database by running the following command

sudo postgresql-setup --initdb --unit postgresql

To make PostgreSQL start automatically when the server restarts, run the following Systemd command to enable the database server and start it.

sudo systemctl enable postgresql
sudo systemctl start postgresql

Create database credentials

We will need a user to access the OpenNMS database. Create a user with a password and create an opennms database owned by the user opennms

$ sudo su postgres
bash-4.4$ psql
psql (10.14)
Type "help" for help.

postgres=# createuser -P opennms
postgres-# createdb -O opennms opennms
postgres-# q
bash-4.4$ exit

Use a password to protect the default postres user to increase security, as shown below:

$ sudo su postgres
bash-4.4$ psql
postgres=# ALTER USER postgres WITH PASSWORD 'StrongPassword';
postgres=# q
bash-4.4$ exit

Change the PostgreSQL access policy

When installing Postgres, ident is the default method for local IPv6 and IPv4 connections. The way the authentication method works is to get the client’s operating system username from the ident server and use it as the allowed database username (with optional username mapping). This function is only supported on TCP/IP connections. Password-based authentication methods are “md5” and “password”. Except for the way of sending the password through the connection (MD5 hash and plaintext respectively), the operation of these methods is similar.

We will change it from ident to MD5 hash method. Edit the file shown below accordingly

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

Allow OpenNMS Horizon to use MD5 hash password to access the database through the local network

host    all             all               md5 #<==
host    all             all             ::1/128                 md5

After making changes, restart postgres to apply and persist PostgreSQL configuration changes

sudo systemctl restart postgresql

Configure database access to OpenNMS Horizon

We have configured the database and should now allow OpenNMS Horizon to connect freely. Edit the opennms-datasources.xml file as shown below to view the required configuration. Basically add the database details that we have set up.

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

<jdbc-data-source name="opennms"
                    password="opennms" />

<jdbc-data-source name="opennms-admin"
                    password="StrongPassword" />

The details on the screenshot are the same

Step 4: Initialize and start OpenNMS Horizon​​n

After completing the database settings, we can finally initialize OpenNMS Horizon. Let’s add Java settings and then proceed to launch the application.

Detect the Java environment and save it in /opt/opennms/etc/java.conf

sudo /opt/opennms/bin/runjava -s

Initialize the database and check the system libraries stored in /opt/opennms/etc/

sudo /opt/opennms/bin/install -dis

Enable OpenNMS Horizon to start automatically when the system boots

$ sudo systemctl enable --now opennms
$ sudo systemctl status opennms

● opennms.service - OpenNMS server
   Loaded: loaded (/usr/lib/systemd/system/opennms.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2020-09-23 13:44:38 UTC; 5s ago
  Process: 1689425 ExecStart=/etc/init.d/opennms -s start (code=exited, status=0/SUCCESS)
 Main PID: 1690701 (java)
    Tasks: 36 (limit: 11070)
   Memory: 162.8M
   CGroup: /system.slice/opennms.service
           ├─1690700 /bin/bash /etc/init.d/opennms -s start
           └─1690701 /usr/lib/jvm/java-11-openjdk- --add-modules=java.base,java.compiler

Since OpenNMS Horizon listens on port 8980, if you are running a firewall, you should consider allowing traffic to and from that port on the firewall. Just run the following command.

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

Step 5: Log in and change the default password

After starting OpenNMS, you can access the web application by pointing your browser to http://[IP-or-FQDN-of-your-server]: 8980/opennms. The default login user is administrator And initialize the password to administrator.

Install and configure OpenNMS on CentOS 8

After logging in, you can change your password as follows: In the main navigation menu, click “Administrator→Change Password→Change Password“. Set to the current password admin and set a new password, then confirm the newly set password, and then click “Submit”. When finished, log out and log in with the new password.

Step 6: Add a host in OpenNMS

We have completed the setup of OpenNMS Horizon, the only thing left is to add hosts for us to monitor. To add a host, log in to your OpenNMS Web console, and then perform the following operations on the main navigation menu: Click “+“.

Install and configure OpenNMS on CentOS 8

Since this is a brand new setting, we need to add an “requisition“. You will see a pop-up window asking you to enter a new “requisition“.

Install and configure OpenNMS on CentOS 8

The new page with the form will look like this. Fill out the form, then scroll to the bottom of the page and click “Stipulate“.

Install and configure OpenNMS on CentOS 8

After you click “Prepare” to complete, a success message should pop up.

Install and configure OpenNMS on CentOS 8

After adding a node, you can click “information” Drop-down menu and select “Number of nodes“. You should be able to see the node we just added and some details that it has decrypted.

Install and configure OpenNMS on CentOS 8

in conclusion

The functionality provided by OpenNMS is beyond the scope of this guide. You can monitor the client through SNMP, configure the minion to return data to the main Horizon through the message agent, etc. We will introduce how to install Minion using Apache Kafka in a future guide. For now, we will continue to thank you for your unremitting support. For more monitoring guidelines, please check the following:

Install and configure Icinga2 monitoring tool on Ubuntu

Set up Sensu Go monitoring tool on CentOS 8 / RHEL 8

Use Nginx to install Cacti Monitoring Server on Debian 10 (Buster)

You can download this article in PDF format via the link below to support us. Download the guide in PDF formatClose