Backup and Restore Procedures
Firstly, 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.
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 <enter the password in console>
Pandora FMS Database Backup utility
Pandora FMS allows to periodically perform a backup of the database that can be programmed in the following ways Discovery → New console task and selecting from the drop-down menu Backup Pandora FMS database.
To create a new database backup:
- Select the backup frequency or one-time with “Not scheduled”.
- Select exactly when the “Next execution” backup task will be started.
- You need to indicate the content of which groups to support (or select all “All”).
- By default it is stored in
/var/www/html/pandora_console/attachment/backupsbut you can specify any directory to which you have write and read rights.
Once you have finished filling in the fields, click on the Create button.
Configuration files backup
In order to backup Pandora FMS's agents and server configuration files, type in:
tar -pcvzf pandora_configuration.tar.gz /etc/pandora/*.conf
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 plugin default folder is under /usr/share/pandora_server (the main Pandora FMS's server folder).
Caution: If you have server plugins placed in other folders, back them up as well.
tar -pcvzf pandora_server.tar.gz /usr/share/pandora_server tar -pcvzf my_plugin_folder.tar.gz /home/myuser/my_plugin_folder
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
Later on, perform a console backup, to keep custom images, extensions, and more.
tar -pcvzf pandora_console.tar.gz /var/www/html/pandora_console
Perform the installation procedure.
If you use a history database, restore it as well.
Make sure that your database is up and running, and the Pandora FMS's 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 Enter password: <enter the password in console>
Furthermore, the 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 /
Now, restore the agent directory.
[root@localhost ~]# tar -zxvf agent.tar.gz -C /
Restore the 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 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 /
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 the Pandora FMS server, and agent.
[root@localhost ~]# /etc/init.d/pandora_server start [root@localhost ~]# /etc/init.d/pandora_agent_daemon start