Welcome!

This community is for professionals and enthusiasts of our products and services.
Share and discuss the best content and new marketing ideas, build your professional profile and become a better marketer together.

0

0
Avatar

Administrator

--Administrator--

2508
| 0 0 0
--Administrator--
Administrator
On 11/23/19, 10:54 AM

Backup and Restore

This guide describes the general workflow how to backup and restore an OpenNMS instance.

Record you setup

Linux distribution package management should automatically install the required components like PostgreSQL, Jetty, RRD etc and will take care of version and dependencies.

But it’s always good to know, which versions you have running.

OpenNMS

root@opennms:~$ apt search opennms-server | grep installed

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

opennms-db/opennms-22,opennms-22,now 22.0.4-1 all [installed,automatic]
opennms-server/opennms-22,opennms-22,now 22.0.4-1 all [installed,automatic]

Java

root@opennms:~$ java -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)

PostgreSQL

root@opennms:~$ psql --version
psql (PostgreSQL) 9.5.14

Backup

PostgreSQL

Create a pg_dump of the database.
It can be done while PostgreSQL is running.

Example:

root@opennms:~$ runuser -l postgres -c 'pg_dump -W -U opennms -Fc -f $SOME_DIR/opennms.pgsql.gz opennms'
Password: 

Configuration

All configuration is stored in $OPENNMS_HOME/etc/ directory.
It can easily be backed up using tar.

Example:

tar -cvzf $SOME_DIR/opennms-etc.tar.gz $OPENNMS_HOME/etc/`

Metrics

OpenNMS RRD files are stored in $OPENNMS_HOME/share/rrd and can also easily backed up using tar:

Example:

tar cvfz $SOME_DIR/opennmsrrd.tar.gz $OPENNMS_HOME/share/rrd/

Install

OpenNMS

Follow the official install guide 1.

:warning: Special attention if you use older version of OpenNMS!

Restore

Make sure OpenNMS is not running while restoring the data.

Database

  • Start PostgreSQL
    systemctl start postgresql.service

  • su as the postgres user and delete the current OpenNMS database
    dropdb opennms

  • As postgres user, create a new clean db owned by the opennms user
    createdb -O opennms opennms

  • As postgres user, restore the DB:
    pg_restore -U opennms -Fc -d opennms /path/to/db_dump_file

Hint:
To reduce the amount of time used to perform the restore, add the -j NUM option to the command with NUM being the number of parallel jobs used to perform the restore (the number of cores in your server would be a good starting point for the NUM value):

Example:

pg_restore -U opennms -Fc -j 24 -d opennms /path/to/db_dump_file

The restore should produce no errors. If there are errors, examine them and fix at this point and restart the Postgresql service.

RRD files

  • Stop OpenNMS and delete the the content of the RRD folder
    rm -rf $OPENNMS_HOME/share/rrd/*
  • Extract the backup into RRD folder

Example:

tar -xzf $SOME_DIR/opennms-rrd.tar.gz -C $OPENNMS_HOME/share/rrd

Configuration files

  • Stop OpenNMS and delete the the content of the etc folder
    rm -rf $OPENNMS_HOME/etc/*
  • Extract the backup into etc folder

Example:

tar -xzf $SOME_DIR/opennms-etc.tar.gz -C $OPENNMS_HOME/etc
  • created

    Mar 5
  • last reply

    Mar 13
  • 1

    reply

  • 301

    views

  • 2

    users

  • 6

    likes

  • 1

    link

Authentication Configs

If you use LDAP/AD/radius/kerberos authentication you should also backup
jetty-webapps/opennms/WEB-INF/applicationContext-spring-security.xml
and the appropriate config file from
jetty-webapps/opennms/WEB-INF/spring-security.d/

Custom Icons

In addition, if you have customized the OpenNMS icons, you may need to backup the following images from /opt/opennms/jetty-webapps/opennms/images:

horizon_logo.svg
meridian_logo.svg
meridian_logo_small.png
meridian_logo_small.svg

Keep Informed

About This Community

This community is for professionals and enthusiasts of our products and services. Share and discuss the best content and new marketing ideas, build your professional profile and become a better marketer together. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 11/23/19, 10:54 AM
Seen: 29 times
Last updated: 11/23/19, 10:54 AM