OP5 Monitor ["OP5 Monitor"]
["Technical Reference", "User Guide"]

# Manage backup and restore

## Overview

You can back up and restore the OP5 Monitor configuration from the OP5 Monitor user interface. Advanced users can perform more extensive backup and restore tasks from the command line.

## Back up and restore

### Create a new backup

To back up the OP5 Monitor configuration:

1. Click Manage > Backup/Restore.
2. Click Save your current op5 Monitor configuration.
3. Click Yes in the confirmation prompt to continue, or Close to exit without backing up.

   OP5 Monitor saves your new backup as a `tar.gz` file, including the date and time of backup:

   Note: OP5 Monitor prefixes user-created backups with `backup-` and system-created backups with `nacoma-`.

   You can now perform one of the following:

   - Download the backup by clicking on it.
   - View the contents of the backup file, restore the backup, or delete the backup, by clicking the relevant icon in the Actions column.

### Restore a backup

You can restore any of the configuration backups you created previously.

To restore a backup:

1. Manage > Backup/Restore.
2. Click the Restore icon next to the backup you want to restore.
3. Click Yes in the confirmation prompt to continue, or Close to exit without restoring.
4. After restoring, OP5 Monitor prompts you to restart. Click Restart now to restart or Close to exit without applying the new configuration.

### Enable a scheduled backup

You can schedule `op5-backup` to run nightly on the OP5 Monitor server by enabling a `systemd` timer distributed with OP5 Monitor:

    systemctl enable --now op5-backup.timer

To see when it will run next:

    systemctl list-timers op5-backup.timer

To change the schedule, use the system drop-in config file created with `systemctl`. Edit `op5-backup.timer`, and then make the appropriate adjustment to the `systemd` unit.

## Back up and restore from the command line

OP5 Monitor comes with a backup script called `op5-backup`. It creates backups of the OP5 Monitor installation, but it does not back up the operating system or Logger data.

`op5-backup` supports local, FTP, and SFTP or SCP backups. You can save local backups to a mounted share.

For help on `op5-backup`, type the following command:

    # op5-backup -h

### Configuration file

The configuration for `op5-backup` is located in file `/etc/op5-backup/main.conf`. You can use it to configure details such as where to store backup files.

### Create a backup

#### Create a full backup

A full backup backs up any of the following installed components:

- `op5-system`
- `op5-monitor`
- `op5-plugins`
- `op5-logserver`
- Trapper

To run a full backup of your OP5 server, type the following command:

    # op5-backup

To run an interactive backup, use the `-i` option:

    # op5-backup -i

OP5 Monitor stores the backup file in the location specified in the configuration file.

#### Create a custom backup

You can use a custom backup to include or exclude different modules from your backup.

To see a list of modules, type the following command:

    # ls /etc/op5-backup/modules/legacy

To create a backup that excludes specific module types, type the following:

    # op5-backup ? -<module1> -<module2>

To create a backup that includes only specific module types, type the following:

    # op5-backup ? +<module1> +<module2>

### Restore a backup

To restore a full backup, type the following:

    # op5-restore -b <path to backup file>

Caution: You must perform a full restore using a local terminal, not SSH.
Also, we recommend that you only restore the same version where the backup was taken from. Trying to restore a backup from different versions of OP5 Monitor can cause serious issues. A thorough version check has been implemented for the restore of backups that prevents all restores except the exact same version.

### Verify a backup

It is good practice to verify backups, especially manual backups.

You so this using SSH or the OP5 Monitor server console, with the following command:

    # tar vft <backup-file>

The output varies, depending on the modules you backed up. For example:

    rw-r r- root/root 514982 2013-05-08 08:23 migrate.tar.gz
    rw-r r- root/root 296954 2013-05-08 08:23 nagios-plugins.tar.gz
    rw-r r- root/root 1052 2013-05-08 08:23 op5-geomap.tar.gz
    rw-r r- root/root 26274 2013-05-08 08:23 op5-logserver-3.tar.gz
    rw-r r- root/root 27206917 2013-05-08 08:24 op5-monitor.tar.gz
    rw-r r- root/root 142 2013-05-08 08:24 op5-notify.tar.gz
    rw-r r- root/root 409 2013-05-08 08:24 op5-synergy.tar.gz
    rw-r r- root/root 203002 2013-05-08 08:24 op5-system.tar.gz
    rw-r r- root/root 1917 2013-05-08 08:24 ssh.tar.gz
    rw-r r- root/root 4 2013-05-08 08:24 version
    rw-r r- root/root 16 2013-05-08 08:24 timestamp
    rw-r r- root/root 7 2013-05-08 08:24 architecture
    rw-r r- root/root 8 2013-05-08 08:24 mode
    rw-r r- root/root 7 2013-05-08 08:24 archive
    drwxr-xr-x root/root 0 2013-05-08 08:24 modules/
    rw-r r- root/root 147 2013-05-08 08:23 modules/op5-geomap
    rw-r r- root/root 3284 2013-05-08 08:23 modules/op5-monitor
    rw-r r- root/root 136 2013-05-08 08:24 modules/op5-notify
    rw-r r- root/root 518 2013-05-08 08:24 modules/op5-system
    rw-r r- root/root 865 2013-05-08 08:23 modules/op5-logserver-3
    rw-r r- root/root 5813 2013-05-08 08:23 modules/migrate
    rw-r r- root/root 116 2013-05-08 08:24 modules/ssh
    rw-r r- root/root 165 2013-05-08 08:24 modules/op5-synergy
    rw-r r- root/root 177 2013-05-08 08:23 modules/nagios-plugins

### Delete a backup

You delete a backup by deleting the backup file:

    # rm <backup-file>

### Schedule a backup using cron

You can schedule a backup on your Linux server using `cron`. For more information on `cron`, see your Linux vendor documentation.

In this example, we will schedule a backup to run daily at 1:30 AM and place the file in the `/root` directory. For more options, see Syntax.

1. Open the `crontab` file for editing, by running the following command as `root`:

       # crontab -e

2. Add the following line and save the file:

       30 01 * * * root /usr/sbin/op5-backup >/dev/null 2>&1

#### Syntax

    # Example of job definition:
    # .---------------- minute (0 - 59)
    # |  .------------- hour (0 - 23)
    # |  |  .---------- day of month (1 - 31)
    # |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
    # |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
    # |  |  |  |  |
    # *  *  *  *  * user-name  command to be executed

Was this topic helpful?
Your thoughts...
How can we improve this topic?
It did not answer my question(s)
Confusing
Missing screenshot or graphics
Missing technical details
Information is out of date
Your thoughts...
Thank you for your feedback!