Kafka Integration
This integration guide describes how to monitor availability and performance of Apache Kafka with ATSD.
Step 1: Configure Collector
- Log in to the Collector web interface at
https://collector_hostname:9443
- From the Jobs page select Import by expanding the split-button below the table.
- Import the
kafka-jmx
job. - On the JMX Job page, enable the job status with the Enabled checkbox.
- Adjust the
cron
expression if required. For more information oncron
expressions, see Scheduling. - Select a target ATSD database to store data.
- Click Save.
Configure series collection
Select
kafka-series
configuration.On the JMX Configuration page, enter the JMX connection parameters or use an Item List with predefined kafka parameters:
- Host: Kafka hostname.
- Port: JMX port.
- User Name: JMX user name.
- Password: Password for JMX user.
- Entity: Optionally, specify the output of the hostname command on the Kafka server if it is different from
kafka_hostname
(for example ifkafka_hostname
represents a fully qualified name). - Other parameters are optional. For more information on JMX configuration, see JMX Job Documentation.
Click Test to validate the configuration.
Click Save.
Configure properties collection
Select
kafka-properties
configuration.Set Host, Port, User Name, Password, and Entity fields as described in the previous section.
Click Test to validate the configuration.
Click Save.
Step 2: Configure Kafka in ATSD
- Log in to the target ATSD instance at
https://atsd_hostname:8443
. - Navigate to the Metrics page and verify that
jmx.kafka.*
metrics are available. - Navigate to the Entities page and verify that
jmx.kafka.*
properties are available for entities fromkafka-properties
configuration. - Open the Settings > Entity Groups page and import Kafka entity group.
- Expand the Portals menu, click Configure and import Kafka portals (Enable Auto-enable New Portals).
- Open the Alerts menu, click Rules and import Kafka rules (Enable Auto-enable New Rules).
- Open the Entity Views menu, select Configure and import Kafka Entity View configuration.
Step 3: Verification
Select an open
Kafka
on the Entity Views menu:Verify that the portal in the table header is available and refers to the Kafka portal:
Verify that the portal for each entity refers to the Broker portal:
Consumer Lag
Consumer lag calculation requires information about producer offset and consumer offset.
Producer offset is collected from Kafka brokers by the JMX Job above.
Consumer offset is collected using a Kafka console consumer reading events from the __consumer_offset
topic on one of the Kafka servers in the cluster.
Log in to the Kafka server.
Download the shell script to the Kafka bin
directory.
# assign execute permission
chmod +x /opt/kafka_2.12-1.0.0/bin/send_offset.sh
For Kafka versions before 0.10.2.0
use --zookeeper
option instead bootstrap-server
in the script.
Replace ATSD_HOST
and TCP_PORT
with actual values and launch the script.
The default ATSD TCP command port is
8081
.
The script reads and sends topic offsets to ATSD under the hostname entity.
Launch the script:
nohup /opt/kafka_2.12-1.0.0/bin/send_offset.sh ATSD_HOST TCP_PORT &
If the hostname is different from the entity name used in the JMX job, specify the entity manually.
nohup /opt/kafka_2.12-1.0.0/bin/send_offset.sh ATSD_HOST TCP_PORT ENTITY &
The script continuously reads consumer offsets from Kafka and sends the offsets to ATSD as series
commands. Kafka also copies the commands stdout
for debugging.
series e:nurswgvml702 m:kafka.consumer_offset=455 t:groupid="console-consumer-72620" t:topic="test" t:partition=0 ms:1519893731570
series e:nurswgvml702 m:kafka.consumer_offset=492 t:groupid="console-consumer-72620" t:topic="test" t:partition=0 ms:1519893736569
series e:nurswgvml702 m:kafka.consumer_offset=492 t:groupid="console-consumer-72620" t:topic="test" t:partition=0 ms:1519893741570
series e:nurswgvml702 m:kafka.consumer_offset=550 t:groupid="console-consumer-72620" t:topic="test" t:partition=0 ms:1519893746570
- Check that metric
kafka.consumer_offset
is available on the Metrics tab in ATSD. - Import Consumer Lag Portal into ATSD and change the topic name to view the consumer lag.
For additional Kafka integration, see Brokers Monitoring and Consumers Monitoring.