@JS's Notes

Site with notes from my work.

OpenNMS network monitoring solution on Ubuntu 20.04

2020-07-17 System @JS

My test platform: Ubuntu Server 20.04

Requirements: user with root privileges or non-root user with sudo privileges.

Docker and Docker Compose installation
$ sudo apt update; sudo apt upgrade -y
$ sudo apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common tree -y
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
$ sudo apt install docker-ce docker-ce-cli containerd.io docker-compose -y
$ systemctl status docker
$ docker -v
$ docker-compose -v
$ mkdir -p projects/opennms
$ cd projects/opennms
$ touch docker-compose.yml

Add the following lines to docker-compose.yml:

version: '3'

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

services:
  database:
    image: postgres:12
    container_name: database
    environment:
      - TZ=Europe/Warsaw
      - 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/Warsaw
      - 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

Download and build the container for OpenNMS:

$ sudo docker-compose up -d
## verify the running container
$ sudo docker ps -a
OpenNMS web interface

OpenNMS is running and listening on port 8980. You can access it using the URL http://server-ip:8980. Provide the default username and password as admin/admin and click on the Login button.