为什么我对jmxtrans的kafka指标一无所知,因为我可以得到JVM堆信息?

时间:2016-07-24 06:12:36

标签: java jvm apache-kafka jmx jmxtrans

我使用kafka_2.11-0.9.0.1,我尝试了两个版本的jason配置文件。我可以获得像heapmem和GC这样的JVM信息 enter image description here

但是当我想获得kafka指标时,没有任何结果。这是jmxtrans日志。 enter image description here

此外,这是我用户的两个版本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"
            ]
    }

1 个答案:

答案 0 :(得分:0)

这是版本问题。我建议使用jconsole来查看Mbeans树。它有很大的帮助。