Full and Easy Steps to Set up OpenNMS on Debian 11

Posted on

Full and Easy Steps to Set up OpenNMS on Debian 11

Full and Easy Steps to Set up OpenNMS on Debian 11

In this guide, we want to teach you to Set up OpenNMS on Debian 11. OpenNMS provides a highly reliable, scalable, and comprehensive fault, performance, and traffic monitoring solution that easily integrates with business applications and workflows to monitor and visualize everything in a network. The OpenNMS platform monitors some of the largest networks in existence, covering the healthcare, technology, finance, government, education, retail, and industrial sectors, many with tens of thousands of networked devices.

There are two types of OpenNMSMeridian and Horizon. When we need stability and long-term support, choose Meridian, which is best for enterprises and businesses. Horizon is used where innovation occurs frequently. It is best for IT-ecosystem and new technologies monitoring.

Now follow the guide steps below on the Orcacore website to complete OpenNMS Horizon on Debian 11.

To Set up OpenNMS on Debian 11, log in to your server as a non-root user with sudo privileges and set up a basic firewall. To do this, you can follow our guide on Initial Server Setup with Debian 11.

1. Install Java on Debian 11

Because OpenNMS is written in Java, you must install Java on your server. First, run the system update:

sudo apt update

Now use the command below to install Java on Debian 11:

sudo apt install default-jdk -y

Verify your Java installation by checking its version:

java -version
**<mark>Output</mark>**
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)

Set Java Environment Variables

At this point, you need to set the Java home path by using the command below:

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

Then, source the /etc/profile file:

sudo source /etc/profile

2. Set up OpenNMS Horizon on Debian 11

The OpenNMS packages aren’t available in the default Debian repository. So you need to add it manually.

Import OpenNMS GPG Key

At this point, you need to use the following command to import the OpenNMS GPG key:

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

Add OpenNMS Repository

Then, you need to add the OpenNMS repo to your server by using the command below:

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

Install OpenNMS on Debian

Now you can easily use the command below to install and Set up OpenNMS on Debian 11:

# sudo apt update
# sudo apt -y install opennms

This will install all the dependencies on your server.

3. Configure PostgreSQL for OpenNMS on Debian 11

When your dependencies and OpenNMS are installed on your server, you need to configure PostgreSQL.

First, verify your PostgreSQL is active and running on Debian 11:

sudo systemctl status postgresql
**<mark>Output</mark>**
● postgresql.service - PostgreSQL RDBMS
     Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor pr>
     Active: **<mark>active</mark>** (**<mark>exited</mark>**) since Mon 2023-03-06 13:35:35 EST; 54s ago
   Main PID: 7704 (code=exited, status=0/SUCCESS)
      Tasks: 0 (limit: 4679)
     Memory: 0B
        CPU: 0
     CGroup: /system.slice/postgresql.service
...

Next, switch to your PostgreSQL user:

sudo su - postgres

Create OpenNMS Database and User

At this point, use the following command to create an OpenNMS user:

createuser -P <mark>opennms</mark>
Enter password for new role:
Enter it again:

Then, create the OpenNMS database on Debian 11 by using the command below:

createdb -O <mark>opennms opennms</mark>

Next, protect the default user with a password:

psql -c "ALTER USER <mark>postgres</mark> WITH PASSWORD '<mark>StrongPassword</mark>';"
**<mark>Output</mark>**
ALTER ROLE

Exit the PostgreSQL shell:

[postgres@localhost ~]$ exit

Define database credentials in OpenNMS Config File

At this point, you need to define the database credentials in the OpenNMS config file. Open the file with your favorite text editor, here we use the vi editor:

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

Find the lines below and define your database credentials:

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

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

When you are done, save and close the file.

4. Manage OpenNMS Service on Debian 11

First, you need to initialize OpenNMS by adding the Java settings:

sudo /usr/share/opennms/bin/runjava -s
**<mark>Output</mark>**
runjava: Looking for an appropriate JVM...
runjava: Checking for an appropriate JVM in JAVA_HOME...
runjava: Found: "/usr/lib/jvm/java-1.11.0-openjdk-amd64/bin/java" is an appropriate JVM.
runjava: Value of "/usr/lib/jvm/java-1.11.0-openjdk-amd64/bin/java" stored in configuration file.

