Giter Club home page Giter Club logo

kafka-graphite's Introduction

Kafka Graphite Metrics Reporter

Build Status

This is a simple reporter for kafka using the GraphiteReporter. It works with kafka 0.8.x and 0.9.x versions.

Big thanks to Maxime Brugidou from Criteo who did the initial commit of the Ganglia version, available here https://github.com/criteo/kafka-ganglia

Install On Broker

  1. Build the kafka-graphite-1.0.*.jar jar using mvn package or download it from the releases. Hint: The jar will include the metrics-graphite dependency which is not brought by Kafka.
  2. Add kafka-graphite-1.0.*.jar to the libs/ directory of your kafka broker installation
  3. Configure the broker (see the configuration section below)
  4. Restart the broker

Configuration

Edit the server.properties file of your installation, activate the reporter by setting:

kafka.metrics.reporters=com.criteo.kafka.KafkaGraphiteMetricsReporter
kafka.graphite.metrics.reporter.enabled=true

You may also specify multiple comma-separated reporter classes for the kafka.metrics.reporters property:

kafka.metrics.reporters=com.criteo.kafka.KafkaGraphiteMetricsReporter,kafka.metrics.KafkaCSVMetricsReporter[,....]

Here is a list of default properties used:

kafka.graphite.metrics.host=localhost
kafka.graphite.metrics.port=2003
# The group value is going to be part of the metrics name to distinguish between different brokers
kafka.graphite.metrics.group=kafka
# This can be use to exclude some metrics from graphite 
# since kafka has quite a lot of metrics, it is useful
# if you have many topics/partitions. For example :
kafka.graphite.metrics.exclude.regex=(kafka.network.*|kafka.*.topic.*)

# Each metric provides multiple dimensions: min, max, meanRate, etc
# This might be too much data.
# It is possible to disable some metric dimensions with the following properties:
# By default all dimensions are enabled. Only the unwanted dimensions have to be configured
kafka.graphite.dimension.enabled.count=false
kafka.graphite.dimension.enabled.meanRate=false
kafka.graphite.dimension.enabled.rate1m=false
kafka.graphite.dimension.enabled.rate5m=false
kafka.graphite.dimension.enabled.rate15m=false
kafka.graphite.dimension.enabled.min=false
kafka.graphite.dimension.enabled.max=false
kafka.graphite.dimension.enabled.mean=false
kafka.graphite.dimension.enabled.sum=false
kafka.graphite.dimension.enabled.stddev=false
kafka.graphite.dimension.enabled.median=false
kafka.graphite.dimension.enabled.p75=false
kafka.graphite.dimension.enabled.p95=false
kafka.graphite.dimension.enabled.p98=false
kafka.graphite.dimension.enabled.p99=false
kafka.graphite.dimension.enabled.p999=false

Known Issues

With Kafka <= 0.8.2.2 there is an issue if topics get deleted or partions are moved between brokers. The metrics are not get deleted in this case and because they are implemented as a Gauge, a NoSuchElementException is thrown when the metrics are reported.

There is already a fix for this, see KAFKA-1866 but it did not make it into an 0.8.x release. Because of this we implemented a workaround for this within the FilterMetricsPredicate.

kafka-graphite's People

Contributors

chuckwired avatar damienclaveau avatar fede1024 avatar frederic-schmaljohann avatar fwuzju avatar msiuts avatar petere avatar tobi-sh avatar xiamx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kafka-graphite's Issues

Missing kafka.server metrics?

I'm seeing all expected metrics except for in the kafka.server section. In Graphite I only see kafka.server.[DelayedOperationsPurgatory|FetcherLagMetrics|KafkaServer|ReplicatFetcherManager|ReplicaManager].

But when I connect to my Kafka JMX port using jconsole, I can see a bunch of other metrics in the kafka.server section, like BrokerTopicMetrics, DelayedFetchMetrics, FetcherStats, and a number of other collections.

Is it expected that these don't get written to Graphite? The BrokerTopicMetrics in particular would be extremely helpful to have.

I have not excluded anything using kafka.graphite.metrics.exclude.regex config, so I think I should be getting everything, but again, am missing a big portion of the kafka.server.* metrics.

Any help would be appreciated. Thanks!

failied to start service in centos7

Same jar works fine with centos6 but it is failing to start service in centos7. Please help me to figure out what went wrong?

CentOS Linux release 7.4.1708 (Core)
jdk1.8.0_144-1.8.0_144-fcs.x86_64

kafka.metrics.reporters=com.criteo.kafka.KafkaGraphiteMetricsReporter,kafka.metrics.KafkaCSVMetricsReporter
kafka.graphite.metrics.reporter.enabled=true
kafka.graphite.metrics.host=localhost
kafka.graphite.metrics.port=2003
kafka.graphite.metrics.group=test1

