There is a new version of this tutorial available for Ubuntu 22.04 (Jammy Jellyfish).

How to Setup OpenNMS Network Monitoring Solution on Ubuntu 20.04 LTS

OpenNMS is a free, open-source, and enterprise-grade network management system used for monitoring unlimited devices from the central location. It works by discovering all devices in the network and monitor services automatically. It is based on Java and designed to monitor critical services on remote machines by using SNMP and JMX. It can be installed on all major operating systems including, Windows, Linux/Unix, Mac and Solaris. It offers a rich set of features including, Provisioning, Service Monitoring, Event Management, Charting support and Performance Measurement.

Currently, OpenNMS is available in two editions Horizon and Meridian. Horizon is designed for monitoring and managing IT environments while the Meridian is designed for companies who are looking for stability and long-term support.

In this tutorial, we will explain how to install OpenNMS with Docker on Ubuntu 20.04.

Prerequisites

  • A server running Ubuntu 20.04.
  • A root password is set up on your server.

Getting Started

Before starting, it is always a good idea to update your system packages to the latest version. You can update them with the following command:

apt-get update -y
apt-get upgrade -y

After updating all packages, install other required dependencies using the following command:

apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common -y

Once all the dependencies are installed, you can proceed to the next step.

Install Docker and Docker Compose

By default, the latest version of Docker is not available in the Ubuntu 20.04 default repository. So it is recommended to install the Docker from Docker's official repository.

First, download and add the GPT key with the following command:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -

Next, add the Docker repository to your system using the following command:

add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

Once the repository is added, install the Docker and Docker compose by running the following command:

apt-get install docker-ce docker-ce-cli containerd.io docker-compose -y

Once both are installed, verify the status of the Docker using the following command:

systemctl status docker

You should get the following output:

? docker.service - Docker Application Container Engine
     Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2020-07-04 04:43:52 UTC; 19s ago
TriggeredBy: ? docker.socket
       Docs: https://docs.docker.com
   Main PID: 38468 (dockerd)
      Tasks: 10
     Memory: 36.3M
     CGroup: /system.slice/docker.service
             ??38468 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

To check the Docker version, run the following command:

docker -v

You should see the following output:

Docker version 19.03.12, build 48a66213fe

To check the Docker compose version, run the following command:

docker-compose -v

You should see the following output:

docker-compose version 1.25.0, build unknown

Install OpenNMS

Next, create a project directory for OpenNMS with the following command:

mkdir opennms

Next, change the directory to opennms and create a new docker-compose.yml file to install OpenNMS.

cd opennms
nano docker-compose.yml

Add the following lines:

version: '3'

volumes:
  data-postgres: {}
  data-opennms: {}

services:
  database:
    image: postgres:12
    container_name: database
    environment:
      - TZ=Europe/Berlin
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
    volumes:
      - data-postgres:/var/lib/postgresql/data
    healthcheck:
      test: [ "CMD-SHELL", "pg_isready -U postgres" ]
      interval: 10s
      timeout: 30s
      retries: 3

  horizon:
    image: opennms/horizon:26.1.1
    container_name: horizon
    environment:
      - TZ=Europe/Berlin
      - POSTGRES_HOST=database
      - POSTGRES_PORT=5432
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
      - OPENNMS_DBNAME=opennms
      - OPENNMS_DBUSER=opennms
      - OPENNMS_DBPASS=opennms
    volumes:
      - data-opennms:/opt/opennms/share/rrd
      - ./overlay:/opt/opennms-overlay
    command: ["-s"]
    ports:
      - "8980:8980/tcp"
      - "8101:8101/tcp"
      - "61616:61616/tcp"
    healthcheck:
      test: [ "CMD", "curl", "-f", "-I", "http://localhost:8980/opennms/login.jsp" ]
      interval: 1m
      timeout: 5s
      retries: 3

Save and close the file when you are finished. Then, download and build the container for OpenNMS with the following command:

docker-compose up -d

Once the OpenNMS container is downloaded, you can verify the running container with the following command:

docker ps -a

You should see the following output:

CONTAINER ID        IMAGE                    COMMAND                  CREATED             STATUS                            PORTS                                                                                           NAMES
1537b3a43c92        postgres:12              "docker-entrypoint.s…"   9 seconds ago       Up 6 seconds (health: starting)   5432/tcp                                                                                        database
7e00f3877d13        opennms/horizon:26.1.1   "/entrypoint.sh -s"      9 seconds ago       Up 6 seconds (health: starting)   0.0.0.0:8101->8101/tcp, 1162/udp, 0.0.0.0:8980->8980/tcp, 10514/udp, 0.0.0.0:61616->61616/tcp   horizon

Access OpenNMS Web Interface

At this point, OpenNMS is running and listening on port 8980. You can access it using the URL http://your-server-ip:8980. You will be redirected to the OpenNMS login page as shown below:

OpenNMS Web Interface

Provide the default username and password as admin/admin and click on the Login button. You should see the OpenNMS dashboard in the following screen:

OpenNMS Dashboard

Now, click on the + icon on the right pane to add new server node for monitoring. You should see the following screen:

Add Node to OpenNMS

Provide a name and click on the OK button. You should see the following screen:

Node attributes

Node Authentication settings

Now, provide the IP address of the server that you want to monitor, community string, username and password of the server, Access method and click on the Provision button. Once the provision is success, you should see the following screen:

Successfully provisioned a node

Click on the OK button to continue, then go to Info => Nodes, you should see the client1 node status, notification, and events in the following screen:

OpenNMS Server Monitoring

Conclusion

Congratulations! you have successfully installed OpenNMS on Ubuntu 20.04 server. You can now add more devices to OpenNMS and start monitoring through the web browser. Feel free to ask me if you have any questions.

Share this page:

4 Comment(s)