# Plugin  Openstack

# Introduction

View. 20/07/2021

With this plug-in you can view the monitoring data of your openstack instances and hypervisors.

It connects to the account via a token.

Type: Server plug-in

# Compatibility matrix

<table border="1" id="bkmrk-sistemas-donde-se-ha" style="border-collapse: collapse; width: 100%; height: 84px;"><tbody><tr style="height: 28px;"><td style="width: 50%; height: 28px;">**Systems where it has been tested**</td><td style="width: 50%; height: 28px;">CentOS 7

</td></tr><tr style="height: 28px;"><td style="width: 50%; height: 28px;">**Systems where it should work**</td><td style="width: 50%; height: 28px;">Any linux system

</td></tr></tbody></table>

# Prerequisites

Required:

- An Openstack installation
- Generate an API read token using a curl command with your Openstack account credentials.
- Have python3 installed on the machine where pandora is installed.
- Have installed the requests module in its python3 version.
- Have the Pandora FMS Data Server enabled.
- Have Pandora FMS Plugin Server enabled.

# Configuration

The plugin makes use of a token, which will authenticate with the api when we introduce it as a parameter in the command. To create this token, we will go to our Dashboard and click on "api access":

[![image-1626779019342.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-07/scaled-1680-/image-1626779019342.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-07/image-1626779019342.png)

Inside here, we are going to download the file "admin-openrc.sh", inside this file we will be able to see all the credentials that we have to put in a curl to generate the token (if you know all these credentials, it is not necessary to download the file, in the section "see credentials" there are some but not all, between this section and the file you will be able to check all the data).

[![image-1626779056701.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-07/scaled-1680-/image-1626779056701.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-07/image-1626779056701.png)

We open the file and see the credentials:

[![image-1626779091263.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-07/scaled-1680-/image-1626779091263.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-07/image-1626779091263.png)

This file is also used to authenticate on the machine where openstack is installed and to use the CLI, but we are not going to use it in this manual (the following image would be a sample of how it would be executed, after that it would ask for the password, which is the same as the one you use to enter the dashboard).

[![image-1626779124667.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-07/scaled-1680-/image-1626779124667.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-07/image-1626779124667.png)

After doing this, we run the following command, entering our credentials in each section:

```
curl -v -s -X POST $OS_AUTH_URL/auth/tokens?nocatalog   -H "Content-Type: application/json"   -d '{ "auth": { "identity": { "methods": ["password"],"password": {"user": {"domain": {"name": "'"$OS_USER_DOMAIN_NAME"'"},"name": "'"$OS_USERNAME"'", "password": "'"$OS_PASSWORD"'"} } }, "scope": { "project": { "domain": { "name": "'"$OS_PROJECT_DOMAIN_NAME"'" }, "name":  "'"$OS_PROJECT_NAME"'" } } }}' \
| python -m json.tool
```

We will need to enter the following data :

<table border="1" id="bkmrk-par%C3%A1metro-tipo-descr" style="border-collapse: collapse; width: 100%; height: 203px;"><tbody><tr style="height: 29px;"><td style="width: 33.3333%; height: 29px;">**Parámetro**</td><td style="width: 33.3333%; height: 29px;">**Tipo**</td><td style="width: 33.3333%; height: 29px;">**Descripción**</td></tr><tr style="height: 29px;"><td style="width: 33.3333%; height: 29px;">*User Domain* (requerido)</td><td style="width: 33.3333%; height: 29px;">string</td><td style="width: 33.3333%; height: 29px;">Dominio del user.</td></tr><tr style="height: 29px;"><td style="width: 33.3333%; height: 29px;">username (requerido)</td><td style="width: 33.3333%; height: 29px;">string</td><td style="width: 33.3333%; height: 29px;">Nombre del user.</td></tr><tr style="height: 29px;"><td style="width: 33.3333%; height: 29px;">password (requerido)</td><td style="width: 33.3333%; height: 29px;">string</td><td style="width: 33.3333%; height: 29px;">Password del user.</td></tr><tr style="height: 29px;"><td style="width: 33.3333%; height: 29px;">*Project Domain* (opcional)</td><td style="width: 33.3333%; height: 29px;">string</td><td style="width: 33.3333%; height: 29px;">Dominio del proyecto.</td></tr><tr style="height: 29px;"><td style="width: 33.3333%; height: 29px;">*Project Name* (opcional)</td><td style="width: 33.3333%; height: 29px;">string</td><td style="width: 33.3333%; height: 29px;">Nombre del proyecto.</td></tr><tr style="height: 29px;"><td style="width: 33.3333%; height: 29px;">*Project ID* (opcional)</td><td style="width: 33.3333%; height: 29px;">string</td><td style="width: 33.3333%; height: 29px;">Id del proyecto</td></tr></tbody></table>

Example of the use of curl:

*[![5-2.jpg](https://pandorafms.com/guides/public/uploads/images/gallery/2021-07/scaled-1680-/5-2.jpg)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-07/5-2.jpg)*

In X-Subject-Token we can see the generated token. This will be the token that will have to be introduced when executing the plugin.

At the same time, to use the plugin we will need to have python 3 and the requests module installed, for python 3 we will use the following command in centOS7:

```
yum install python3
```

To install the requests module we will use :

```
pip3 install requests
```

# General plugin parameters

```
python3 pandora_openstack -u <url> -t <token> [ -g <group> ] [ --data_dir <data_dir > ]
```

If the execution was successful we will see a '1' when the plugin is executed.

[![image-1627041199428.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-07/scaled-1680-/image-1627041199428.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-07/image-1627041199428.png)

# Plugin-specific parameters

The plug-in has the following parameters:

<table id="bkmrk-par%C3%A1metro-descripci%C3%B3" style="width: 705px;"><tbody><tr style="height: 35px;"><td style="height: 35px; width: 185px;">**Parámetro**

</td><td style="height: 35px; width: 520px;"><span style="font-weight: 400;">Descripción</span>

</td></tr><tr><td style="width: 185px;"><span style="font-weight: 400;">-u URL, --url URL</span>

</td><td style="width: 520px;">Es obligatorio. Para introducir tu url de autenticación.

</td></tr><tr style="height: 35px;"><td style="height: 35px; width: 185px;"><span style="font-weight: 400;">-h, --help</span>

</td><td style="height: 35px; width: 520px;">Muestra un pequeño mensaje de ayuda.

</td></tr><tr style="height: 35px;"><td style="height: 35px; width: 185px;"><span style="font-weight: 400;">-t TOKEN, --token TOKEN</span>

</td><td style="height: 35px; width: 520px;">Es obligatorio. Para introducir el token generado en Digital Ocean

</td></tr><tr style="height: 35px;"><td style="height: 35px; width: 185px;"><span style="font-weight: 400;">-g GROUP, --group GROUP</span>

</td><td style="height: 35px; width: 520px;"><span style="font-weight: 400;">Grupo de destino de Pandora FMS</span>

</td></tr><tr style="height: 35px;"><td style="height: 35px; width: 185px;"><span style="font-weight: 400;">--data\_dir DATA\_DIR</span>

</td><td style="height: 35px; width: 520px;"><span style="font-weight: 400;">Directorio de datos de Pandora FMS. </span>**Por defecto**<span style="font-weight: 400;"> es /var/spool/pandora/data\_in/</span>

</td></tr></tbody></table>

Help example :

[![image-1627041234813.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-07/scaled-1680-/image-1627041234813.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-07/image-1627041234813.png)

# Manual execution

We can test the plugin from the terminal to see if it works, to check it, we run the plugin:

[![image-1627041255705.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-07/scaled-1680-/image-1627041255705.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-07/image-1627041255705.png)

# Configuration in Pandora

**Installation from the console**

To register the plugin, from the console, go to the "register plugin" section.

**[![register_plugin.png](https://pandorafms.com/guides/public/uploads/images/gallery/2022-04/scaled-1680-/register-plugin.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2022-04/register-plugin.png)**

Click on the file to select it.

**[![register_plugin2.png](https://pandorafms.com/guides/public/uploads/images/gallery/2022-04/scaled-1680-/register-plugin2.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2022-04/register-plugin2.png)**

We will select the .pspz2 file that we have previously downloaded.

**[![registerplugin.png](https://pandorafms.com/guides/public/uploads/images/gallery/2022-04/scaled-1680-/registerplugin.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2022-04/registerplugin.png)**

Once uploaded, this message will be displayed, showing that it has been uploaded correctly.

**[![register_plugin openstack_.png](https://pandorafms.com/guides/public/uploads/images/gallery/2022-04/scaled-1680-/cskregister-plugin-openstack.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2022-04/cskregister-plugin-openstack.png)**

Once the plugin is registered, we will see it in the plugins section.

[![serversingles.png](https://pandorafms.com/guides/public/uploads/images/gallery/2022-04/scaled-1680-/serversingles.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2022-04/serversingles.png)

We will be able to see how it has been loaded and access it by clicking on its title.

**[![register_openstack.png](https://pandorafms.com/guides/public/uploads/images/gallery/2022-04/scaled-1680-/register-openstack.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2022-04/register-openstack.png)**

In the menu of the plugin we will be able to see the preloaded macros, nevertheless all of them will appear, it is necessary to investigate which are the appropriate ones for each use, and in the case that it is not necessary the use of some of them, to delete them.

**[![register_plugin openstack.png](https://pandorafms.com/guides/public/uploads/images/gallery/2022-04/scaled-1680-/register-plugin-openstack.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2022-04/register-plugin-openstack.png)**

Below, you can insert the value of the macro in the "Default value" field.

**[![register_plugin_openstack.png](https://pandorafms.com/guides/public/uploads/images/gallery/2022-04/scaled-1680-/Mt5register-plugin-openstack.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2022-04/Mt5register-plugin-openstack.png)**

The best way to manage server plugins in Pandora is from "/usr/share/pandora\_server/util/plugin" so we will send it by pscp to that path:

https://pandorafms.com/guides/public/link/269#bkmrk-nos-ubicamos-en-el-t  
  
We go to the terminal from the path where we have located the plugin and we introduce the following command:

```
pscp -P 22 pandora_openstack.py root@<ip-de-la-maquina>:/usr/share/pandora_server/util/plugin
```

[![image-1626781044164.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-07/scaled-1680-/image-1626781044164.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-07/image-1626781044164.png)

Now, if we go into the folder where we have placed the plugin:

```
cd /usr/share/pandora_server/util/plugin
```

and run it with the parameters mentioned above:

```
python3 pandora_openstack.py -u <url> -t <token>
```

[![image-1627041303281.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-07/scaled-1680-/image-1627041303281.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-07/image-1627041303281.png)

the agents will be created in our pandora console, in resources &gt; manage agents

[![image-1627041311621.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-07/scaled-1680-/image-1627041311621.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-07/image-1627041311621.png)

It could also be created from the server plugins menu, to do this, go to the "servers" menu and click on "plugins":

[![image-1626781180446.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-07/scaled-1680-/image-1626781180446.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-07/image-1626781180446.png)

Download and click on "add plugins":

[![image-1626781210188.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-07/scaled-1680-/image-1626781210188.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-07/image-1626781210188.png)

We name and describe it:

[![image-1626781242396.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-07/scaled-1680-/image-1626781242396.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-07/image-1626781242396.png)

We configure the parameters that it is going to use, in this case, the 3 essential ones are those of the url, instance and token, they are macros. In plugin command, we introduce the path where we have located the plugin.

[![image-1626781272867.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-07/scaled-1680-/image-1626781272867.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-07/image-1626781272867.png)

We configure the macros by entering the name we want for each one, and its attribute.

[![image-1626781325929.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-07/scaled-1680-/image-1626781325929.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-07/image-1626781325929.png)

To see how we can get the token, see the "configuration" section of this manual.

To see how we can find out the url and instance id, go to "frequently asked questions".

# Modules generated by the plugin

An agent will be created for each machine in our openstack installation., with its metrics (to load the data of another instance, we will have to execute the plugin again, changing the id of the instance. Apart from this, an agent will be created for each hypervisor used in our installation.

[![image-1627041331234.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-07/scaled-1680-/image-1627041331234.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-07/image-1627041331234.png)

**Instance agent modules**

<table border="1" id="bkmrk-nombre-descripci%C3%B3n-m" style="border-collapse: collapse; width: 100%;"><tbody><tr><td style="width: 50%;">**Nombre**</td><td style="width: 50%;">**Descripción**</td></tr><tr><td style="width: 50%;">memory</td><td style="width: 50%;">memory used by the machine</td></tr><tr><td style="width: 50%;">memory-actual</td><td style="width: 50%;">memory actual used by the machine</td></tr><tr><td style="width: 50%;">memory-rss</td><td style="width: 50%;">Resident Set Size and is used to show how much memory is allocated</td></tr><tr><td style="width: 50%;">vda\_errors</td><td style="width: 50%;">diagnostics for a libvirt based instance, vda receibed errors</td></tr><tr><td style="width: 50%;">vda\_read</td><td style="width: 50%;">diagnostics for a libvirt based instance, vda dates read</td></tr><tr><td style="width: 50%;">vda\_read\_req</td><td style="width: 50%;">diagnostics for a libvirt based instance, vda dates requests read</td></tr><tr><td style="width: 50%;">vda\_write</td><td style="width: 50%;">diagnostics for a libvirt based instance, vda dates write</td></tr><tr><td style="width: 50%;">vda\_write\_req</td><td style="width: 50%;">diagnostics for a libvirt based instance, vda write requests dates</td></tr></tbody></table>

[![instance.JPG](https://pandorafms.com/guides/public/uploads/images/gallery/2021-07/scaled-1680-/instance.JPG)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-07/instance.JPG)

**Modules generated in the hypervisor agents:**

<table border="1" id="bkmrk-nombre-descripci%C3%B3n-f" style="border-collapse: collapse; width: 100%; height: 290px;"><tbody><tr style="height: 29px;"><td style="width: 50%; height: 29px;">**Nombre**</td><td style="width: 50%; height: 29px;">**Descripción**</td></tr><tr style="height: 29px;"><td style="width: 50%; height: 29px;">free\_disk\_gb</td><td style="width: 50%; height: 29px;">avalaible disk space</td></tr><tr style="height: 29px;"><td style="width: 50%; height: 29px;">free\_ram\_mb</td><td style="width: 50%; height: 29px;">available ram</td></tr><tr style="height: 29px;"><td style="width: 50%; height: 29px;">disk\_available\_least</td><td style="width: 50%; height: 29px;">this value is dependent on over committed value of disk, disk\_available\_least = disk\_free\_gb - disk\_over\_committed</td></tr><tr style="height: 29px;"><td style="width: 50%; height: 29px;">local\_gb</td><td style="width: 50%; height: 29px;">the total available disk for the node's virtual machine, local\_gb = local\_gb\_used + free\_disk\_gb</td></tr><tr style="height: 29px;"><td style="width: 50%; height: 29px;">local\_gb\_used</td><td style="width: 50%; height: 29px;">the sum of the node's virtual machine disk</td></tr><tr style="height: 29px;"><td style="width: 50%; height: 29px;">memory\_mb</td><td style="width: 50%; height: 29px;">the total ram of the node, memory\_mb\_used + free\_ram\_mb</td></tr><tr style="height: 29px;"><td style="width: 50%; height: 29px;">memory\_mb\_used</td><td style="width: 50%; height: 29px;">the sum of the rams of the node's virtual machine</td></tr><tr style="height: 29px;"><td style="width: 50%; height: 29px;">vcpus</td><td style="width: 50%; height: 29px;">node ​​physical cpu total threads</td></tr><tr style="height: 29px;"><td style="width: 50%; height: 29px;">vcpus\_used</td><td style="width: 50%; height: 29px;">the sum of the vcpus of the node virtual machine</td></tr></tbody></table>

<table border="1" id="bkmrk-current_workload-hyp" style="border-collapse: collapse; width: 100%;"><tbody><tr><td style="width: 50%;">current\_workload</td><td style="width: 50%;">hypervisor current workload</td></tr><tr><td style="width: 50%;">host\_ip</td><td style="width: 50%;">hypervisor host ip</td></tr><tr><td style="width: 50%;">hypervisor\_type</td><td style="width: 50%;">hypervisor type</td></tr><tr><td style="width: 50%;">hypervisor\_version</td><td style="width: 50%;">hypervisor version</td></tr><tr><td style="width: 50%;">running\_vms</td><td style="width: 50%;">number of virtual machines running</td></tr></tbody></table>

[![hypervisor.JPG](https://pandorafms.com/guides/public/uploads/images/gallery/2021-07/scaled-1680-/hypervisor.JPG)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-07/hypervisor.JPG)

# Frequently asked questions

**Where can I find the API authentication url of my openstack installation?**

In API access, the "Compute" service endpoint.

[![image-1626781636240.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-07/scaled-1680-/image-1626781636240.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-07/image-1626781636240.png)

**How do I generate an authentication token?**

This is explained in detail in the "configuration" section of this manual.