Kafka Connect - metrics through JMX - apache-kafka

I am using confluent HDFS sink connector and would like to know how to get consumer properties to expose through either JMX or REST API.
I checked the following two properties, however, I don't know how to expose metrics to jmx port
connect-standalone.properties
consumer.properties

Set JMX_PORT when you launch Kafka Connect. e.g.
export JMX_PORT=4242
./bin/connect-distributed ./etc/kafka/connect-distributed.properties
You can then connect to JMX using JConsole, JMXTerm, etc.

Had the same issue a few days back - this stackoverflow link has one way how the issue was resolved. It was able to expose the metrics using jmx exporter, which got scraped by Prometheus.

Related

Snowflake Kafka Connect JMX configuration to get Snowflake connector metrics

Could someone please help me with a sample JMX config file to get metrics from Kafka connect cluster that is running snowflake kafka connector. I am able to get most of the kafka connect specific metrics, however, couldnt get a solution to extracts metrics for snowflake.kafka.connector MBeab. I have gone through the snowflake and confluent documentation but couldnt find any solution for this issue.
MBean object name:-
snowflake.kafka.connector:connector=connector_name,pipe=pipe_name,category=category_name,name=metric_name

Kafka Producer jmx metrics missing

We have Spring Boot applications deployed on OKD (The Origin Community Distribution of Kubernetes that powers Red Hat OpenShift). Without much tweaking by devops team, we got in prometheus scraped kafka consumer metrics from kubernetes-service-endpoints exporter job, as well as some producer metrics, but only for kafka connect api, not for standard kafka producer api. This is I guess a configuration for that job:
https://github.com/prometheus/prometheus/blob/master/documentation/examples/prometheus-kubernetes.yml
What is needed to change in scrape config in order to collect what's been missing?
This issue with micrometer is the source of the problem.
So, we could add jmx exporter, or wait for the issue resolution.

How to consume message from a topic in Prometheus

I am working on Kafka --> Prometheus --> Grafana pipeline. I have java application which send message inside a kafka topic. But in prometheus it shows only the message count of topic. I am running an instance of JMX Exporter when I run Kafka.
export JMX_YAML=/home/kafka_2.12-2.3.0/prometheus/kafka-0-8-2.yml
export JMX_JAR=/home/kafka_2.12-2.3.0/prometheus/jmx_prometheus_javaagent-0.6.jar
export KAFKA_OPTS="$KAFKA_OPTS -javaagent:$JMX_JAR=7076:$JMX_YAML"
bin/kafka-server-start.sh config/server.properties
But I need to read the topic data in prometheus. Is there any direct Kafka to Prometheus importer?
I have heard about "Kafka Connect framework"? How to configure it inside prometheus?
Prometheus doesn't run Kafka Connect; you would have to configure that separately.
Also, Prometheus is pulled based, so you at the very least would have to use PushGateway, assuming a Kafka Connector did exist.
If you just want to ultimately display data in Grafana, there are existing connectors for Elasticsearch, Influx, Cassandra, and most JDBC databases
Telegraf or Logstash could be used as alternatives to Kafka Connect, as well, or you can write your own consumer.

Is it possible to monitor kafka producer/consumer metrics in DCOS?

I am trying to do this without using Confluent Control Center, since I do not have a license.
I am able to see the Kafka Broker metrics by using dcos task metrics details <broker-id> and see that all of these are already exposed on my DCOS Prometheus instance.
However, I do not see any consumer/producer metrics available on Prometheus, despite having some producers/consumer tasks on dcos.
Is there a process I can follow to expose kafka prodcuer/consumer metrics on dcos? I tried the following https://github.com/ibm-cloud-architecture/refarch-eda/blob/master/docs/kafka/monitoring.md .
But from my understanding we cannot use JMX on a Kafka instance hosted on DCOS (yet) (soruce: https://jira.mesosphere.com/browse/DCOS_OSS-3632?page=com.atlassian.jira.plugin.system.issuetabpanels%3Achangehistory-tabpanel)
Any ideas?
You would have to add Prometheus JMX exporters to each of your Kafka Java processes, and then you would need to have the Prometheus server be able to scrape those. You would do this by downloading that JAR in each of the processes (containers?), then editing the KAFKA_OPTS environment varible to include the -javaagent option
AFAIK, this does not require setting up a remotely accessible JMX port.
Note: Control Center doesn't monitor JMX values. It uses Kafka MetricsReporters and Interceptors. Use of these interfaces, if you chose to write your own, or find others, doesn't require Control Center at all.

Hpw to show Flink metrics with JMX reporter on Local from Jconsole JMX console

I am learning all these. Please share your ideas and help.
I am trying to see flink metrics with JMX reporter from JMX console. Steps:
I have Apache-flink installed by homebrew, alias fstart and fstop for starting/stopping Flink. Based on [this JMX reporter link][https://ci.apache.org/projects/flink/flink-docs-release-1.4/monitoring/metrics.html#jmx-orgapacheflinkmetricsjmxjmxreporter], I added below 3 lines at the end of flink-conf.yaml
metrics.reporters: jmx
metrics.reporter.jmx.class: org.apache.flink.metrics.jmx.JMXReporter
metrics.reporter.jmx.port: 8789
I downloaded Wildfly (JBoss application server), from its bin folder, run JConsole.sh.
The Jconsole shows local processes. I picked "org.apache.flink.runtime.jobmanager.JobManager" and Connect.
JConsole - available processes . It shows the default Beans Default beans. However, no Flink related beans appears here.
Correct me if I am wrong please. I assume if Flink metrics through JMX reporter is sending metrics to my local JMX box, then I should be able to see any of below metrics from the beans. https://ci.apache.org/projects/flink/flink-docs-release-1.4/monitoring/metrics.html#system-metrics
What step have I done wrong or missing please? Any help is appreciated. Thank you.
If you explicitly configure a port you have to connect to JMX using this port. If you omit the port the metrics will be available when connecting locally.
The documentation is a bit contradictory in that regard "If this setting is set Flink will start an extra JMX connector for the given port/range. Metrics are always available on the default local JMX interface."