Server Management

Manual startup/shutdown for Pandora FMS servers

Please note that if for maintenance reasons you want to manually stop Pandora FMS server, verify whether a service Watchdog is running. Check this section for more details.

To start or stop manually Pandora FMS server execute the following in a shell console:

/etc/init.d/pandora_server stop
  • Start the daemon:
/etc/init.d/pandora_server start
  • Restart the daemon:
/etc/init.d/pandora_server restart

Version NG 756 or later.

From version NG 756 onwards the previous instructions will also start pandora_ha service.

To start and/or stop manually only Pandora FMS server, you have to execute the following in a shell console:

  • Stop the daemon:
/etc/init.d/pandora_server stop-server
  • Start the daemon:
/etc/init.d/pandora_server start-server
  • Restart the daemon:
/etc/init.d/pandora_server restart-server

You may monitor the status of pandora_ha through systemd with:

systemctl status pandora_ha.service

Database management

Pandora FMS infrastructure does not need external maintenance, but it is very important to purge old data, and maintain the database as much compacted as possible. There is an essential tool for the proper functioning of Pandora FMS which is in charge of carrying out these tasks. Its location is:

/usr/bin/pandora_db

This tool, hereinafter pandora_db.pl is included in Pandora FMS server package, so it must be executed from a system where there is a Pandora FMS server installed. If there are two systems, one for the console and one for the server, pandora_db must be executed where Pandora FMS server is hosted.

Pandora_db is a key tool for Pandora FMS to work properly, and that is why its execution is programmed in system cron tasks with an hourly interval. Its execution is configured within the file:

/etc/cron.hourly/pandora_db

This tool performs all database maintenance tasks automatically:

  • It deletes old data.
  • It compresses existing data, interpolating them at several intervals, so that graphics are the same but the space needed to store them is much smaller (this is one reason why Pandora FMS is able to process such an amount of information).
  • It checks the consistency of the database for non-existing modules, or modules that are not used because they can not be started (these modules appear in the tactical view as uninitialized modules).
  • It deletes the daily agent contact information. Pandora FMS does not need more than 24hr agent contact history, and if it builds up, it slows down database access.
  • It moves all old data to the standby history database.

As mentioned before, pandora_db execution is configured in system cron tasks and although this execution is automatically included in Pandora FMS server installation, it is convenient to check it. Therefore, /etc/cron.hourly/pandora_db must exist and contain the following:

"/usr/bin/pandora_db" "/etc/pandora/pandora_server.conf">/dev/null 2>&1

It is equally important to check permissions and the file's owner. The appropriate file permissions would be 755, which can be granted by executing:

chmod 755 /etc/cron.hourly/pandora_db

Regarding the owner, it must be root both for the user and group, which is set executing:

chown root:root /etc/cron.hourly/pandora_db

Maintenance tool manual execution

If necessary, it is possible to launch pandora_db execution manually as it was exposed in the previous section. Execute from a shell the following:

/usr/bin/pandora_db /etc/pandora/pandora_server.conf

This may take hours in overloaded systems, so it is recommended to execute the process in the background.

To execute manually the maintenance tool and leave it in the background, execute:

nohup /usr/bin/pandora_db /etc/pandora/pandora_server.conf

The process will take some time until it loads completely in the background. Then, you may close the shell console window, while the process will still be executed.

It is very important to make sure you are using the updated tool version, and not that of a previous version. If you execute the program without arguments, it will show the tool version at the head of the message and it must match the version installed on the server.

Database Backup

It is important to remember that this only backs up or restores the database, without including other files, nor the server configuration.

The command mysqldump will do a complete database dump of the table structure as well as its contents. This is done by doing a full database dump, both of the table structure as well as their contents. This command has several options to do a backup, and its most basic usage is enough to dump from the same system where the database is hosted. Indicate the database name from which the backup will be done and the credentials to access it:

mysqldump -u <user> -p <data_base>

