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 instance to another, or to restore a setup after performing a fresh installation. Zenoss provides tools that enable you to manage these backup and restore tasks.
With backup and restore, the system includes:
Events database (in MySQL)
Zope database, which includes all devices, users, and event mappings
$ZENHOME/etcdirectory, which contains configuration files for the system daemons
$ZENHOME/perfdirectory, which contains performance data
Suggestions for a successful backup and restore experience:
If you have the available disk space, tar and zip
$ZENHOMEbefore starting any backup or restore operation.
Make sure the system, including all daemons, is stopped before performing a restore operation.
If you use these tools to go from an older version 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/*.conffiles are appropriate for the new environment after you restore.
The following sections describe backup and restore scripts, as well as options for controlling their behavior.
The backup script is
$ZENHOME/bin/zenbackup. Typical use of zenbackup looks like:
> zenbackup --save-mysql-access --file=BACKUPFILEPATH
If the system is running then you can run zenbackup without any arguments. A backup file will be placed in
The following table lists frequently used zenbackup options.
Use the zenbackup --help command to see a complete list of zenbackup options.
|--dbname||Specifies the name of the MySQL database the system uses to hold event data. By default this is "Zenoss" but this can be specified when the system is installed. This value can be seen by looking at the database field on the Event Manager page. If you do not specify --dbname then zenbackup will attempt to retrieve this information from ZEO unless you specify --dont-fetch-args.|
|--dbuser, --dbpass||These are the MySQL username/password used to access the events database. If you do not specify --dbuser or --dbpass then zenbackup will attempt to retrieve this information from ZEO unless you specify --dont-fetch-args.|
|--dont-fetch-args||This instructs zenbackup not to attempt to get values for |
|--file=Filename||Use --file to specify a location for the backup file. By default it will be named |
|--stdout||This flag tells zenbackup to send the backup information to stdout instead of to a file. Incompatible with --verbose.|
|--save-mysql-access||This instructs zenbackup to save |
|--no-eventsdb||Do not include the MySQL events database as part of the backup.|
|-v, --verbose||Print progress messages. Incompatible with --stdout.|
A simple Web interface lets you create and manage 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.
Keeping backups on your server should help you recover if one of your databases becomes corrupt or your configuration becomes problematic. However, you should keep at least one recent backup file on a different server (ideally at a different physical location) in case a physical disk fails.
The restore script is
$ZENHOME/bin/zenrestore. Typical use of zenrestore looks like:
> zenrestore --file=BACKUPFILEPATH
If you are running a version of Zenoss prior to 2.4.5, before you can restore your 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 the system 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 dbpass also.
The following table lists frequently used zenrestore options.
Use the zenrestore --help command to see a complete list of zenrestore options.
|--file||This is a backup file created with zenbackup You must specify either --file or --dir.|
|--dir||The path to an unzipped backup file. You must specify either --file or --dir.|
|--dbname||This is the name of the MySQL database the system uses to hold event data. This database must exist before zenrestore is run. If there are any system 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 you must set the database name on the Event Manager page.|
|--dbuser, --dbpass||These are the MySQL username/password used to access the events database. If you do not specify --dbuser or --dbpass then zenrestore will attempt to use values stored in the backup file if --save-mysql-access was used in creating it.|
|--no-eventsdb||Do 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, --verbose||Print progress messages.|