我正在尝试使用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。 如果我犯了任何配置错误或其他原因,请建议。
答案 0 :(得分: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]]