0

我正在尝试使用 jmxtrans 和 ganglia 监控 kafka 经纪人。但是使用下面的 json,不会创建 rrd。

{
"servers": [
    {
        "port": "9999",
        "host": "localhost",
        "queries": [
            {
                "outputWriters": [
                    {
                        "@class": "com.googlecode.jmxtrans.model.output.GangliaWriter",
                        "settings": {
                            "groupName": "kafka topic stats",
                            "port": 8649,
                            "host": "localhost",
            "typeNames":[
                "name"
            ]
                        }
                    }
                ],
                "obj": "\"kafka.server\":type=\"BrokerTopicMetrics\",name=\"*\"",
                "resultAlias": "Kafka",
                "attr": [
                    "Count",
                    "OneMinuteRate"
                ]
            },
            {
                "outputWriters": [
                    {
                        "@class": "com.googlecode.jmxtrans.model.output.GangliaWriter",
                        "settings": {
                            "groupName": "kafka server request",
                            "port": 8649,
                            "host": "localhost"
                        }
                    }
                ],
                "obj": "\"kafka.network\":type=\"RequestMetrics\",name=\"Produce-RequestsPerSec\"",
                "resultAlias": "produce",
                "attr": [
                    "Count",
                    "OneMinuteRate"
                ]
            }
        ],
        "numQueryThreads": 2
    }
]
} 

jmxtrans.log 中打印的日志是

[01 Sep 2015 11:53:28] [SIGTERM handler] 4030449 DEBUG (com.googlecode.jmxtrans.JmxTransformer:463) - Stopped writer: GangliaWriter for query: Query [obj="kafka.network":type="RequestMetrics",name="Produce-RequestsPerSec", resultAlias=produce, attr=[Count, OneMinuteRate]] [01 Sep 2015 11:54:33] [main] 0 DEBUG (com.googlecode.jmxtrans.JmxTransformer:223) - Loaded file: /usr/share/jmxtrans/kafka-test.json [01 Sep 2015 11:54:33] [main] 5 DEBUG (com.googlecode.jmxtrans.JmxTransformer:297) - Scheduled job: localhost:9999-1441088673052 for server: Server [host=localhost, port=9999, url=null, cronExpression=null, numQueryThreads=2] [01 Sep 2015 11:54:33] [ServerScheduler_Worker-1] 9 DEBUG (com.googlecode.jmxtrans.jobs.ServerJob:31) - +++++ Started server job: Server [host=localhost, port=9999, url=null, cronExpression=null, numQueryThreads=2] [01 Sep 2015 11:54:33] [ServerScheduler_Worker-1] 38 DEBUG (com.googlecode.jmxtrans.util.JmxUtils:95) - ----- Creating 2 query threads [01 Sep 2015 11:54:33] [ServerScheduler_Worker-1] 43 DEBUG (com.googlecode.jmxtrans.jobs.ServerJob:50) - +++++ Finished server job: Server [host=localhost, port=9999, url=service:jmx:rmi:///jndi/rmi://localhost:9999/jmxrmi, cronExpression=null, numQueryThreads=2] [01 Sep 2015 11:55:33] [ServerScheduler_Worker-2] 60006 DEBUG (com.googlecode.jmxtrans.jobs.ServerJob:31) - +++++ Started server job: Server [host=localhost, port=9999, url=service:jmx:rmi:///jndi/rmi://localhost:9999/jmxrmi, cronExpression=null, numQueryThreads=2] [01 Sep 2015 11:55:33] [ServerScheduler_Worker-2] 60008 DEBUG (com.googlecode.jmxtrans.util.JmxUtils:95) - ----- Creating 2 query threads [01 Sep 2015 11:55:33] [ServerScheduler_Worker-2] 60014 DEBUG (com.googlecode.jmxtrans.jobs.ServerJob:50) - +++++ Finished server job: Server [host=localhost, port=9999, url=service:jmx:rmi:///jndi/rmi://localhost:9999/jmxrmi, cronExpression=null, numQueryThreads=2] [01 Sep 2015 11:56:33] [ServerScheduler_Worker-3] 120006 DEBUG (com.googlecode.jmxtrans.jobs.ServerJob:31) - +++++ Started server job: Server [host=localhost, port=9999, url=service:jmx:rmi:///jndi/rmi://localhost:9999/jmxrmi, cronExpression=null, numQueryThreads=2] [01 Sep 2015 11:56:33] [ServerScheduler_Worker-3] 120008 DEBUG (com.googlecode.jmxtrans.util.JmxUtils:95) - ----- Creating 2 query threads [01 Sep 2015 11:56:33] [ServerScheduler_Worker-3] 120014 DEBUG (com.googlecode.jmxtrans.jobs.ServerJob:50) - +++++ Finished server job: Server [host=localhost, port=9999, url=service:jmx:rmi:///jndi/rmi://localhost:9999/jmxrmi, cronExpression=null, numQueryThreads=2] [01 Sep 2015 11:57:33] [ServerScheduler_Worker-4] 180006 DEBUG (com.googlecode.jmxtrans.jobs.ServerJob:31) - +++++ Started server job: Server [host=localhost, port=9999, url=service:jmx:rmi:///jndi/rmi://localhost:9999/jmxrmi, cronExpression=null, numQueryThreads=2] [01 Sep 2015 11:57:33] [ServerScheduler_Worker-4] 180009 DEBUG (com.googlecode.jmxtrans.util.JmxUtils:95) - ----- Creating 2 query threads [01 Sep 2015 11:57:33] [ServerScheduler_Worker-4] 180014 DEBUG (com.googlecode.jmxtrans.jobs.ServerJob:50) - +++++ Finished server job: Server [host=localhost, port=9999, url=service:jmx:rmi:///jndi/rmi://localhost:9999/jmxrmi, cronExpression=null, numQueryThreads=2]

但是我试图获取正常的java内存信息而不是kafka metrices,生成了rrd。请建议我是否犯了任何配置错误或其他问题。

4

1 回答 1

0

从日志文件中可以看出,没有指标发送到 gmond。您在 json 文件中有错误。为了正确的工作更换:

"obj": "kafka.server:type=BrokerTopicMetrics,name=*",

"obj": "kafka.network:type=RequestMetrics,name=Produce-RequestsPerSec",重新启动 jmxtrans 守护程序,您应该在 jmxtrans 日志文件中看到与以下内容相同的内容:

[12 Sep 2015 01:25:11] [pool-22-thread-1] 630550 DEBUG (com.googlecode.jmxtrans.util.JmxUtils:195) - Executing queryName: kafka.server:name=BytesInPerSec,type=BrokerTopicMetrics from query: Query [obj=kafka.server:type=BrokerTopicMetrics,name=*, resultAlias=Kafka, attr=[Count, OneMinuteRate]]

于 2015-09-11T22:27:33.280 回答