Install OpenNMS on Debian 12 Bookworm | Powerful Monitoring Service

Posted on

Install OpenNMS on Debian 12 Bookworm | Powerful Monitoring Service

Install OpenNMS on Debian 12 Bookworm | Powerful Monitoring Service

This tutorial provides a comprehensive guide on how to Install OpenNMS on Debian 12 Bookworm. OpenNMS is a robust, scalable, and comprehensive open-source network monitoring solution. It offers fault, performance, and traffic monitoring capabilities, making it an invaluable tool for network administrators.

There are two primary versions of OpenNMS:

  • Meridian: Designed for stability and long-term support, Meridian is the ideal choice for enterprises and businesses seeking a reliable monitoring platform.
  • Horizon: Focused on frequent innovation and early adoption of new technologies, Horizon is best suited for monitoring evolving IT ecosystems and cutting-edge technologies.

This guide focuses on installing OpenNMS Horizon. Follow these steps to get a full installation and configuration of this tool on your server.

What are the requirements for OpenNMS?

Before you Install OpenNMS on Debian 12 Bookworm, ensure you meet the following prerequisites:

  1. User with Sudo Privileges: You must be logged in to your server as a non-root user with sudo privileges. Follow the guide on Initial Server Setup with Debian 12 Bookworm for this purpose.
  2. Java JDK Installation: Java JDK must be installed on your server, and the JAVA_HOME environment variable should be configured correctly. Check the guide on Install Java with APT on Debian 12 for detailed instructions.
  3. Basic Firewall Setup: A basic firewall should be configured and enabled. This is usually handled during the initial server setup.

Other dependencies will be installed during the OpenNMS installation process.

Now, let’s proceed with the steps to Install OpenNMS on Debian 12 Bookworm.

Step 1 – Verify Java Installation on Debian 12

Verify your Java installation by checking the Java version:

java -version
**<mark>Output</mark>**
openjdk version "17.0.7" 2023-04-18
OpenJDK Runtime Environment (build 17.0.7+7-Debian-1deb12u1)
OpenJDK 64-Bit Server VM (build 17.0.7+7-Debian-1deb12u1, mixed mode, sharing)

Verify your JAVA_HOME environment variable path:

echo $JAVA_HOME
**<mark>Output</mark>**
/usr/lib/jvm/java-17-openjdk-amd64

Step 2 – Install OpenNMS Horizon on Debian 12 Bookworm

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

Import OpenNMS GPG Key on Debian

Import the OpenNMS GPG key using the following command:

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

Add OpenNMS Repository on Debian

Add the OpenNMS repository to your server:

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, install OpenNMS using the following commands:

# sudo apt update
# sudo apt -y install opennms

This will install all necessary dependencies, including PostgreSQL, on your server.

Step 3 – Configure PostgreSQL for OpenNMS on Debian 12

After the installation, configure PostgreSQL.

First, verify PostgreSQL is active and running:

sudo systemctl status postgresql
**<mark>Output</mark>**
● postgresql.service - PostgreSQL RDBMS
     Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; preset: e>
     Active: **<mark>active</mark>** (**<mark>exited</mark>**) since Sun 2023-07-09 04:07:47 EDT; 14s ago
   Main PID: 7441 (code=exited, status=0/SUCCESS)
...

Next, switch to the PostgreSQL user:

sudo su - postgres

Create OpenNMS Database and User

Create an OpenNMS user:

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

Create the OpenNMS database:

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

Protect the default PostgreSQL user with a password:

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

Exit the PostgreSQL shell:

[postgres@localhost ~]$ exit

Define database credentials in OpenNMS Config File

Define the database credentials in the OpenNMS configuration file:

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

Find the following lines and update them with your database credentials:

&lt;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>" /&gt;

&lt;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>" /&gt;
&lt;/datasource-configuration&gt;

Save and close the file.

Step 4 – Manage OpenNMS Service on Debian 12

First, initialize OpenNMS by adding the Java settings:

