Supported telemetry types
The Kafka integration supports these telemetry types:Prerequisites
The Kafka integration has the following prerequisites:-
Enable remote Java Management Extensions (JMX) monitoring on each broker. Kafka
disables remote JMX by default. Set the
JMX_PORTenvironment variable before you start the broker, or set the equivalentcom.sun.management.jmxremotesystem properties inKAFKA_JMX_OPTS.JMX_PORTsets the same port for the JMX registry and for the connection it returns, so the broker needs one open port for JMX. For more information, see Monitoring in the Kafka documentation. -
Make the JMX port and the address the broker advertises for JMX connections reachable
from the Collector. Set
java.rmi.server.hostnameinKAFKA_JMX_OPTSto an address the Collector can resolve, or configure the integration’s advertised host and port overrides when that address isn’t reachable. For example, the following environment variables enable remote JMX on port9999without authentication or Transport Layer Security (TLS):ReplaceBROKER_ADDRESSwith the broker’s address as the Collector reaches it. In production, enable JMX authentication and TLS on the broker and configure the integration to match.
Configure
The Kafka integration is enabled by default. To configure the Kafka integration, follow these steps:- For Kafka brokers running in your Kubernetes cluster, add autodiscovery annotations for Kafka to the broker pods or their Service, and supply the JMX address and any JMX credentials in the annotation. For more information, see autodiscovery. Metrics from discovered pods arrive with that pod’s Kubernetes metadata attached.
-
Optional: Configure static targets instead of discovered targets, such as brokers
outside your Kubernetes cluster. For example, add the following to the
values.yamlfor your CXDOT Collector Helm chart:When you configure static targets, this integration instance collects from exactly those targets instead of discovered targets. -
Optional: Configure a second integration instance to collect from both discovered
brokers and static targets. For example, add the following to the
values.yamlfor your CXDOT Collector Helm chart:Thekafka/edgekey defines a named instance for the static targets. The barekafkakey continues to discover targets. -
Optional: If the brokers require JMX authentication or TLS, configure the matching
settings for static targets, and provide the password through your deployment’s
secret management. For example, the following Helm values reference the
KAFKA_JMX_PASSWORDenvironment variable:For brokers that autodiscovery finds, supply the credentials in the autodiscovery annotation instead. -
Optional: Disable the integration. For example, add the following to the
values.yamlfor your CXDOT Collector Helm chart:
Validate
To validate the Kafka integration, follow these steps:-
In Live Telemetry Analyzer, filter for
__name__=cxdot.integration.target.healthandcxdot.integration.name=kafka. Confirm that each broker reports1. Thecxdot.integration.target,server.address, andserver.portattributes identify the broker. -
In Metrics Explorer, run the following query:
Confirm that the query returns one time series per broker, with that broker’s partition count as the value.
Troubleshooting
- Metrics for a new topic, or for a request type the brokers haven’t served yet, are
missing: Kafka registers the beans for topics and request types when they’re first
used, and the integration refreshes its list of beans at each
bean_detection_interval, which defaults to 10 minutes. The missing time series appear after the next refresh. - The
kafka.broker.raft.*,kafka.broker.metadata.*, andkafka.broker.snapshot.*metrics are missing: Only a broker running in KRaft mode reports them, except forkafka.broker.metadata.controller, which brokers in both modes report. A broker running in ZooKeeper mode reportskafka.broker.zookeeper.session.event.countandkafka.broker.leader.election.countinstead, which a KRaft broker never reports.
Configuration reference
Configure one Apache Kafka integration instance with the following settings. In Helm values, place these settings underconfig.integrations.kafka. In a Collector configuration file, place
them under cxdot.integrations.kafka.
Optional settings
-
enabledType:boolean. Optional. Default:true. Whether to enable this Kafka integration instance. If true, the Collector runs the instance. If false, the Collector doesn’t run it. -
endpointsType:array of object. Optional. Default:[]. Static Kafka broker JMX targets. When this list is empty or omitted, the integration uses automatic target discovery. When the list contains targets, this integration instance collects from exactly those targets and doesn’t automatically discover targets. Configure a second named instance to use both methods. Each endpoint can be ahost:portRMI registry address or aservice:jmx:rmiURL. -
endpoints[].endpointType:string. Required. Kafka broker JMX endpoint as either ahost:portRMI registry address or aservice:jmx:rmiURL. -
registry_tlsType:boolean. Optional. Default:false. Whether to use TLS for the RMI registry connection. If true, the Collector uses TLS. If false, the Collector uses an unencrypted registry connection. -
advertised_host_overrideType:string. Optional. Default: “. Host the Collector uses for Remote Method Invocation (RMI) server connections instead of the host advertised by returned RMI stubs. When empty, the Collector uses the registry endpoint host. -
advertised_port_overrideType:integer. Optional. Default:0. Minimum:0. Maximum:65535. Port the Collector uses for RMI server connections instead of the port advertised by returned RMI stubs. When set to0, the Collector uses the advertised port. -
usernameType:string. Optional. Username for JMX authentication. Configureusernameandpasswordtogether. -
passwordType:string. Optional. Password for JMX authentication. Configureusernameandpasswordtogether. -
collection_intervalType:duration. Optional. Default:15s. How often the Collector collects metrics from each Kafka broker JMX endpoint. -
bean_detection_intervalType:duration. Optional. Default:10m. How often the Collector refreshes the set of available JMX beans. Kafka registers beans for topics and request types when they’re first used, so their metrics appear after the next refresh. -
bean_limitType:integer. Optional. Default:35000. Minimum:1. Maximum number of JMX bean matches collected from each endpoint. When the number of matches exceeds this value, the integration drops beans according to the attribute mapping priority. -
target_systemType:string. Optional. Default:kafka. Comma-delimited attribute mapping names to apply. The Kafka broker mapping is enabled by default, and the JVM mapping is included automatically. Add-jvmto disable JVM metrics when at least one other mapping is configured. -
attribute_mapping_pathsType:array of string. Optional. Default:[]. Directories and files containing custom Java Management Extensions (JMX) attribute mappings. The Collector searches these paths before the embedded Kafka and Java Virtual Machine (JVM) mappings. -
tlsType:object. Optional. Default:{}. TLS certificate and client authentication settings for RMI registry and server connections. -
tls.ca_fileType:string. Optional. Path to the CA cert. For a client this verifies the server certificate. For a server this verifies client certificates. If empty uses system root CA. (optional) -
tls.ca_pemType:string. Optional. In memory PEM encoded cert. (optional) -
tls.cert_fileType:string. Optional. Path to the TLS cert to use for TLS required connections. (optional) -
tls.cert_pemType:string. Optional. In memory PEM encoded TLS cert to use for TLS required connections. (optional) -
tls.cipher_suitesType:array of string. Optional. CipherSuites is a list of TLS cipher suites that the TLS transport can use. If left blank, a safe default list is used. See https://go.dev/src/crypto/tls/cipher_suites.go for a list of supported cipher suites. -
tls.curve_preferencesType:array of string. Optional. contains the elliptic curves that will be used in an ECDHE handshake, in preference order Defaults to empty list and “crypto/tls” defaults are used, internally. -
tls.include_system_ca_certs_poolType:boolean. Optional. If true, load system CA certificates pool in addition to the certificates configured in this struct. -
tls.insecureType:boolean. Optional. Whether to disable transport security. This setting must be false. Useregistry_tlsto control transport security for the RMI registry. -
tls.insecure_skip_verifyType:boolean. Optional. Whether to skip verification of the JMX server certificate. If true, the connection is encrypted but isn’t authenticated and is vulnerable to man-in-the-middle attacks. If false, the Collector verifies the certificate. -
tls.key_fileType:string. Optional. Path to the TLS key to use for TLS required connections. (optional) -
tls.key_pemType:string. Optional. In memory PEM encoded TLS key to use for TLS required connections. (optional) -
tls.max_versionType:string. Optional. MaxVersion sets the maximum TLS version that is acceptable. If not set, refer to crypto/tls for defaults. (optional) -
tls.min_versionType:string. Optional. MinVersion sets the minimum TLS version that is acceptable. If not set, TLS 1.2 will be used. (optional) -
tls.reload_intervalType:duration. Optional. ReloadInterval specifies the duration after which the certificate will be reloaded If not set, it will never be reloaded (optional) -
tls.server_name_overrideType:string. Optional. Server name to verify in the JMX certificate instead of the endpoint hostname. Use this setting when the certificate name differs from the endpoint hostname. -
tls.tpmType:object. Optional. Trusted platform module configuration -
tls.tpm.authType:string. Optional. Authorization value for the trusted platform module key. -
tls.tpm.enabledType:boolean. Optional. Whether to use a trusted platform module for the TLS private key. If true, the Collector loads the key from the configured device or socket. If false, the Collector uses the configured key file or in-memory key. -
tls.tpm.owner_authType:string. Optional. Owner authorization value for the trusted platform module. -
tls.tpm.pathType:string. Optional. The path to the TPM device or Unix domain socket. For instance /dev/tpm0 or /dev/tpmrm0.