# Kafka

# Introduction

Ver. 11-10-2022

The plugin gets metrics on producer and consumer performance

This is ported from the Java producer, for details see:

[https://kafka.apache.org/documentation/#consumer\_monitoring](https://kafka.apache.org/documentation/#consumer_monitoring)  
[https://kafka.apache.org/documentation/#producer\_monitoring](https://kafka.apache.org/documentation/#producer_monitoring)

<div id="bkmrk-tipo%3A-server-plug-in"><div>**Tipo**: Server plug-in </div></div>

# Compatibility matrix

<table border="1" id="bkmrk-sistemas-donde-se-ha" style="width: 642px;"><tbody><tr><td style="width: 234px;"><div>**<span class="HwtZe" lang="en"><span class="jCAhz ChMk0b"><span class="ryNqvb">Systems where it has been tested</span></span></span>**</div></td><td style="width: 408px;">Rocky linux

</td></tr><tr><td style="width: 234px;"><div>**<span class="HwtZe" lang="en"><span class="jCAhz ChMk0b"><span class="ryNqvb">Systems where it should work</span></span></span>**</div></td><td style="width: 408px;">Any linux system

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

# Pre requisites

- <span class="HwtZe" lang="en"><span class="jCAhz ChMk0b"><span class="ryNqvb">Have the Pandora FMS Data Server enabled</span></span></span>
- <span class="HwtZe" lang="en"><span class="jCAhz ChMk0b"><span class="ryNqvb">Have the Pandora FMS Plugin Server enabled</span></span></span>

# Parameters

<table border="1" id="bkmrk-par%C3%A1metro-descripci%C3%B3" style="width: 884px; height: 363.533px;"><tbody><tr style="height: 29.6333px;"><td style="width: 177px; height: 29.6333px;">**Parameter**</td><td style="width: 707px; height: 29.6333px;">**Description**</td></tr><tr style="height: 80.0333px;"><td style="width: 177px; height: 80.0333px;">--bootstrap\_servers</td><td style="width: 707px; height: 80.0333px;">String 'host\[:port\]' (or list of strings 'host\[:port\]') that the producer must contact to start the metadata from the initial cluster. This does not have to be the complete list of nodes. It only needs to have at least one broker that responds to a metadata API request. The default port is 9092. If no server is specified, the default port will be localhost:9092.</td></tr><tr style="height: 29.6333px;"><td style="width: 177px; height: 29.6333px;">--topics</td><td style="width: 707px; height: 29.6333px;">List of topics separated by commas</td></tr><tr style="height: 29.6333px;"><td style="width: 177px; height: 29.6333px;">--topic\_regex</td><td style="width: 707px; height: 29.6333px;">Regex for subscription (overwrites --topics)</td></tr><tr style="height: 29.6333px;"><td style="width: 177px; height: 29.6333px;">--agent\_prefix</td><td style="width: 707px; height: 29.6333px;">Prefix for the names of created agents</td></tr><tr style="height: 29.6333px;"><td style="width: 177px; height: 29.6333px;">--module\_prefix</td><td style="width: 707px; height: 29.6333px;">Prefix for the names of the modules created</td></tr><tr style="height: 29.6333px;"><td style="width: 177px; height: 29.6333px;">--transfer\_mode</td><td style="width: 707px; height: 29.6333px;">Shipping mode (tentacle by default)</td></tr><tr style="height: 29.6333px;"><td style="width: 177px; height: 29.6333px;">--tentacle\_ip</td><td style="width: 707px; height: 29.6333px;">Tentacle server IP (default: 127.0.0.1)</td></tr><tr><td style="width: 177px;">--tentacle\_port</td><td style="width: 707px;">Tentacle Port (default: 41121)</td></tr><tr style="height: 46.4333px;"><td style="width: 177px; height: 46.4333px;">--verbose</td><td style="width: 707px; height: 46.4333px;">Debug mode</td></tr></tbody></table>

# Manual execution

```
./pandora_kafka\
  --bootstrap_servers <ip:port[,ip:port,...]> \
  [ --topics <topic1,topic2,...> ] \
  [ --topic_regex <regex_pattern> ] \
  [ --agent_prefix <prefix> ] \
  [ --module_prefix <prefix> ] \
  [ --transfer_mode <tentacle|local> ] \
  [ --tentacle_ip <ip> ] \
  [ --tentacle_port <port> ] \
  [ --verbose ]
```

For example:

```
./pandora_kafka \
  --bootstrap_servers kafka1:9092,kafka2:9092 \
  --topic_regex "^prod-.*" \
  --agent_prefix KAFKA_ \
  --module_prefix METRIC_ \
  --transfer_mode tentacle \
  --tentacle_ip 10.0.0.20 \
  --tentacle_port 41121 \
  --verbose
```

# 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:

<div id="bkmrk-%2Fpath_pandora_kafka"><div><div><div><div><div><div><div>```
<span role="presentation">/path_pandora_kafka</span>
```

</div></div></div></div></div></div><div></div><div><div></div></div></div></div><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.Although it is not mandatory, it is highly recommended the use of the --agent\_alias 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 --module\_prefix parameter, since 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.

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

<span class="HwtZe" lang="en"><span class="jCAhz ChMk0b"><span class="ryNqvb">The plugin will create an agent with a customizable name with the --agent\_alias parameter or with the default "Kafka" name that will contain all the modules of the execution.</span></span></span>

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

**Módules**

 ***<span style="text-decoration: underline;">Producer</span>***

*<span style="text-decoration: underline;">kafka-metrics-count</span>*

<table border="1" id="bkmrk-count" style="border-collapse: collapse; width: 100%;"><tbody><tr><td style="width: 100%;">count</td></tr></tbody></table>

<span style="text-decoration: underline;">*producer-metrics*</span>

<table border="1" id="bkmrk-connection-close-rat" style="border-collapse: collapse; width: 100%; height: 986px;"><tbody><tr style="height: 29px;"><td style="width: 100%; height: 29px;">connection-close-rate</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">connection-creation-rate</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">select-rate</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">io-wait-time-ns-avg</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">io-wait-ratio</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">io-time-ns-avg</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">io-ratio</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">connection-count</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">network-io-rate</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">outgoing-byte-rate</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">request-rate</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">request-size-avg</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">request-size-max</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">incoming-byte-rate</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">response-rate</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">request-latency-avg</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">request-latency-max</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">bufferpool-wait-ratio</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">batch-size-avg</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">batch-size-max</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">compression-rate-avg</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">record-queue-time-avg</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">record-queue-time-max</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">produce-throttle-time-avg</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">produce-throttle-time-max</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">record-send-rate</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">records-per-request-avg</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">byte-rate</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">record-retry-rate</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">record-error-rate</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">record-size-max</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">record-size-avg</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">requests-in-flight</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">metadata-age</td></tr></tbody></table>

<span style="text-decoration: underline;">*producer-node-metrics.node-&lt;node&gt;*</span>

<table border="1" id="bkmrk-outgoing-byte-rate-r" style="border-collapse: collapse; width: 100%; height: 232px;"><tbody><tr style="height: 29px;"><td style="width: 100%; height: 29px;">outgoing-byte-rate</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">request-rate</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">request-size-avg</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">request-size-max</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">incoming-byte-rate</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">response-rate</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">request-latency-avg</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">request-latency-max</td></tr></tbody></table>

**<span style="text-decoration: underline;">*Consumer*</span>**

*<span style="text-decoration: underline;">kafka-metrics-count</span>*

<table border="1" id="bkmrk-count-0" style="border-collapse: collapse; width: 100%;"><tbody><tr><td style="width: 100%;">count</td></tr></tbody></table>

<span style="text-decoration: underline;">*consumer-metrics*</span>

<table border="1" id="bkmrk-connection-close-rat-0" style="border-collapse: collapse; width: 100%; height: 986px;"><tbody><tr style="height: 29px;"><td style="width: 100%; height: 29px;">connection-close-rate</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">connection-creation-rate</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">select-rate</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">io-wait-time-ns-avg</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">io-wait-ratio</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">io-time-ns-avg</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">io-ratio</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">connection-count</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">network-io-rate</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">outgoing-byte-rate</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">request-rate</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">request-size-avg</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">request-size-max</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">incoming-byte-rate</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">response-rate</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">request-latency-avg</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">request-latency-max</td></tr></tbody></table>

<span style="text-decoration: underline;">*consumer-node-metrics.node-&lt;node&gt;*</span>

<table border="1" id="bkmrk-outgoing-byte-rate-r-0" style="border-collapse: collapse; width: 100%; height: 232px;"><tbody><tr style="height: 29px;"><td style="width: 100%; height: 29px;">outgoing-byte-rate</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">request-rate</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">request-size-avg</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">request-size-max</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">incoming-byte-rate</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">response-rate</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">request-latency-avg</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">request-latency-max</td></tr></tbody></table>

<span style="text-decoration: underline;">*consumer-fetch-manager-metrics*</span>

<table border="1" id="bkmrk-fetch-size-avg-fetch" style="border-collapse: collapse; width: 100%; height: 319px;"><tbody><tr style="height: 29px;"><td style="width: 100%; height: 29px;">fetch-size-avg</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">fetch-size-max</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">bytes-consumed-rate</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">records-per-request-avg</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">records-consumed-rate</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">fetch-latency-avg</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">fetch-latency-max</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">fetch-rate</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">records-lag-max</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">fetch-throttle-time-avg</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">fetch-throttle-time-max</td></tr></tbody></table>

*<span style="text-decoration: underline;">consumer-coordinator-metrics</span>*

<table border="1" id="bkmrk-heartbeat-response-t" style="border-collapse: collapse; width: 100%; height: 377px;"><tbody><tr style="height: 29px;"><td style="width: 100%; height: 29px;">heartbeat-response-time-max</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">heartbeat-rate</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">join-time-avg</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">join-time-max</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">join-rate</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">sync-time-avg</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">sync-time-max</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">sync-rate</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">last-heartbeat-seconds-ago</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">commit-latency-avg</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">commit-latency-max</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">commit-rate</td></tr><tr style="height: 29px;"><td style="width: 100%; height: 29px;">assigned-partitions</td></tr></tbody></table>