sudo /usr/share/opennms/bin/runjava -s
**<strong><strong><mark>Output</mark></strong></strong></strong>
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: "/usr/lib/jvm/java-17-openjdk-amd64/bin/java"   ...
runjava: Found an appropriate JVM in the PATH: "/usr/lib/jvm/java-17-openjdk-amd   64/bin/java"
runjava: Value of "/usr/lib/jvm/java-17-openjdk-amd64/bin/java" stored in config   uration file.

Next, initialize the database and detect system libraries:

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

Start and Enable OpenNMS on Debian 12

Start and enable the OpenNMS service:

# sudo systemctl start opennms
# sudo systemctl enable opennms

Verify the OpenNMS service is active and running:

sudo systemctl status opennms
**<strong><strong><strong><mark>Output</mark></strong></strong></strong></strong>
● opennms.service - OpenNMS server
     Loaded: loaded (/lib/systemd/system/opennms.service; enabled; preset: enabled)
     Active: **<mark>active</mark>** (**<mark>running</mark>**) since Sun 2023-07-09 04:16:55 EDT; 11s ago
   Main PID: 9593 (java)
      Tasks: 48 (limit: 4653)
     Memory: 339.2M
        CPU: 36.481s
     CGroup: /system.slice/opennms.service
             └─9592 bash /usr/share/opennms/bin/opennms -s start
             └─9593 /usr/lib/jvm/java-17-openjdk-amd64/bin/java -D_OPENNMS_LAUNCH
...

Step 5 – What is the Default OpenNMS Port?

If you have UFW enabled, allow traffic on port 8980:

sudo ufw allow 8980/tcp

Reload the firewall:

sudo ufw reload

Step 6 – How To Access OpenNMS Horizon Dashboard?

Access the OpenNMS Horizon web interface by navigating to:

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

Log in with the default credentials: username admin and password admin.

OpenNMS Login
Install OpenNMS on Debian 12 Bookworm: OpenNMS Login

You should now see the OpenNMS Horizon dashboard.

OpenNMS Dashboard Debian 12
Install OpenNMS on Debian 12 Bookworm: OpenNMS Dashboard

Step 7 – How To Change OpenNMS Admin Password?

Change the default password by navigating to admin -> Change Password.

Change default Admin Password OpenNMS
Install OpenNMS on Debian 12 Bookworm: Change default Admin Password
Add New Admin Password for OpenNMS
Install OpenNMS on Debian 12 Bookworm: Add New Admin Password

Step 8 – How To Monitor Systems with OpenNMS?

Add systems to OpenNMS for monitoring by clicking the "+" icon.

Add node to OpenNMS
Install OpenNMS on Debian 12 Bookworm: Add node

Enter the requisition name, IP address, and node label, then click "Provision".

OpenNMS Node Credentials Debian 12
Install OpenNMS on Debian 12 Bookworm: Node Credentials

The added node will appear under "Info -> Nodes".

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

Monitor Devices with OpenNMS Debian 12
Install OpenNMS on Debian 12 Bookworm: Monitor Devices

For more information, you can visit OpenNMS Documentation.

Conclusion

You have now learned how to Install OpenNMS Horizon Monitoring Service on Debian 12 Bookworm. You also know how to access the OpenNMS horizon dashboard, change your admin password, and start monitoring systems. This process enables you to effectively monitor your network infrastructure using OpenNMS on Debian 12 Bookworm.

Here are some other articles you may find helpful:

Set Up ZFS on Debian 12 Bookworm

Configure NTP Server and Client on Debian 12 Bookworm

Install Docker Compose on Debian 12 Bookworm

Alternative Solutions for Network Monitoring on Debian 12 Bookworm

While OpenNMS is a powerful solution, several alternative network monitoring tools can be used on Debian 12 Bookworm. Here are two options:

1. Zabbix

Zabbix is another open-source monitoring solution that offers a wide range of features, including network, server, and application monitoring. It’s known for its flexibility and scalability.

Explanation:

Zabbix uses agents installed on monitored hosts to collect data, but it can also monitor devices without agents using protocols like SNMP, SSH, and Telnet. It provides real-time monitoring, alerting, and visualization through a web-based interface.

