# Pandora Azure Event Hubs

# Introduction

**Ver.** 23-08-2022

Plugin to monitor an azure Event Hubs namespace.

**Type:** Server plug-in

# Compatibility matrix

<table border="1" id="bkmrk-sistemas-donde-se-ha"><tbody><tr><td>**Systems where tested**</td><td>CentOS 7, Fedora, rocky linux

</td></tr><tr><td>**Systems where it should work**</td><td>Any linux system

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

# Prerequisites

- Pandora FMS **Data Server** enabled
- Have the Pandora FMS **Plugin Server** enabled.
- Know some credentials of your account, such as your tenant id, secret, client id and namespace resource id.

# Previous configuration

The plugin makes use of a file in which two types of data can be entered.

```
#credentials
tenant_id:<tenant-id>
client_id:<client-id>
secret:<secret>
#id resources
eventhubspacename_id:<event_hub_namespace_resource_id>
```

**Obtaining credentials necessary for the use of the plugin.**

**1. Credentials to authenticate:**

-Tenant id

-Client id

-Secret

**2. Resource id**

**The resource id of each resource monitored by the plugin is required, these are :**

\- Database resource id

**Obtaining tenant id and client id.**

1\. To obtain the tenant id and the client id, we will go to the application registry menu inside the active directory:

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

2\. We will enter inside the application.

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

3\. The tenant id and client id will appear in the application menu.

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

4\. To find the secret we will go to certificates and secrets inside the active directory menu.

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

5\. Within this menu we will be able to see the secret keys or generate them (it has to be the key value, not the id).

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

**Obtaining the resource id from the database.**

In the namespace, under general information, we can see the resource id of the event hub by clicking on json view.

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

# Parameters

<table border="1" id="bkmrk-par%C3%A1metro-descripci%C3%B3" style="width: 100%;"><tbody><tr><td style="width: 16.81%;">**Parameters**</td><td style="width: 83.19%;">**Description**</td></tr><tr><td style="width: 16.81%;">--timespan</td><td style="width: 83.19%;">In hours (optional), last time period, can be used in a custom run to display data from a time period (optional). </td></tr><tr><td style="width: 16.81%;">--metric</td><td style="width: 83.19%;">Name of the metric for custom execution (optional).</td></tr><tr><td style="width: 16.81%;">--granularity</td><td style="width: 83.19%;">In minutes combined with timespan will show you the data in intervals (optional). </td></tr><tr><td style="width: 16.81%;">--name\_module</td><td style="width: 83.19%;">To choose the name of the module in a custom run (optional).</td></tr><tr><td style="width: 16.81%;">--tentacle\_port</td><td style="width: 83.19%;">Tentacle port (default 41121) (optional)</td></tr><tr><td style="width: 16.81%;">--tentacle\_address</td><td style="width: 83.19%;">Ip of the tentacle server to send the data to (optional)</td></tr><tr><td style="width: 16.81%;">--agent\_name</td><td style="width: 83.19%;">To name the agent that will contain the modules, by default: "Azure SQL" (optional).</td></tr><tr><td style="width: 16.81%;">--prefix\_module</td><td style="width: 83.19%;">To prefix the modules in case you want to differentiate them from other executions (optional).</td></tr><tr><td style="width: 16.81%;">--conf</td><td style="width: 83.19%;">Path of the conf file with the queries (required)</td></tr><tr><td style="width: 16.81%;">-g,--group</td><td style="width: 83.19%;">Pandora FMS target group (optional)</td></tr><tr><td style="width: 16.81%;">--data\_dir</td><td style="width: 83.19%;">Pandora FMS data directory. **By default** it is */var/spool/pandora/data\_in/* (optional)</td></tr><tr><td style="width: 16.81%;">--as\_agent\_plugin</td><td style="width: 83.19%;">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

**Manual execution**

```
./pandora_azureventhubs --conf <path-conf> --as_agent_plugin 1
```

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

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

**Custom manual execution**

```
./pandora_azureventhubs --conf <path-conf> --as_agent_plugin 1 --timespan <period in hours> --granularity <interval in minutes> --metric <name-metric> --name_module <name_module>
```

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

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

# Configuration in PandoraFMS

**As server plugin**

**Manual installation**

Go to servers &gt; plugins:

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

Click on add:

[![image-1629974430627.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-08/scaled-1680-/image-1629974430627.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-08/image-1629974430627.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_azureventhubs
```

<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 parameters of the plugin we will introduce these followed by the macro "\_field&lt;N&gt;\_", the obligatory one for it to work is --conf.

<p class="callout warning">Although it is not mandatory, it is highly recommended the use of the --agent\_name parameter, since it allows us to customize the name of the agent that will contain the modules created for each customized query. It is also advisable to use the --prefix\_module parameter, because this will allow us to assign a prefix to the modules, which can be useful to recognize them faster and differentiate them if we create several executions for different databases.</p>

**--CONF**

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

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 an add-in module:

[![image-1646741530197.png](https://pandorafms.com/guides/public/uploads/images/gallery/2022-03/scaled-1680-/image-1646741530197.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2022-03/image-1646741530197.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 the name we have set with the --agent\_name parameter.

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

And it will create the following modules:

<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-"><tbody><tr><td><div><div>SuccessfulRequests</div></div></td></tr><tr><td><div><div>ServerErrors</div></div></td></tr><tr><td><div><div>UserErrors</div></div></td></tr><tr><td><div><div>QuotaExceededErrors</div></div></td></tr><tr><td><div><div>ThrottledRequests</div></div></td></tr><tr><td><div><div>IncomingRequests</div></div></td></tr><tr><td><div><div>IncomingMessages</div></div></td></tr><tr><td><div><div>IncomingBytes</div></div></td></tr><tr><td><div><div>OutgoingBytes</div></div></td></tr><tr><td><div><div>ActiveConnections</div></div></td></tr><tr><td><div><div>ConnectionsOpened</div></div></td></tr><tr><td><div><div>ConnectionsClosed</div></div></td></tr><tr><td><div><div>CaptureBacklog</div></div></td></tr><tr><td><div><div>CapturedMessages</div></div></td></tr><tr><td><div><div>CapturedBytes</div></div></td></tr><tr><td><div><div>Size</div></div></td></tr><tr><td><div><div>NamespaceCpuUsage</div></div></td></tr><tr><td><div><div>NamespaceMemoryUsage</div></div></td></tr></tbody></table>

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