Community Network Tech

The importance of Data Backup in Pandora FMS

November 28, 2018

The importance of Data Backup in Pandora FMS

This post is also available in: Spanish

Importance of Data Backup: Learn how to be protected

If you value stability and anticipation, if you love being on the safe side, you should know the importance of Data Backup.

Performing a backup of the system is essential in order to maintain the integrity and security of our work environment.

Let’s imagine that we have been working for months with our Pandora FMS system, so we have a lot of information collected within our environment, and the machine in which we are running the tool stops working. If we don’t generate our backup copy of the tool, well … we will lose our work of the past couple of months. You might as well start pulling your hair and looking for the Valium pills. On the other hand, if we have created that backup before the machine dies, we will be able to recover all our work in another device and continue as if nothing had happened. Thus avoiding anti-stress therapies.

Once we know that a backup of the entire system can save us from critical situations, we’ll have to learn how to do it, right? Well, write down the following steps, recommended, of course, by the best Pandora FMS technicians.

Performing backup

Our system is divided into different parts, all of them crucial for the correct functioning of the tool in a global way. It is important to create a backup copy of the database in which we keep all the information: the configuration files that Pandora FMS handles, the information files of the different installed agents, the files of plugins and remote configuration of the server and finally the data that Pandora FMS console entails.
Some reckless people may find it most obsessive, but it is highly recommended to backup all these items on a daily basis, in order to have the most recent data saved. That is why it is almost obligatory to have a crontab with all these mandates, so that they are executed on a regular basis. In turn, within the same crontab, it is recommended to delete backups of more than X days, so as not to fill the space reserved for backups and so that we do not have errors saved for lack of space.

Database

First of all, you must backup the most critical and important element of Pandora FMS, the database. The following mandate should be carried out:

mysqldump -u -p | gzip > pandoradb.sql.gz

This backup must be done both of the main Pandora FMS database and of the Pandora FMS database that we are using as historical database.

Configuration files

Secondly, the server configuration files must be backed up. In order to do this, the following mandate should be carried out:

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

Agent

Thirdly, the agents installed in our machine must be backed up. In order to do this, the following mandate should be carried out:

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

Server. Plugins and remote configuration

In fourth place, the Pandora FMS server backup must be done. This backup is divided in two; one of the server plugins, and another one of the remote configuration. In the first case, the default file is inside the /usr/share/pandora_server folder, but it can be in the location desired by the user. To make this backup you must use the following command:

For a default installation: tar -pcvzf pandora_server.tar.gz /usr/share/pandora_server

For a custom installation: tar -pcvzf my_plugin_folder.tar.gz /home/myuser/my_plugin_folder

In the second case, the remote configuration of files and agent collections must be backed up. The following mandates should be carried out:

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

Last but not least, you should backup the console, in which we can keep, among other things, the custom images that we have included in our system. The following mandate should be carried out:

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

Backup Recovery

Now that we have our backups done and we can breathe easy, we are asked another important question: how do I recover this information contained in my backup? As when making backups, we have to follow the same order to rescue our data in the machine in which we want to incorporate our information again. Same save order, same order to retrieve what was saved.

Database

First, we must recover the database backup. To do this, we must make sure that the database is up and running, that the Pandora FMS server and agent are stopped and that the database where we are going to recover our information is created. With all of these first requirements met, the following mandates should be carried out:

gunzip pandora.sql.gz
cat pandora.sql | mysql -u root -p pandora
Enter password:

If there is a situation where we have a backup of the historical database, the same steps must be carried out as on the previous occasion.

Configuration files

Secondly, we must recover the backup of the configuration files. To this end, the following mandate should be carried out:
tar -zxvf pandora_configuration.tar.gz -C /

Agent

Thirdly, we must recover the backup of the agent files. In order to do this, the following mandate should be carried out:
tar -zxvf agent.tar.gz -C /

Server. Plugins and remote configuration

Fourthly, we must recover the backup of the server files, both the plugins and the remote configuration. First we have to restore the plugin files from the default path and then those that are personalized, with the following commands:

tar -zxvf pandora_server.tar.gz -C /
tar -zxvf my_plugin_folder.tar.gz -C /
Afterwards, we will recover the collections and remote configuration files with the following commands:
tar -zxvf collections.tar.gz -C /
tar -zxvf md5.tar.gz -C /
tar -zxvf remote_agents_conf.tar.gz -C /

Console

Finally, we will recover the Pandora FMS console data through the following command:

tar -zxvf pandora_console.tar.gz -C /

Once we have all the data recovered thanks to our backups, we have to perform the last two steps, start the server and agents:

/etc/init.d/pandora_server start
/etc/init.d/pandora_agent_daemon start

And now that we’ve reviewed what backup is and some of the key pieces to consider this for our security, why don’t you let us introduce you to Pandora FMS?

Pandora FMS is a flexible monitoring system, which can monitor devices, infrastructures, applications, services and business processes.

Do you still want to know more about system monitoring? Luckily, you are in the right place to find out more. In this blog there are dozens of articles that can introduce you to this exciting world. Here you have a link to our website: https://blog.pandorafms.org/

Or you can also get to know Pandora FMS directly. Click here:
https://pandorafms.com/

You can even send us any query you may have about Pandora FMS. You can do this in a very simple way, thanks to the contact form that can be found at the following address: https://pandorafms.com/contact/

Written by Dimas Pardo & Alberto Sánchez


    Written by:



    Leave a comment

    Your email address will not be published. Required fields are marked *

    This site uses Akismet to reduce spam. Learn how your comment data is processed.