For instance, to backup “pandora” database and dump the result to an .sql file execute:

mysqldump -u root -p pandora> /backup/pandoradb_backup.sql

From a backup done that way, you may fully restore the database. Login in MySQL, proceed to create the database that will be restored and then load the backup in that database. Following the previous example:

[root@pandorafms ~]# mysql -u root -p
mysql> create database pandora;
mysql> use pandora;
mysql> source /backup/padnoradb_backup.sql

Finally, it is necessary to set configured user permissions again both in Pandora FMS Console and server so they have total access to the database (replace mypassword by your password):

grant all privileges on pandora.* to pandora@localhost identified by 'mypassword';

Pandora FMS complete backup and restore

There is a script in Pandora FMS server distribution that is useful to backup and restore Pandora FMS completely. This script is intended for backup and restoration in systems where the server and console are located in the same machine.

If there are several components in your environment, then you should use the tool with the most adequate parameters for its use or modify them so they are tailored to your needs.

This script needs to be executed as root. You are the only responsible for said key. It is located at:

/usr/share/pandora_server/util/pandora_backup.sh

If it is executed without parameters, it will show the help menu.

Watchdog implementation for Pandora FMS

In the code repository, there is a small script that is used as Watchdog. This script performs a Pandora FMS status monitoring.

Thus you may perform a recovery operation (trying to start Pandora FMS), and if that fails, a warning must be issued. This tool is at:

/usr/share/pandora_server/util/pandora_watchdog.sh

Script for alert generation

The pandora_watchdog.sh script looks for a file in /usr/bin/pandora_alert with the instrucctions to generate the alert. This file must be created defining the code to be executed when the watchdog cannot lift the Pandora FMS server. In this example, in addition to warning through a SMS, it stops the Tentacle server:

#!/bin/bash
sendsms +34458474843 "The Pandora FMS has suffered some issue and it cannot be started."
/etc/init.d/tentacle_serverd stop

Grant execution permissions to this script:

chmod 750 /usr/bin/pandora_alert

Watchdog startup

To launch the Watchdog and leave it workin in the background, execute the following:

nohup /usr/share/pandora_server/util/pandora_watchdog.sh &

When starting a Watchdog, bear in mind that if for maintenance reasons you wish to manually stop Pandora FMS server, you must also previously have stopped the Watchdog process to prevent it from trying to start the sercice automatically continuously.

History database

A history database is a database where old module data are transferred to make the main Pandora FMS database more responsive for everyday operations. Those data will still be available for Pandora FMS console when viewing reports, module charts etc.

Setting up a historical database

Version NG 754 and later versions.

To configure a historical database, it is necessary to have a new server where to host it (different from the one of the main database). Once you have that server where MySQL is installed, follow these steps:

In Pandora FMS console, go to Setup → Setup → Historical database to access connection configuration (Configure connection target).

Fill in the following fields:

  • Host: Host name (web link or IP address) of the history database.
  • Port: Connection port of the history database. Stardard value: 3306.
  • Database name: Name of the history database. Default value: pandora.
  • Database user: History database user. Default value: pandora.
  • Database password: Password of the history database. This will allow to cennect to the history database. Next fill in the custom parameters (Customize settings):

The last fields of this form Data days old to keep in active database, Transference block size (Step) and Delay betewwn transferences (seconds) will define the way in which the data will be sent to the historical database, that is, the oldest data those with more than n days (Data days) will be moved to the history database in blocks of made of n rows (Step) waiting n seconds (Delay) between one block and the next to avoid overloads.

In the same screen, it is also possible to decide whether to send the events with more than n days to the history database (Events days old to keep in active database), although it must be taken into account that including the events will considerably increase the growth rate of the historical database, and that these will only be consulted when generating reports, not in the event view.

The historical database uses the /usr/bin/pandora_db binary to transfer data. In addition, you must configure the settings for the maintenance of the history database.

Go back to Pandora FMS documentation index