# 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
**Systems where it has been tested**CentOS 7
**Systems where it should work**Any linux system
# 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 :
**Parámetro****Tipo****Descripción**
*User Domain* (requerido)stringDominio del user.
username (requerido)stringNombre del user.
password (requerido)stringPassword del user.
*Project Domain* (opcional)stringDominio del proyecto.
*Project Name* (opcional)stringNombre del proyecto.
*Project ID* (opcional)stringId del proyecto
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 -t [ -g ] [ --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:
**Parámetro** Descripción
-u URL, --url URL Es obligatorio. Para introducir tu url de autenticación.
-h, --help Muestra un pequeño mensaje de ayuda.
-t TOKEN, --token TOKEN Es obligatorio. Para introducir el token generado en Digital Ocean
-g GROUP, --group GROUP Grupo de destino de Pandora FMS
--data\_dir DATA\_DIR Directorio de datos de Pandora FMS. **Por defecto** es /var/spool/pandora/data\_in/
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@:/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 -t ``` [![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 > 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**
**Nombre****Descripción**
memorymemory used by the machine
memory-actualmemory actual used by the machine
memory-rssResident Set Size and is used to show how much memory is allocated
vda\_errorsdiagnostics for a libvirt based instance, vda receibed errors
vda\_readdiagnostics for a libvirt based instance, vda dates read
vda\_read\_reqdiagnostics for a libvirt based instance, vda dates requests read
vda\_writediagnostics for a libvirt based instance, vda dates write
vda\_write\_reqdiagnostics for a libvirt based instance, vda write requests dates
[![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:**
**Nombre****Descripción**
free\_disk\_gbavalaible disk space
free\_ram\_mbavailable ram
disk\_available\_leastthis value is dependent on over committed value of disk, disk\_available\_least = disk\_free\_gb - disk\_over\_committed
local\_gbthe total available disk for the node's virtual machine, local\_gb = local\_gb\_used + free\_disk\_gb
local\_gb\_usedthe sum of the node's virtual machine disk
memory\_mbthe total ram of the node, memory\_mb\_used + free\_ram\_mb
memory\_mb\_usedthe sum of the rams of the node's virtual machine
vcpusnode ​​physical cpu total threads
vcpus\_usedthe sum of the vcpus of the node virtual machine
current\_workloadhypervisor current workload
host\_iphypervisor host ip
hypervisor\_typehypervisor type
hypervisor\_versionhypervisor version
running\_vmsnumber of virtual machines running
[![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.