Installation Steps:

  1. Install Zabbix Server:

    Add the Zabbix repository:

    wget https://repo.zabbix.com/zabbix/6.4/debian/pool/main/z/zabbix-release/zabbix-release_6.4-1+debian12_all.deb
    sudo dpkg -i zabbix-release_6.4-1+debian12_all.deb
    sudo apt update

    Install Zabbix server, frontend, and agent:

    sudo apt install zabbix-server-pgsql zabbix-frontend-php zabbix-apache-conf zabbix-agent
  2. Configure Database:

    Create a Zabbix database:

    sudo -u postgres createuser --superuser zabbix
    sudo -u postgres createdb -O zabbix zabbix

    Import the initial schema and data:

    zcat /usr/share/doc/zabbix-server-pgsql/create.sql.gz | sudo -u zabbix psql zabbix
  3. Configure Zabbix Server:

    Edit /etc/zabbix/zabbix_server.conf and set the database credentials:

    DBHost=localhost
    DBName=zabbix
    DBUser=zabbix
    DBPassword=your_zabbix_db_password
  4. Configure Apache:

    Edit /etc/zabbix/apache.conf and adjust the timezone.
    Restart Apache and Zabbix server:

    sudo systemctl restart apache2
    sudo systemctl restart zabbix-server
    sudo systemctl enable zabbix-server
    sudo systemctl enable zabbix-agent
  5. Access the Zabbix Frontend:

    Open your web browser and navigate to http://your-server-ip/zabbix. The default credentials are Admin (username) and zabbix (password).

2. Prometheus and Grafana

Prometheus is a popular open-source monitoring solution particularly well-suited for monitoring dynamic, containerized environments. Grafana is used for visualizing the data collected by Prometheus.

Explanation:

Prometheus collects metrics by scraping HTTP endpoints on monitored targets. It stores the data as time series. Grafana provides a powerful dashboarding and visualization interface to analyze these metrics.

Installation Steps:

  1. Install Prometheus:

    Download Prometheus:

    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

    Create a Prometheus user and group:

    sudo groupadd prometheus
    sudo useradd -g prometheus --shell /usr/sbin/nologin prometheus
    sudo chown -R prometheus:prometheus /opt/prometheus

    Create a systemd service file:

    sudo vi /etc/systemd/system/prometheus.service

    Add the following content:

    [Unit]
    Description=Prometheus
    Wants=network-online.target
    After=network-online.target
    
    [Service]
    User=prometheus
    Group=prometheus
    Type=simple
    ExecStart=/opt/prometheus/prometheus 
        --config.file=/opt/prometheus/prometheus.yml 
        --storage.tsdb.path=/opt/prometheus/data/
    Restart=on-failure
    
    [Install]
    WantedBy=multi-user.target

    Start and enable Prometheus:

    sudo systemctl start prometheus
    sudo systemctl enable prometheus
    sudo systemctl status prometheus
  2. Install Grafana:

    Add the Grafana repository:

    sudo apt-get install -y apt-transport-https
    sudo apt-get install -y software-properties-common
    wget -q -O - https://apt.grafana.com/gpg.key | sudo apt-key add -
    echo "deb https://apt.grafana.com stable main" | sudo tee /etc/apt/sources.list.d/grafana.list

    Install Grafana:

    sudo apt update
    sudo apt install grafana

    Start and enable Grafana:

    sudo systemctl start grafana-server
    sudo systemctl enable grafana-server
    sudo systemctl status grafana-server
  3. Configure Grafana:

    Access Grafana via http://your-server-ip:3000. The default credentials are admin (username) and admin (password).

    Add Prometheus as a data source in Grafana by navigating to Configuration -> Data Sources and selecting Prometheus. Configure the URL to point to your Prometheus server (http://localhost:9090 if Prometheus is running on the same machine).

These alternative solutions offer different strengths and may be more suitable depending on your specific monitoring needs and environment. Each provides robust monitoring capabilities for Debian 12 Bookworm.

Leave a Reply

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