# DB2 Remote

# Introduction

**Ver**. 13-12-2022

Plug-in with which you can monitor DB2 databases, being able to execute customized queries.

**Type**: Server plug-in

# Compatibility matrix

<table border="1" id="bkmrk-sistemas-donde-se-ha" style="width: 1018px;"><tbody><tr><td style="width: 219.891px;">**Systems where tested**</td><td style="width: 589.109px;">CentOS 7, Fedora, rocky linux

</td></tr><tr><td style="width: 219.891px;">**Systems where it should work**</td><td style="width: 589.109px;">Cualquier sistema linux

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

# Pre requisites

- Pandora FMS **Data Server** enabled
- Pandora FMS **Plugin Server** enabled
- Have python3 installed
- have the ibm\_db library installed

# Parameters

**Parameters**

<table border="1" id="bkmrk-%C2%A0-%C2%A0-%C2%A0-%C2%A0-%C2%A0-%C2%A0-%C2%A0-%C2%A0-%C2%A0-%C2%A0-" style="height: 261px; width: 811px;"><tbody><tr style="height: 29px;"><td style="height: 29px; width: 133.993px;">--hostname</td><td style="height: 29px; width: 675px;">Ip or host </td></tr><tr style="height: 29px;"><td style="height: 29px; width: 133.993px;">--uid</td><td style="height: 29px; width: 675px;">Name of the user who will perform the queries</td></tr><tr style="height: 29px;"><td style="height: 29px; width: 133.993px;">--password</td><td style="height: 29px; width: 675px;">Password of the user who will perform the queries</td></tr><tr style="height: 29px;"><td style="height: 29px; width: 133.993px;">--port</td><td style="height: 29px; width: 675px;">Default 50000</td></tr><tr style="height: 29px;"><td style="height: 29px; width: 133.993px;">--database</td><td style="height: 29px; width: 675px;">Database name</td></tr><tr style="height: 29px;"><td style="height: 29px; width: 133.993px;">--protocol</td><td style="height: 29px; width: 675px;">Default : TCPIP</td></tr><tr style="height: 29px;"><td style="height: 29px; width: 133.993px;">--default\_metrics</td><td style="height: 29px; width: 675px;">Default metrics, deactivate by setting to 0</td></tr><tr style="height: 29px;"><td style="height: 29px; width: 133.993px;">--conf</td><td style="height: 29px; width: 675px;">Link to the conf containing the queries</td></tr></tbody></table>

**Parameters pandora**

<table border="1" id="bkmrk-par%C3%A1metro-descripci%C3%B3"><tbody><tr><td style="width: 161.997px;">--tentacle\_port</td><td style="width: 643.993px;">Tentacle port (default 41121) (optional)</td></tr><tr><td style="width: 161.997px;">--tentacle\_address</td><td style="width: 643.993px;">Ip of the tentacle server to send the data to (optional)</td></tr><tr><td style="width: 161.997px;">-g,--group</td><td style="width: 643.993px;">Pandora FMS target group (optional)</td></tr><tr><td style="width: 161.997px;">--data\_dir</td><td style="width: 643.993px;">Pandora FMS data directory. **By default** it is */var/spool/pandora/data\_in/* (optional)</td></tr><tr><td style="width: 161.997px;">--as\_agent\_plugin</td><td style="width: 643.993px;">It is optional, if you want the plugin to be an agent plugin and put the modules in the pandora agent, execute this with a 1 (optional)</td></tr></tbody></table>

# Manual execution

```
python3 pandora_db2.py --hostname <host> --uid <user> --database <database> --password <password> --conf <path conf> --as_agent_plugin 1
```

The data returned by the query would be returned in list format in the module, for example this query:

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

the xml would look like this:

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

# Configuration in pandora fms

**As server plugin**

**Manual installation**

Go to servers &gt; plugins:

[![ver plugin.png](https://pandorafms.com/guides/public/uploads/images/gallery/2025-07/scaled-1680-/pzpver-plugin.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2025-07/pzpver-plugin.png)

Click on add:

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

We put in name and the description that is preferred.

We put as command the execution with the path of the plugin:

```
/path_pandora_db2.py
```

<p class="callout info align-center">Remember that the recommended path for the use of the server plugins is: /usr/share/pandora\_server/util/plugin/</p>

And in plugin parameters we will introduce these followed by the macro "\_field&lt;N&gt;\_", the connection parameters --hostname, --uid, --database and --password are mandatory, by default the plugin has enabled the extraction of some metrics, these can be disabled by setting the --default\_metrics parameter to 0. The port and protocol can be changed if the default is not used.

<p class="callout warning">Remember that you can give a custom name to the agents with the --agent\_name parameter</p>

Once this is done, we will click on "create".

Once this is done, the only thing left to do is to call it so we will go to some agent's view and create a plugin module:

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

We will give it a name and in the section "plugin" we will put the one we have just configured.

Once this is done, click on create.

If the module is shown with 1, it means that it is running correctly.

# Modules generated by the plugin

The plugin will create an agent, with modules for the defined custom queries.

In turn, if the --default\_metrics option is not set to 0, it will create an agent with the following modules:

<table border="1" id="bkmrk-no_of_bufferpools-to" style="border-collapse: collapse; width: 100%;"><tbody><tr><td style="width: 100%;">no\_of\_bufferpools</td></tr><tr><td style="width: 100%;">total\_logical\_reads</td></tr><tr><td style="width: 100%;">total\_physical\_reads</td></tr><tr><td style="width: 100%;">data\_logical\_reads</td></tr><tr><td style="width: 100%;">data\_physical\_reads</td></tr><tr><td style="width: 100%;">index\_logical\_reads</td></tr><tr><td style="width: 100%;">xda\_logical\_reads</td></tr><tr><td style="width: 100%;">log\_utilization\_percent</td></tr><tr><td style="width: 100%;">total\_log\_used\_kb</td></tr><tr><td style="width: 100%;">total\_log\_available\_kb</td></tr></tbody></table>