Installing OpenNMS for Network Monitoring on Debian 11

OpenNMS is a robust and open-source Network Management System, which provides extensive tools for monitoring and managing networks. Written in Java, it utilizes the SNMP protocol to collect vital network data and is accessible through a web-based interface, suitable for both Linux and Windows environments. Some notable features include provisioning, service monitoring, event management, charting support, and performance measurement.

In this guide, we’ll walk through the steps to install OpenNMS on a Debian 11 server.

Prerequisites

  • A server running Debian 11.
  • Access to a user account with sudo privileges.

Install Required Dependencies

To begin, make sure your system’s packages are up-to-date by executing the following command:

apt-get update -y

Following the update, install Java and other necessary dependencies by running:

apt-get install default-jdk gnupg2 curl wget -y

You can confirm the Java installation with:

java -version

You should see an output similar to:

openjdk version "11.0.12" 2021-07-20
OpenJDK Runtime Environment (build 11.0.12+7-post-Debian-2)
OpenJDK 64-Bit Server VM (build 11.0.12+7-post-Debian-2, mixed mode, sharing)

Add OpenNMS Repository

The OpenNMS package is not available in the default Debian 11 repository. To add the necessary OpenNMS repository, run:

nano /etc/apt/sources.list.d/opennms.list

Insert the following lines:

deb https://debian.opennms.org stable main
deb-src https://debian.opennms.org stable main

Save the file, then add the GPG key with:

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

Update the package repository cache to reflect these changes:

apt-get update -y

Install OpenNMS on Debian 11

To install OpenNMS, use the command:

apt-get install opennms -y

The installation process will also set up PostgreSQL. Start the PostgreSQL service with:

systemctl start postgresql

Verify PostgreSQL status by executing:

systemctl status postgresql

Create a Database and User for OpenNMS

Access the PostgreSQL shell using:

su - postgres

Create a new user and database for OpenNMS with the following commands:

createuser opennms
psql -c "ALTER USER opennms WITH PASSWORD 'opennms';"
createdb -O opennms opennms

Set a secure password for the Postgres user:

psql -c "ALTER USER postgres WITH PASSWORD 'securepassword';"

Exit the PostgreSQL shell:

exit

Configure OpenNMS

Edit OpenNMS’s data source configuration:

nano /usr/share/opennms/etc/opennms-datasources.xml

Modify the configuration to match your setup:

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

Save and exit the file.

Initialize and Start OpenNMS

Integrate OpenNMS with Java by executing:

/usr/share/opennms/bin/runjava -s

Initialize OpenNMS and the database using:

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

Then, start and enable OpenNMS to run on system startup:

systemctl start opennms
systemctl enable opennms

Check OpenNMS’s status to ensure it’s running:

systemctl status opennms

Verify OpenNMS is listening on port 8980:

ss -antpl | grep 8980

Access OpenNMS Web Interface

Navigate to http://your-server-ip:8980/opennms in your web browser. Log in with the default credentials admin/admin to access the dashboard:

OpenNMS Login

Now you can manage and monitor your network nodes by adding new hosts through the dashboard interface:

OpenNMS Network Monitoring

Conclusion

Congratulations! You’ve successfully set up OpenNMS on your Debian 11 server. Feel free to add more hosts and explore the diverse features this powerful tool offers to streamline your network management.

FAQs

  • What is OpenNMS used for?
    OpenNMS is used for network management and monitoring, helping administrators oversee systems and detect issues with network devices.
  • Can I use OpenNMS on platforms other than Debian?
    Yes, OpenNMS can be installed on various Linux distributions and Windows platforms.
  • What are the minimum system requirements for running OpenNMS?
    The requirements vary based on the network size, but generally, it is advised to have at least 4 GB of RAM and a multi-core processor for optimal performance.
  • Is OpenNMS free?
    Yes, OpenNMS is free and open-source, distributed under the GNU General Public License.