[2018-07-28 16:18:05,425] INFO Registered kafka:type=kafka.Log4jController MBean (kafka.utils.Log4jControllerRegistration$)
[2018-07-28 16:18:06,134] DEBUG Initialize GraphiteReporter [localhost,2003,test1] (com.criteo.kafka.KafkaGraphiteMetricsReporter)
[2018-07-28 16:18:06,174] DEBUG The following Metrics Dimensions will be sent [count, meanRate, rate1m, rate5m, rate15m, min, max, mean, stddev, sum, median, p75, p95, p98, p99, p999] (com.criteo.kafka.KafkaGraphiteMetricsReporter)
[2018-07-28 16:18:06,188] INFO Started Kafka Graphite metrics reporter with polling period 10 seconds (com.criteo.kafka.KafkaGraphiteMetricsReporter)
[2018-07-28 16:18:06,188] DEBUG GraphiteReporter started. (com.criteo.kafka.KafkaGraphiteMetricsReporter)
[2018-07-28 16:18:06,217] ERROR Exiting Kafka due to fatal exception (kafka.Kafka$)
java.nio.file.AccessDeniedException: /kafka_metrics
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
at sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:384)
at java.nio.file.Files.createDirectory(Files.java:674)
at java.nio.file.Files.createAndCheckIsDirectory(Files.java:781)
at java.nio.file.Files.createDirectories(Files.java:767)
at kafka.metrics.KafkaCSVMetricsReporter.init(KafkaCSVMetricsReporter.scala:54)
at kafka.metrics.KafkaMetricsReporter$.$anonfun$startReporters$1(KafkaMetricsReporter.scala:66)
at scala.collection.IndexedSeqOptimized.foreach(IndexedSeqOptimized.scala:32)
at scala.collection.IndexedSeqOptimized.foreach$(IndexedSeqOptimized.scala:29)
at scala.collection.mutable.WrappedArray.foreach(WrappedArray.scala:38)
at kafka.metrics.KafkaMetricsReporter$.startReporters(KafkaMetricsReporter.scala:64)
at kafka.server.KafkaServerStartable$.fromProps(KafkaServerStartable.scala:27)
at kafka.Kafka$.main(Kafka.scala:82)
at kafka.Kafka.main(Kafka.scala)

Thanks for all the helps!!

classNotFound exception

I am using kafka-0.8.1.1 and followed the instructions for setting up the kafka broker and when I start kafka server I get following exception -

java.lang.ClassNotFoundException: com/criteo/kafka/KafkaGraphiteMetricsReporter[
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:186)
at kafka.utils.Utils$.createObject(Utils.scala:438)
at kafka.metrics.KafkaMetricsReporter$$anonfun$startReporters$1.apply(KafkaMetricsReporter.scala:59)
at kafka.metrics.KafkaMetricsReporter$$anonfun$startReporters$1.apply(KafkaMetricsReporter.scala:58)
at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33)
at scala.collection.mutable.WrappedArray.foreach(WrappedArray.scala:34)
at kafka.metrics.KafkaMetricsReporter$.startReporters(KafkaMetricsReporter.scala:58)
at kafka.Kafka$.main(Kafka.scala:36)
at kafka.Kafka.main(Kafka.scala)

Add JVM metrics

Hi,

would it be possible to add JVM metrics? Perhaps it can be optionally switched on/off via a config parameter.

Thank you!

Matteo

Support UDP connection

Support UDP connection to a Graphite server via config, something like:

kafka.graphite.metrics.protocol=[tcp,udp]

Thank you!

Dont wright mertircs after restart server

Good day!
After server restart, plugin stop to wright metrics, in logs i recieve next error:

WARN Error writing to Graphite: Unable to make public long com.sun.management.internal.OperatingSystemImpl.getOpenFileDescriptorCount() accessible: module jdk.management does not "opens com.sun.management.internal" to unnamed module @1d5e22ff (com.yammer.metrics.reporting.GraphiteReporter)

Kafka 0.9 support

It looks like this is broken in Kafka 0.9.x, complaining of a dimension error. Any idea how soon you this will be updated for the latest version of Kafka?

Error message:

ERROR Dimensions [count, meanRate, rate1m, rate5m, rate15m] (com.criteo.kafka.KafkaGraphiteMetricsReporter)

Installed, but not getting anything in Graphite?

Hi. I hope this is an acceptable place to ask you a question :)
I built the jar, deployed it, configured it, no errors reported, I see a slew of directories and .wsp files, like:

root@ip-10-0-0-38[483]:/opt/graphite/storage/whisper/kafka-ip-10-0-0-42/kafka/server/BrokerTopicMetrics/AllTopicsBytesInPerSec> ls -l
total 12520
-rw-r--r-- 1 root root 2561812 May 22 21:18 15MinuteRate.wsp
-rw-r--r-- 1 root root 2561812 May 22 21:18 1MinuteRate.wsp
-rw-r--r-- 1 root root 2561812 May 22 21:18 5MinuteRate.wsp
-rw-r--r-- 1 root root 2561812 May 22 21:18 count.wsp
-rw-r--r-- 1 root root 2561812 May 22 21:18 meanRate.wsp

In Graphite, I see the corresponding folder structure as well, but whenever I add any of the data points to a graph, nothing seems to actually have any data! I never get any line graphs for any of them, except for the Graphite/carbon/agents tree. Did I mess something up? :)