Next, initialize the database and detect system libraries in the /usr/share/opennms/bin/install directory:

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

At this point, you can use the following commands to start and enable your OpenNMS service:

# sudo systemctl start opennms
# sudo systemctl enable opennms

Verify your OpenNMS service is active and running on Debian 11:

sudo systemctl status opennms
**<mark>Output</mark>**
● opennms.service - OpenNMS server
     Loaded: loaded (/lib/systemd/system/opennms.service; enabled; vendor prese>
     Active: **<mark>active</mark>** (**<mark>running</mark>**) since Mon 2023-03-06 13:42:29 EST; 10s ago
   Main PID: 12875 (java)
      Tasks: 130 (limit: 4679)
     Memory: 446.2M
        CPU: 34.477s
     CGroup: /system.slice/opennms.service
             └─12874 bash /usr/share/opennms/bin/opennms -s start
             └─12875 /usr/lib/jvm/java-1.11.0-openjdk-amd64/bin/java --add-modu>
...

5. Configure Firewall For OpenNMS

Here we assumed that you have enabled UFW. By default, OpenNMS is listening on port 8980. You have to allow this port through the firewall using the following command:

sudo ufw allow 8980/tcp

Reload the firewall to apply the changes:

sudo ufw reload

6. Access OpenNMS Web Interface

At this point, you have learned to Set up OpenNMS on Debian 11. Now you can access OpenNMS Horizon through the Web interface on Debian 11 by typing your server’s IP address in your web browser followed by 8980/opennms:

http://<mark>your-server-ip</mark>:8980/opennms

You will see the OpenNMS horizon login screen. Enter admin as the username and password and click Login.

OpenNMS Login
OpenNMS Login

Then, you should see the OpenNMS Horizon dashboard on Debian 11.

OpenNMS Dashboard Ubuntu 22.04
OpenNMS Dashboard

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

Change default Admin Password OpenNMS
Change default Admin Password
Add New Admin Password for OpenNMS
Add New Admin Password

6. How To Monitor Systems with OpenNMS?

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

Add node to OpenNMS
Add node

Enter the required details such as requisition, IP Address, and Node Label, and click Provision.

OpenNMS Node Credentials Debian 11
Node Credentials

After the node has been added, it will appear under InfoNodes.

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

Monitor Devices with OpenNMS Debian 11
Monitor Devices

For more information, you can visit OpenNMS Documentation.

Conclusion

At this point, you have learned to Set up OpenNMS on Debian 11. You can easily monitor and visualize everything in a network with OpenNMS. The guide provides full and easy steps to Set up OpenNMS on Debian 11.

Hope you enjoy it. You may also like these articles:

How To Install OpenSSL 3 on Debian 11

Install and Use Yarn on Debian 11

Monitorix configuration on Debian 11

Samba File Share Setup on Debian 11

Access PowerAdmin Dashboard on Debian 11

Fix add-apt-repository Error

Alternative Solutions for Network Monitoring on Debian 11

While OpenNMS is a robust and comprehensive solution, several other tools can achieve similar network monitoring goals on Debian 11. Here are two alternative approaches:

1. Using Zabbix for Network Monitoring:

Zabbix is another open-source monitoring solution that offers similar functionality to OpenNMS, but with a potentially different learning curve and feature set. Zabbix excels at monitoring servers, virtual machines, applications, services, databases, and websites.

Explanation:

Zabbix uses agents installed on the monitored hosts to collect data, or it can retrieve data remotely via protocols like SNMP, SSH, or HTTP. It provides a web-based interface for configuration, data visualization (graphs, dashboards), and alerting. Zabbix is highly customizable and scalable.

Steps to Install and Configure Zabbix Agent on Debian 11:

  • Install Zabbix Agent: First, add the Zabbix repository to your Debian system and install the Zabbix agent.

    wget https://repo.zabbix.com/zabbix/6.0/debian/pool/main/z/zabbix-release/zabbix-release_6.0-1+debian11_all.deb
    sudo dpkg -i zabbix-release_6.0-1+debian11_all.deb
    sudo apt update
    sudo apt install zabbix-agent
  • Configure Zabbix Agent: Edit the Zabbix agent configuration file (/etc/zabbix/zabbix_agentd.conf) to specify the Zabbix server’s IP address.

    sudo vi /etc/zabbix/zabbix_agentd.conf

    Find and modify the Server= and ServerActive= directives to point to the IP address of your Zabbix server.

    Server=YOUR_ZABBIX_SERVER_IP
    ServerActive=YOUR_ZABBIX_SERVER_IP

    Optionally, configure the Hostname= directive to a descriptive name for the monitored host.

  • Restart Zabbix Agent: Restart the Zabbix agent service to apply the changes.

    sudo systemctl restart zabbix-agent
    sudo systemctl enable zabbix-agent
  • Configure Zabbix Server: On the Zabbix server, add the host (Debian 11 server) to the Zabbix configuration through the web interface. You’ll need to specify the agent’s IP address and choose appropriate templates for monitoring (e.g., "Template OS Linux").

2. Using Prometheus and Grafana for Monitoring:

Prometheus is a time-series database and monitoring system, while Grafana is a data visualization tool. This combination offers a powerful and flexible way to monitor various aspects of your Debian 11 system.

Explanation:

Prometheus collects metrics from monitored targets (servers, applications, etc.) by scraping HTTP endpoints. Grafana then visualizes the data stored in Prometheus, allowing you to create dashboards and alerts. This solution is well-suited for monitoring containerized environments and applications.

Steps to Install and Configure Prometheus and Node Exporter on Debian 11 (for basic server metrics):

  • Install Prometheus: Download and extract the latest Prometheus release.

    wget https://github.com/prometheus/prometheus/releases/download/v2.45.0/prometheus-2.45.0.linux-amd64.tar.gz
    tar xvf prometheus-2.45.0.linux-amd64.tar.gz
    sudo mv prometheus-2.45.0.linux-amd64 /opt/prometheus
  • Configure Prometheus: Create a prometheus.yml configuration file. A basic configuration might look like this:

    global:
      scrape_interval:     15s
    
    scrape_configs:
      - job_name: 'prometheus'
        static_configs:
          - targets: ['localhost:9090']
    
      - job_name: 'node_exporter'
        static_configs:
          - targets: ['localhost:9100']
  • Install Node Exporter: Node Exporter exposes system metrics in a format that Prometheus can scrape.

    wget https://github.com/prometheus/node_exporter/releases/download/v1.6.1/node_exporter-1.6.1.linux-amd64.tar.gz
    tar xvf node_exporter-1.6.1.linux-amd64.tar.gz
    sudo mv node_exporter-1.6.1.linux-amd64 /opt/node_exporter
  • Run Prometheus and Node Exporter:

    sudo /opt/prometheus/prometheus --config.file=/opt/prometheus/prometheus.yml &
    sudo /opt/node_exporter/node_exporter &
  • Install Grafana:

    sudo apt update
    sudo apt install -y apt-transport-https software-properties-common wget
    wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add -
    echo "deb https://packages.grafana.com/enterprise/deb stable main" | sudo tee /etc/apt/sources.list.d/grafana.list
    sudo apt update
    sudo apt install grafana
    sudo systemctl start grafana-server
    sudo systemctl enable grafana-server
  • Configure Grafana: Access the Grafana web interface (usually on port 3000), add Prometheus as a data source, and import or create dashboards to visualize the metrics. There are many pre-built dashboards for Node Exporter available on the Grafana website.

These alternative solutions offer different strengths and trade-offs. Zabbix is an all-in-one solution that’s relatively easy to set up, while Prometheus and Grafana provide more flexibility and are better suited for complex monitoring scenarios, especially in cloud-native environments. Choosing the right tool depends on your specific needs and technical expertise.

Leave a Reply

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