Restore OpenNMS Horizon

This section describes a basic restore process for a default OpenNMS Horizon installation. OpenNMS Horizon binaries, logs, RRD archives, configurations and the database will be restored.

The backup storage path in this example is /tmp for demonstration purposes. Please be aware that /tmp is not persisted, as most operating systems will delete the content at bootup.

Objectives

  • Restore your backup of OpenNMS Horizon components.

  • Install a PostgreSQL database and restore your backup.

  • Install OpenJDK.

  • Create a systemd OpenNMS service unit.

Requirements

  • Backup files you created in Debian Ubuntu.

  • A system user with administrative permissions (sudo).

  • Internet access to download and install OpenJDK and PostgreSQL.

    The PostgreSQL archive repository also hosts older versions.
  • Database password for opennms and postgres user.

Restore backups

  • CentOS/RHEL 8

  • Debian/Ubuntu

Restore user/group definition
sudo cat /tmp/opennms-passwd.txt >> /etc/passwd && \
sudo cat /tmp/opennms-group.txt >> /etc/group
Create log folder
sudo mkdir /var/log/opennms && \
chown opennms. /var/log/opennms
Restore OpenNMS Horizon binaries, RRD archives, configurations
sudo tar -xzf /tmp/opennms-opt.tar.gz -C / && \
sudo tar -xzf /tmp/opennms-var.tar.gz -C /
Create OpenNMS systemd unit
sudo cp /opt/opennms/etc/opennms.service /lib/systemd/system/
Assign CAP_NET_RAW capabilities

See Assign CAP_NET_RAW capabilities.

Install PostgreSQL database
sudo dnf -y install postgresql-server postgresql
Change the access policy for PostgreSQL
See xref:deployment:core/centos-rhel8/postgresql.adoc#core-centos-rhel8-pg_hba[pg_hba].
Restore OpenNMS database
sudo runuser -l postgres -c 'psql -f /tmp/opennms_postgres.dmp postgres'
Install OpenJDK
sudo dnf -y install java-11-openjdk
sudo /opt/opennms/bin/runjava -s
Run install -dis command
sudo /opt/opennms/bin/install -dis
Firewall configuration
Depending on where OpenNMS gets restored, you need to set the firewall settings again.
Start OpenNMS service
sudo systemctl start opennms
Restore user/group definition
sudo cat /tmp/opennms-passwd.txt >> /etc/passwd && /
sudo cat /tmp/opennms-group.txt >> /etc/group
Create log folder
sudo mkdir /var/log/opennms && /
chown opennms. /var/log/opennms
Restore OpenNMS Horizon binaries, RRD archives, configurations
sudo tar -xzf /tmp/opennms-usr-share.tar.gz -C / && \
sudo tar -xzf /tmp/opennms-etc.tar.gz -C / && \
sudo tar -xzf /tmp/opennms-var-lib.tar.gz -C / && \
sudo tar -xzf /tmp/opennms-usr-share-java.tar.gz -C /
Create OpenNMS systemd unit
sudo cp /etc/opennms/opennms.service /lib/systemd/system/ && \
sudo systemctl daemon-reload
Install PostgreSQL database
sudo apt -y install postgresql
Restore OpenNMS database
sudo runuser -l postgres -c 'psql -f /tmp/opennms-postgres.dmp postgres'
Install OpenJDK
apt-get install openjdk-11-jdk
sudo /usr/share/opennms/bin/runjava -s
Run install -dis command
sudo /usr/share/opennms/bin/install -dis
Start OpenNMS service
sudo systemctl start opennms