Thanks for the module. It is most appreciated!

[edit 1]
I just noticed this "It works with kafka 0.8.1.1 version." I'm on kafka_2.8.0-0.8.0. That might be the problem. Does this module definitely NOT work on kafka_2.8.0-0.8.0? :)

[edit 2]
I upgraded to kafka_2.10-0.8.1.1, and I still have Graphite folders, but no data. What am I missing?

[edit 3]
Ok, you can close this :) I got it figured out.

Thanks!

Exclude regex is ignored

Setting

kafka.graphite.metrics.exclude.regex=(.*)

Kafka continues to emit all metrics. I was unable to exclude metrics with any string. If I look at the Graphite code super class that kafka-graphite inherits from, it appears the predicate is used as include, rather than exclude.

Joseph Hammerman

Unable to send metrics to graphite

I'm unable to see any metrics on graphite. I'm seeing these messages from kafka on startup:

[2015-04-09 23:16:05,717] INFO Verifying properties (kafka.utils.VerifiableProperties)
[2015-04-09 23:16:05,742] INFO Property broker.id is overridden to 0 (kafka.utils.VerifiableProperties)
[2015-04-09 23:16:05,742] WARN Property kafka.graphite.metrics.group is not valid (kafka.utils.VerifiableProperties)
[2015-04-09 23:16:05,743] WARN Property kafka.graphite.metrics.host is not valid (kafka.utils.VerifiableProperties)
[2015-04-09 23:16:05,743] WARN Property kafka.graphite.metrics.port is not valid (kafka.utils.VerifiableProperties)
[2015-04-09 23:16:05,743] WARN Property kafka.graphite.metrics.reporter.enabled is not valid (kafka.utils.VerifiableProperties)
[2015-04-09 23:16:05,743] WARN Property kafka.metrics.reporters is not valid (kafka.utils.VerifiableProperties)

Also, this is what kafka launches with (java.class.path). I've split it on : so its easier to read. As you can see, the metrics jar as well as the kafka-graphite-1.0.0 jar are both present.

/opt/kafka/bin/../core/build/dependant-libs-2.10.4*/*.jar
:/opt/kafka/bin/../examples/build/libs//kafka-examples*.jar
:/opt/kafka/bin/../contrib/hadoop-consumer/build/libs//kafka-hadoop-consumer*.jar
:/opt/kafka/bin/../contrib/hadoop-producer/build/libs//kafka-hadoop-producer*.jar
:/opt/kafka/bin/../clients/build/libs/kafka-clients*.jar
:/opt/kafka/bin/../libs/jopt-simple-3.2.jar
:/opt/kafka/bin/../libs/kafka_2.10-0.8.2.0.jar
:/opt/kafka/bin/../libs/kafka_2.10-0.8.2.0-javadoc.jar
:/opt/kafka/bin/../libs/kafka_2.10-0.8.2.0-scaladoc.jar
:/opt/kafka/bin/../libs/kafka_2.10-0.8.2.0-sources.jar
:/opt/kafka/bin/../libs/kafka_2.10-0.8.2.0-test.jar
:/opt/kafka/bin/../libs/kafka-clients-0.8.2.0.jar
:/opt/kafka/bin/../libs/kafka-graphite-1.0.0.jar
:/opt/kafka/bin/../libs/log4j-1.2.16.jar
:/opt/kafka/bin/../libs/lz4-1.2.0.jar
:/opt/kafka/bin/../libs/metrics-core-2.2.0.jar
:/opt/kafka/bin/../libs/metrics-graphite-2.2.0.jar
:/opt/kafka/bin/../libs/scala-library-2.10.4.jar
:/opt/kafka/bin/../libs/slf4j-api-1.7.6.jar
:/opt/kafka/bin/../libs/slf4j-log4j12-1.6.1.jar
:/opt/kafka/bin/../libs/snappy-java-1.1.1.6.jar
:/opt/kafka/bin/../libs/zkclient-0.3.jar
:/opt/kafka/bin/../libs/zookeeper-3.4.6.jar
:/opt/kafka/bin/../core/build/libs/kafka_2.10*.jar (org.apache.zookeeper.ZooKeeper)

Any pointers to what I'm possibly missing?

ERROR to write metric to graphite

hi,
I am currently setup a local kafka cluster, and use kafka Graphite to consolidate the metrics produced by brokers. However I got following issues.

2017-02-04 00:28:09,593] WARN Error writing to Graphite: Connection refused (Connection refused) (com.yammer.metrics.reporting.GraphiteReporter)

Below are configuration:

kafka.metrics.reporters=com.criteo.kafka.KafkaGraphiteMetricsReporter
kafka.graphite.metrics.reporter.enabled=true
kafka.graphite.metrics.host=localhost
kafka.graphite.metrics.port=8888

Please help to figure out what went wrong?
Note: I am using Kafka 0.10 I am not sure current one working with the latest kafka

Use graphite reporter with kafka producer?

Hi,
I'm currently using your Graphite reporter for my kafka brokers. It works great!
Now I would also like to get the metrics by my kafka producer into Graphite the same way.
Is there any way to do that?

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.