为什么我对jmxtrans的kafka度量一无所知,因为我可以获得jvm堆信息?

ax6ht2ek  于 2021-06-08  发布在  Kafka
关注(0)|答案(1)|浏览(438)

我使用Kafka2.11-0.9.0.1,我尝试了两个版本的jason配置文件。我可以在这里获得像heapmem和gc这样的jvm信息
但当我想得到Kafka的指标时,什么都没有。这是jmxtrans日志。在此处输入图像描述
还有,这是jason file i用户的两个版本:

{
  "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"
            ]
    }
koaltpgm

koaltpgm1#

这是版本问题。我建议jconsole查看mbeans树。这很有帮助。

相关问题