# HA History Plugin

# Introduction

The **pandora\_history\_ha** plugin allows the management of connectivity to historical databases configured in HA environments within Pandora FMS installations.

# Installation

To install the service, download the installation package from the [Marketplace](https://marketplace.pandorafms.com//entries/pandorafms.pandora_history_ha).

Transfer the package to the host from which the service will be managed (normally the Pandora FMS server), extract it, and run the installation script included inside:

```bash
./pandora_history_ha_installer --install
```


By default, the installation will be performed in **/opt/pandorafms/pandora\_history\_ha**, but a custom directory can be specified using the **--destdir** parameter:

```bash
./pandora_history_ha_installer --install --destdir /opt/cutom_pandora_history_ha/
```

# Configuration

Para gestionar el HA de la base de datos de histórico es necesario indicar las siguientes opciones de configuración en el fichero **/opt/pandorafms/pandora\_history\_ha/pandora\_history\_ha.conf**

<table border="1" id="bkmrk-par%C3%A1metro-descripci%C3%B3" style="border-collapse: collapse; width: 100%; height: 714.907px;"><colgroup><col style="width: 50%;"></col><col style="width: 50%;"></col></colgroup><tbody><tr style="height: 29.7969px;"><td class="align-center" style="height: 29.7969px;">**Parámetro**</td><td class="align-center" style="height: 29.7969px;">**Descripción**</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">**dbname**</td><td style="height: 29.7969px;">Name of the historical database to connect to.</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">**dbport**</td><td style="height: 29.7969px;">Connection port for the historical database.</td></tr><tr style="height: 63.3906px;"><td style="height: 63.3906px;">**dbuser**</td><td style="height: 63.3906px;">Historical database connection user. Requires the"`REPLICATION CLIENT" and "SUPER" (or "REPLICATION\_SLAVE\_ADMIN") privileges.</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">**dbpass**</td><td style="height: 29.7969px;">Password for the previous user.</td></tr><tr style="height: 46.5938px;"><td style="height: 46.5938px;">**repl\_dbuser**</td><td style="height: 46.5938px;">Historical database replication user. Requires the "REPLICATION SLAVE" privilege.</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">**repl\_dbpass**</td><td style="height: 29.7969px;">Password for the previous user.</td></tr><tr style="height: 46.5938px;"><td style="height: 46.5938px;">**ha\_hosts**</td><td style="height: 46.5938px;">List of IP addresses or FQDNs of all hosts participating in the historical database HA cluster (comma-separated).</td></tr><tr style="height: 34.5938px;"><td style="height: 34.5938px;">**ha\_interval**</td><td style="height: 34.5938px;">Interval, in seconds, between HA status checks.</td></tr><tr style="height: 46.5938px;"><td style="height: 46.5938px;">**ha\_connect\_retries**</td><td style="height: 46.5938px;">Number of retry attempts when connecting to the historical database HA cluster.</td></tr><tr style="height: 34.5938px;"><td style="height: 34.5938px;">**ha\_connect\_delay**</td><td style="height: 34.5938px;">Delay, in seconds, between connection retry attempts.</td></tr><tr style="height: 46.5938px;"><td style="height: 46.5938px;">**splitbrain\_autofix**</td><td style="height: 46.5938px;">Enables (1) or disables (0) automatic HA recovery in the event of a split-brain situation.</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">**verbose**</td><td style="height: 29.7969px;">Enables (1) or disables (0) detailed logging.</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">**log\_file**</td><td style="height: 29.7969px;">Path to the service log file.</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">**pid\_file**</td><td style="height: 29.7969px;">Path to the service PID file.</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">**main\_dbhost**</td><td style="height: 29.7969px;">IP address or FQDN of the main Pandora FMS database.</td></tr><tr style="height: 33.5938px;"><td style="height: 33.5938px;">**main\_dbport**</td><td style="height: 33.5938px;">Connection port for the main Pandora FMS database.</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">**main\_dbname**</td><td style="height: 29.7969px;">Name of the main Pandora FMS database.</td></tr><tr style="height: 34.5938px;"><td style="height: 34.5938px;">**main\_dbuser**</td><td style="height: 34.5938px;">Connection user for the main Pandora FMS database.</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">**main\_dbpass**</td><td style="height: 29.7969px;">Password for the previous user.</td></tr></tbody></table>

# Service

The **pandora\_history\_ha** plugin installs a SystemD service responsible for running the application.

Using the configuration defined in its configuration file, this service connects to the hosts that form the historical database HA cluster and to the main database in order to update the Pandora FMS configuration so that historical database connections are directed to the active HA primary node.

The service can be managed using the following command:

```bash
systemctl <action> pandora_history_ha
```