Apache Kafka® is a distributed, fault-tolerant streaming platform. It can be used to process streams of data in real-time.The Kafka Monitoring extension can be used with a standalone machine agent to provide metrics for multiple Apache Kafka.
Java 8
to build the extension artifact from source. You can check the java version used in maven using command mvn -v
or mvn --version
. If your maven is using some other java version then please download java 8 for your platform and set JAVA_HOME parameter before starting maven.git clone <repoUrl>
command.Test connection to the Kafka host and ports 9999 and 9998 from the machine where the extension is installed.
For example, to test connection to the localhost on port 9999, use
nc -v localhost 9999.
Connection to localhost port 9999 [tcp/distinct] succeeded!
is displayed, it confirms the access to the Kafka server.<Kafka Installation Folder>/bin/kafka-server-start.sh
to include:export JMX_PORT=${JMX_PORT:-9999}
This section outlines the configuration of the Kafka start-up scripts if monitoring is not done over SSL.If SSL is being used please skip to Setting up SSL in Kafka.
<Kafka Installation Folder>/bin/kafka-run-class.sh
and modify KAFKA_JMX_OPTS
variable like belowKAFKA_JMX_OPTS="-Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.rmi.port=9998 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"
-Djava.rmi.server.hostname=your.host.ip
to the KAFKA_JMX_OPTS
variable if you are monitoring Kafka from a remote machine.kafka-run-class.sh
has to be made on all the Kafka servers that are being monitored.kafka-run-class.sh
needs the Kafka server to be restarted for the changes to take effect.
If you need to monitor your Kafka servers securely via SSL, please follow the following steps:
Edit <Kafka Installation Folder>/bin/kafka-run-class.sh
and modify KAFKA_JMX_OPTS
variable, as listed below:
KAFKA_JMX_OPTS="-Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.rmi.port=9998 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=true -Djavax.net.ssl.keyStore=/Absolute/path/to/keystore -Djavax.net.ssl.keyStorePassword=password -Dcom.sun.management.jmxremote.registry.ssl=false"
-Djava.rmi.server.hostname=your.host.ip
to the KAFKA_JMX_OPTS
variable if you are monitoring Kafka from a remote machine.
-Djavax.net.ssl.trustStore=/path/to/client.truststore.jks -Djavax.net.ssl.trustStorePassword=yourpassword
If you need password authentication, the password needs to be set in the JVM of the Kafka server.
To know more on how to set the credentials, please see section Using Password and Access Files
in this link.
Configure the Kafka monitoring extension by editing the config.yml file in <MACHINE_AGENT_HOME>/monitors/KafkaMonitor/
Configure the "tier" under which the metrics need to be reported. This can be done by changing the value of <Component-ID>
in
metricPrefix: "Server|Component:<Component-ID>|Custom Metrics|Kafka"
.
Please refer this link to find Component-ID of your tiers.
For example,
metricPrefix: "Server|Component:19|Custom Metrics|Kafka"
Configure the Kafka servers by specifying either serviceUrl
or <host,port>
of all Kafka servers.
host
is the IP address.
of the Kafka server to be monitored, and port
is the JMX port of the Kafka server.username
& password
(only if authentication enabled).encryptedPassword
(only if password encryption required).Configure the encyptionKey for encryptionPasswords(only if password encryption required).
For example,
#Encryption key for Encrypted password.
encryptionKey: "axcdde43535hdhdgfiniyy576"
Configure the numberOfThreads according to the number of Kafka instances that are being monitored on one extension.Each server needs one thread.
If number Kafka servers that need to be monitored by one extension is 10, then number of threads is 10
numberOfThreads: 10
Configure the metrics section.
For configuring the metrics, the following properties can be used:
Metric Property | Default value | Possible values | Description |
---|---|---|---|
alias | metric name | Any string | The substitute name to be used in the metric browser instead of metric name. |
aggregationType | "AVERAGE" | "AVERAGE", "SUM", "OBSERVATION" | Aggregation qualifier |
timeRollUpType | "AVERAGE" | "AVERAGE", "SUM", "CURRENT" | Time roll-up qualifier |
clusterRollUpType | "INDIVIDUAL" | "INDIVIDUAL", "COLLECTIVE" | Cluster roll-up qualifier |
multiplier | 1 | Any number | Value with which the metric needs to be multiplied. |
convert | null | Any key value map | Set of key value pairs that indicates the value to which the metrics need to be transformed. eg: UP:0, DOWN:1 |
delta | false | true, false | If enabled, gives the delta values of metrics instead of actual values. |
For example,
objectName: "kafka.server:type=BrokerTopicMetrics, *
will fetch metrics of all objects nested under BrokerTopicMetrics
.
- objectName: "kafka.server:type=BrokerTopicMetrics,*"
metrics:
- Count:
alias: "Count"
multiplier: ""
delta: false
aggregationType: "OBSERVATION"
timeRollUpType: "AVERAGE"
clusterRollUpType: "INDIVIDUAL"
- MeanRate:
alias: "Mean Rate"
multiplier: ""
delta: false
aggregationType: "AVERAGE"
timeRollUpType: "AVERAGE"
clusterRollUpType: "INDIVIDUAL"
All these metric properties are optional, and the default value shown in the table is applied to the metric(if a property has not been specified) by default. If you need a metric from a specific object under an mBean, objectName: kafka.server:type=ReplicaManager,name=IsrExpandsPerSec
will return only those metrics corresponding to the IsrExpandsPerSec
object.
HeapMemoryUsage.committed, HeapMemoryUsage.max, NonHeapMemoryUsage.committed, NonHeapMemoryUsage.max
HeartBeat
metric underkafka.server
which denotes whether the connection from the extension to the Kafka server was successful(1 = Successful, 0 = Unsuccessful).
Please visit this page to get detailed instructions on password encryption. The steps in this document will guide you through the whole process.
Workbench is an inbuilt feature provided with each extension in order to assist you to fine tune the extension setup before you actually deploy it on the controller. Please review the following document for how to use the Extensions WorkBench
Please follow the steps listed in the extensions troubleshooting document in order to troubleshoot your issue. These are a set of common issues that customers might have faced during the installation of the extension.
Always feel free to fork and contribute any changes directly via GitHub.
Name | Version |
---|---|
Extension Version: | 2.0.6 |
Tested On: | Apache Kafka 2.0.0 |
Operating System Tested On: | Mac OS, Linux |
Last updated On: | 09/09/2024 |
List of changes to this extension | Change log |
Note: While extensions are maintained and supported by customers under the open-source licensing model, they interact with agents and Controllers that are subject to AppDynamics’ maintenance and support policy. Some extensions have been tested with AppDynamics 4.5.13+ artifacts, but you are strongly recommended against using versions that are no longer supported.