Back up OpenNMS Horizon

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

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

Objectives

  • Create backup of OpenNMS Horizon components

  • Create PostgreSQL database backup

  • Able to run a restore without having OpenNMS installation packages available

Requirements

  • System user with administrative permissions (sudo)

  • Database password for opennms and postgres user

Create backup

  • CentOS/RHEL 8

  • Debian/Ubuntu

Stop OpenNMS Horizon service
sudo systemctl stop opennms
Back up OpenNMS Horizon binaries, RRD archives, configurations
sudo tar --exclude='/opt/opennms/data/cache' -cvzf /tmp/opennms-opt.tar.gz /opt/opennms && \
sudo tar -cvzf /tmp/opennms-var.tar.gz /var/opennms
Create PostgreSQL database backup
sudo runuser -l postgres -c 'pg_dumpall -f /tmp/opennms-postgres.dmp'
Back up OpenNMS Horizon operating system user
sudo grep opennms /etc/passwd > /tmp/opennms-passwd.txt && \
sudo grep opennms /etc/group > /tmp/opennms-group.txt
Stop OpenNMS Horizon service
sudo systemctl stop opennms
Back up OpenNMS Horizon binaries, RRD archives, configurations
sudo tar --exclude='usr/share/opennms/data/cache' -cvzf /tmp/opennms-usr-share.tar.gz /usr/share/opennms && \
sudo tar -cvzf /tmp/opennms-etc.tar.gz /etc/opennms && \
sudo tar -cvzf /tmp/opennms-var-lib.tar.gz /var/lib/opennms && \
sudo tar -cvzf /tmp/opennms-usr-share-java.tar.gz /usr/share/java/opennms
Create PostgreSQL database backup
sudo runuser -l postgres -c 'pg_dumpall -f /tmp/opennms-postgres.dmp'
Back up OpenNMS Horizon operating system user
sudo grep opennms /etc/passwd > /tmp/opennms-passwd.txt && \
sudo grep opennms /etc/group > /tmp/opennms-group.txt