Backup and Restore Procedures

Backup procedure

Database backup

First, make a backup of the existing database. There are two methods available to make such backup.

If a history database is used, perform its backup as well.

Manual backup

Open a terminal window with the appropriate user credentials and enter the following commands (enter the access credentials for the database):

mysqldump -u < pandora_db_user > -p < pandora_db_name > | gzip> pandoradb.sql.gz

This will create a compressed logical backup of the whole Pandora FMS database < pandora_db_name >.

Pandora FMS Database Backup utility

Pandora FMS allows to periodically back up the database that can be programmed in the following ways Discovery → New console task and select from the drop-down menu Backup Pandora FMS database.

To create a new database backup:

  • Scheduled: Select the backup frequency, Daily, Hourly, Monthly, with no interval Not scheduled, Weekly or Yearly.
  • Next execution: Select exactly when the next backup task will start (first select the day and then the time), from there it will be executed periodically unless you chose the option Not scheduled in the previous point.
  • Group: Group the backup task will belong to (or select All for all groups).
  • Parameters:

Save to disk in path: By default it is stored in /var/www/html/pandora_console/attachment/backups, but you may specify any directory to which you have writing and reading rights.

Once you finish filling in the fields, click Create.

By means of Pandora FMS database backup manager (menu Management → Setup → Admin tools → DB Backup Manager) you may download the backups made, restore them or just delete them. If backups were deleted, for one reason or another, if you used the Web Console for that purpose, in each corresponding item Status Lost will be checked and you may use Delete Lost to permanently delete all backups in that specific status.

Configuration files backup

In order to back up Pandora FMS's agents and server configuration files:

tar -pcvzf pandora_configuration.tar.gz /etc/pandora/*.conf

Agent backup

The agent folder must also be backed-up. This is very important to keep deployed collections and agent plugins.

tar -pcvzf agent.tar.gz /usr/share/pandora_agent

Server backup

Server plugins

Server plugin default folder is under /usr/share/pandora_server (the main Pandora FMS server folder).

tar -pcvzf pandora_server.tar.gz /usr/share/pandora_server
tar -pcvzf my_plugin_folder.tar.gz /home/myuser/my_plugin_folder

If you have server plugins located in other directories, you should also back them up.

Remote configuration

Remote configuration file and collection backup must be performed in order to keep the remote agent's usual performance.

tar -pcvzf collections.tar.gz /var/spool/pandora/data_in/collections
tar -pcvzf md5.tar.gz /var/spool/pandora/data_in/md5
tar -pcvzf remote_agents_conf.tar.gz /var/spool/pandora/data_in/conf

Console backup

Later on, perform a Web console PFMS backup, to keep custom images, extensions, and more.

tar -pcvzf pandora_console.tar.gz /var/www/html/pandora_console

Restore procedure

Perform the installation procedure.

Database restore

If you use a history database, restore it as well.

Manual restore

Make sure that your database is up and running, and Pandora FMS server and agent are shut down.

[root@localhost ~]# /etc/init.d/mysqld start
Starting mysqld: [ OK ]
[root@localhost ~]# /etc/init.d/pandora_server stop
Stopping Pandora FMS Server
[root@localhost ~]# /etc/init.d/pandora_agent_daemon stop
Stopping Pandora Agent.

From version NG 754 onwards, additional options are available for manual startup and shutdown of High Availability (HA) environments.

Then, restore the database:

[root@localhost ~]# gunzip pandora.sql.gz
[root@localhost ~]# cat pandoradb.sql | mysql -u root -p pandora

Furthermore, recovery can be performed in the following way:

mysql –u root –p pandora
CREATE DATABASE pandora;
USE pandora;
SOURCE PATH BACKUP;

The database to be created must have the same name as the backed-up database.

Configuration file restore

First, restore agent and server configuration files:

[root@localhost ~]# tar -zxvf pandora_configuration.tar.gz -C /

Agent restore

Now, restore the agent directory:

[root@localhost ~]# tar -zxvf agent.tar.gz -C /

Server restore

Server plugins

Restore Pandora FMS server main folder, and every other plugin folder that you may have:

[root@localhost ~]# tar -zxvf pandora_server.tar.gz -C /
[root@localhost ~]# tar -zxvf my_plugin_folder.tar.gz -C /

Remote configuration

Remote configuration file and collection restore must be performed in order to keep the remote agent's usual performance.

[root@localhost ~]# tar -zxvf collections.tar.gz -C /
[root@localhost ~]# tar -zxvf md5.tar.gz -C /
[root@localhost ~]# tar -zxvf remote_agents_conf.tar.gz -C /

Console restore

Next, restore the console to keep your custom images, extensions, and more.

[root@localhost ~]# tar -zxvf pandora_console.tar.gz -C /

Starting Pandora FMS server and agent

The last step is to start Pandora FMS server and agent:

[root@localhost ~]# /etc/init.d/pandora_server start
[root@localhost ~]# /etc/init.d/pandora_agent_daemon start

Go back to Pandora FMS documentation index