0

我使用 kafka_2.11-0.9.0.1,我尝试了两个版本的 jason 配置文件。我可以获取 JVM 信息,如 heapmem 和 GC 在此处输入图像描述

但是当我想获得 kafka 指标时,什么都没有。这是 jmxtrans 日志。 在此处输入图像描述

还有更多,这是我使用的两个版本的 jason 文件:

   {
  "servers" : [ {
   "port" : "9999",
   "host" : "localhost",
   "queries" : [ {
    "outputWriters" : [ {
    "@class" : "com.googlecode.jmxtrans.model.output.StdOutWriter",
    "settings" : {
    }
  } ],
  "obj" : "kafka.server:type=BrokerTopicMetrics,name=MessagesInPerSec,topic=test",
  "attr" : [ "Count"]
},{

    "outputWriters" : [ {
    "@class" : "com.googlecode.jmxtrans.model.output.StdOutWriter",
    "settings" : {
    }
  } ],
  "obj" : "kafka.server:type=BrokerTopicMetrics,name=*",
      "resultAlias": "Kafka",
  "attr" : [ "Count","OneMinuteRate"]
}



 ],
"numQueryThreads" : 2

} ] }

另一个是:

{
      "outputWriters" : [ {
    "@class" : "com.googlecode.jmxtrans.model.output.KeyOutWriter",
    "settings" : {
            "outputFile" : "testowo-counts3.txt",
      "maxLogFileSize" : "10MB",
      "maxLogBackupFiles" : 200,
      "delimiter" : "\t",
      "debug" : true

    }
  } ],

            "obj": "\"kafka.network\":type=\"RequestMetrics\",name=\"Produce-RequestsPerSec\"",
            "resultAlias": "produce",
            "attr": [
                "Count",
                "OneMinuteRate"
            ]

    } ,{
    "outputWriters" : [ {
    "@class" : "com.googlecode.jmxtrans.model.output.KeyOutWriter",
    "settings" : {
            "outputFile" : "testowo-gc.txt",
      "maxLogFileSize" : "10MB",
      "maxLogBackupFiles" : 200,
      "delimiter" : "\t",
      "debug" : true

    }
  } ],

  "obj": "java.lang:type=GarbageCollector,name=*",
            "resultAlias": "GC",
            "attr": [
                "CollectionCount",
                "CollectionTime"
            ]
    }
4

1 回答 1

0

这是版本问题。我推荐 jconsole 来查看 Mbeans 树。它有很大帮助。

于 2016-08-02T02:13:49.537 回答