Administration Guide

  • Docs Home
  • Community Home

4. Backup and Recovery

In some situations, you might want to back up configuration information and data from a Zenoss instance, and then later restore that instance. You might do this periodically, to take regular "snapshots" of your instance to archive; or infrequently, such as to move data from one Zenoss instance to another, or to restore a setup after performing a fresh installation of Zenoss. Zenoss provides tools that enable you to manage these backup and restore tasks.

With backup and restore, Zenoss includes:

  • Events database (in MySQL)

  • Zope database, which includes all devices, users, and event mappings

  • $ZENHOME/etc directory, which contains configuration files for the Zenoss daemons

  • $ZENHOME/perf directory, which contains performance data

Suggestions for a successful backup and restore experience:

  • If you have the available disk space, tar and zip $ZENHOME before starting any backup or restore operation.

  • Make sure Zenoss, including all daemons, is stopped before performing a restore operaton.

  • Avoid using these tools to go from a newer version of Zenoss to an older version.

  • If you use these tools to go from an older version of Zenoss to a newer version, you should run zenmigrate after the restore operation.

  • If restoring to a different Zenoss installation (one that differs from the backup version), make sure file paths in the $ZENHOME/etc/*.conf files are appropriate for the new environment after you restore.

The following sections describe Zenoss backup and restore scripts, as well as options for controlling their behavior.

4.1. Backup (zenbackup)

The Zenoss backup script is $ZENHOME/bin/zenbackup. Typical use of zenbackup looks like:

> zenbackup --save-mysql-access --file=BACKUPFILEPATH

If Zenoss is running then you can run zenbackup without any arguments, and a backup file will be placed in $ZENHOME/backups.

4.1.1. Backup Options

The following table lists frequently used zenbackup options.

Note

Use the zenbackup --help command to see a complete list of zenbackup options.

 OptionDescription 
--dbnameSpecifies the name of the MySQL database Zenoss uses to hold event data. By default this is "Zenoss" but this can be specified when Zenoss is installed. This value can be seen by looking at the database field on the Event Manager page in Zenoss. If you do not specify --dbname then zenbackup will attempt to retrieve this information from ZEO unless you specify --dont-fetch-args.
--dbuser, --dbpasswordThese are the MySQL username/password used to access the events database. If you do not specify --dbuser or --dbpassword then zenbackup will attempt to retrieve this information from ZEO unless you specify --dont-fetch-args.
--dont-fetch-argsThis instructs zenbackup not to attempt to get values for dbname, dbuser and dbpassword from ZEO.
--file=FilenameUse --file to specify a location for the backup file. By default it will be named zenoss_Date.tgz and placed in $ZENHOME/backups.
--stdoutThis flag tells zenbackup to send the backup information to stdout instead of to a file. Incompatible with --verbose.
--save-mysql-accessThis instructs zenbackup to save dbname, dbuser and dbpassword as part of the backup file so that zenrestore will have this information during a restore operation. Use this with caution as it means your backup files will contain a MySQL user name and password.
--no-eventsdbDo not include the MySQL events database as part of the backup.
-v, --verbosePrint progress messages. Incompatible with --stdout.

4.1.2. Backups Tab

Zenoss provides a simple Web interface for creating and managing backups. Navigate to Settings->Backups to view the Backups page. The Create New Backup section allows you to create a backup through the GUI. The options available are a subset of those available with the zenbackup command line tool. Below that is the Backups section which lists all backup files in $ZENHOME/backups. You can delete one or more backup files by selecting them, and then selecting Delete Backup from the menu. Backup files can become large as your databases grow, so you may want to limit the number of backups you keep if drive space becomes an issue.

4.1.3. Remote Backups

Keeping backups on your Zenoss server should help you recover if one of your databases becomes corrupt or your configuration becomes problematic. However, Zenoss recommends that you keep at least one recent backup file on a different server (ideally at a different physical location) in case a physical disk fails.

4.2. Restore (zenrestore)

The Zenoss restore script is $ZENHOME/bin/zenrestore. Typical use of zenrestore looks like:

> zenrestore --file=BACKUPFILEPATH

4.2.1. Before You Restore

Before you can restore your Zenoss instance, you must ensure that the same ZenPacks that were installed on the backup system are also installed on the target system.

Make sure that Zenoss is stopped before performing a restore.

If you used the --save-mysql-access option when you created the backup file then you only need to specify --file when you run zenrestore. Otherwise, you need to specify dbname, dbuser and dbpassword also.

4.2.2. Restore Options

The following table lists frequently used zenrestore options.

Note

Use the zenrestore --help command to see a complete list of zenrestore options.

 OptionDescription 
--fileThis is a backup file created with zenbackup You must specify either --file or --dir.
--dirThe path to an unzipped backup file. You must specify either --file or --dir.
--dbnameThis is the name of the MySQL database Zenoss uses to hold event data. This database must exist before zenrestore is run. If there are any Zenoss tables in the database they will be dropped by zenrestore before it restores the backed up tables and data. If you use a different dbname than was in use when the backup was created then after the restore, then you must set the database name on the Event Manager page.
--dbuser, --dbpasswordThese are the MySQL username/password used to access the events database. If you do not specify --dbuser or --dbpassword then zenrestore will attempt to use values stored in the backup file if --save-mysql-access was used in creating it.
--no-eventsdbDo not restore the MySQL events database. If the backup file does not contain MySQL events data then zenrestore will not modify your events database even if you do not specify --no-eventsdb.
-v, --verbosePrint progress messages.