0

我正在使用 jmxtrans 从远程 JVM 机器收集 JMX 统计信息,并使用 OpenTsdbWriter 将输出写入 Opentsdb,但是在启动 jmxtrans 服务后,我可以看到它无法将结果写入 Opentsdb。我试图通过谷歌找出解决方案,但没有得到想要的答案,有人可以帮我解决它:-

以下是日志中异常的堆栈跟踪:-

[06 Sep 2016 23:13:58] [jmxtrans-result-6] 21573814 WARN  (com.googlecode.jmxtrans.jmx.ResultProcessor$1:60) - Could not write results [Result(attributeName=Usage, className=sun.management.MemoryPoolImpl, objDomain=java.lang, typeName=type=MemoryPool,name=Metaspace, values={init=0, committed=20185088, max=-1, used=19304024}, epoch=1473183838891, keyAlias=memorypool), Result(attributeName=Usage, className=sun.management.MemoryPoolImpl, objDomain=java.lang, typeName=type=MemoryPool,name=PS Old Gen, values={init=87031808, committed=87031808, max=1375731712, used=16885688}, epoch=1473183838901, keyAlias=memorypool), Result(attributeName=Usage, className=sun.management.MemoryPoolImpl, objDomain=java.lang, typeName=type=MemoryPool,name=PS Eden Space, values={init=32505856, committed=24117248, max=686817280, used=4032656}, epoch=1473183838903, keyAlias=memorypool), Result(attributeName=Usage, className=sun.management.MemoryPoolImpl, objDomain=java.lang, typeName=type=MemoryPool,name=Compressed Class Space, values={init=0, committed=2359296, max=1073741824, used=2134656}, epoch=1473183838904, keyAlias=memorypool), Result(attributeName=Usage, className=sun.management.MemoryPoolImpl, objDomain=java.lang, typeName=type=MemoryPool,name=Code Cache, values={init=2555904, committed=9633792, max=251658240, used=9103552}, epoch=1473183838905, keyAlias=memorypool), Result(attributeName=Usage, className=sun.management.MemoryPoolImpl, objDomain=java.lang, typeName=type=MemoryPool,name=PS Survivor Space, values={init=5242880, committed=524288, max=524288, used=327680}, epoch=1473183838906, keyAlias=memorypool)] of query Query(objectName=java.lang:type=MemoryPool,name=*, keys=[], attr=[Usage], typeNames=[], resultAlias=memorypool, useObjDomainAsKey=false, allowDottedKeys=false, useAllTypeNames=false, outputWriterInstances=[BaseOutputWriter(typeNames=[], debugEnabled=false, settings={host=10.143.1.43, port=4242}, valueTransformer=com.googlecode.jmxtrans.model.results.IdentityValueTransformer@35a68c72), BaseOutputWriter(typeNames=[], debugEnabled=false, settings={}, valueTransformer=com.googlecode.jmxtrans.model.results.IdentityValueTransformer@3b6164b6)]) to output writer BaseOutputWriter(typeNames=[], debugEnabled=false, settings={host=10.143.1.43, port=4242}, valueTransformer=com.googlecode.jmxtrans.model.results.IdentityValueTransformer@35a68c72)
java.lang.NullPointerException
    at com.googlecode.jmxtrans.model.output.support.opentsdb.OpenTSDBMessageFormatter.processOneMetric(OpenTSDBMessageFormatter.java:196)
    at com.googlecode.jmxtrans.model.output.support.opentsdb.OpenTSDBMessageFormatter.formatResult(OpenTSDBMessageFormatter.java:159)
    at com.googlecode.jmxtrans.model.output.support.opentsdb.OpenTSDBMessageFormatter.access$000(OpenTSDBMessageFormatter.java:54)
    at com.googlecode.jmxtrans.model.output.support.opentsdb.OpenTSDBMessageFormatter$1.apply(OpenTSDBMessageFormatter.java:170)
    at com.googlecode.jmxtrans.model.output.support.opentsdb.OpenTSDBMessageFormatter$1.apply(OpenTSDBMessageFormatter.java:166)
    at com.google.common.collect.Iterators$8.transform(Iterators.java:817)
    at com.google.common.collect.TransformedIterator.next(TransformedIterator.java:48)
    at com.google.common.collect.TransformedIterator.next(TransformedIterator.java:48)
    at com.google.common.collect.Iterators$5.hasNext(Iterators.java:569)
    at com.google.common.collect.ImmutableList.copyOf(ImmutableList.java:249)
    at com.google.common.collect.ImmutableList.copyOf(ImmutableList.java:209)
    at com.google.common.collect.FluentIterable.toList(FluentIterable.java:484)
    at com.googlecode.jmxtrans.model.output.support.opentsdb.OpenTSDBMessageFormatter.formatResults(OpenTSDBMessageFormatter.java:173)
    at com.googlecode.jmxtrans.model.output.OpenTSDBWriter.internalWrite(OpenTSDBWriter.java:116)
    at com.googlecode.jmxtrans.model.output.BaseOutputWriter.doWrite(BaseOutputWriter.java:157)
    at com.googlecode.jmxtrans.jmx.ResultProcessor$1.run(ResultProcessor.java:58)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
INFO   | jvm 1    | 2016/09/06 23:13:58 | Result(attributeName=SystemLoadAverage, className=sun.management.OperatingSystemImpl, objDomain=java.lang, typeName=type=OperatingSystem, values={SystemLoadAverage=0.09}, epoch=1473183838891, keyAlias=null)
INFO   | jvm 1    | 2016/09/06 23:13:58 | Result(attributeName=AvailableProcessors, className=sun.management.OperatingSystemImpl, objDomain=java.lang, typeName=type=OperatingSystem, values={AvailableProcessors=4}, epoch=1473183838891, keyAlias=null)
INFO   | jvm 1    | 2016/09/06 23:13:58 | Result(attributeName=TotalPhysicalMemorySize, className=sun.management.OperatingSystemImpl, objDomain=java.lang, typeName=type=OperatingSystem, values={TotalPhysicalMemorySize=8252579840}, epoch=1473183838891, keyAlias=null)
INFO   | jvm 1    | 2016/09/06 23:13:58 | Result(attributeName=FreePhysicalMemorySize, className=sun.management.OperatingSystemImpl, objDomain=java.lang, typeName=type=OperatingSystem, values={FreePhysicalMemorySize=170389504}, epoch=1473183838891, keyAlias=null)
INFO   | jvm 1    | 2016/09/06 23:13:58 | Result(attributeName=TotalSwapSpaceSize, className=sun.management.OperatingSystemImpl, objDomain=java.lang, typeName=type=OperatingSystem, values={TotalSwapSpaceSize=1073737728}, epoch=1473183838891, keyAlias=null)
INFO   | jvm 1    | 2016/09/06 23:13:58 | Result(attributeName=FreeSwapSpaceSize, className=sun.management.OperatingSystemImpl, objDomain=java.lang, typeName=type=OperatingSystem, values={FreeSwapSpaceSize=1073737728}, epoch=1473183838891, keyAlias=null)
INFO   | jvm 1    | 2016/09/06 23:13:58 | Result(attributeName=OpenFileDescriptorCount, className=sun.management.OperatingSystemImpl, objDomain=java.lang, typeName=type=OperatingSystem, values={OpenFileDescriptorCount=83}, epoch=1473183838891, keyAlias=null)
INFO   | jvm 1    | 2016/09/06 23:13:58 | Result(attributeName=MaxFileDescriptorCount, className=sun.management.OperatingSystemImpl, objDomain=java.lang, typeName=type=OperatingSystem, values={MaxFileDescriptorCount=50000}, epoch=1473183838891, keyAlias=null)
INFO   | jvm 1    | 2016/09/06 23:13:58 | Result(attributeName=HeapMemoryUsage, className=sun.management.MemoryImpl, objDomain=java.lang, typeName=type=Memory, values={init=130023424, committed=111673344, max=1834483712, used=21039656}, epoch=1473183838891, keyAlias=heap)
INFO   | jvm 1    | 2016/09/06 23:13:58 | Result(attributeName=NonHeapMemoryUsage, className=sun.management.MemoryImpl, objDomain=java.lang, typeName=type=Memory, values={init=2555904, committed=32178176, max=-1, used=30542232}, epoch=1473183838891, keyAlias=heap)

My Config.Json looks like the below:-


{
"servers": [
{
"numQueryThreads": "2",
"host": "xx.xx.xx.xx",
"port": "1099",
"queries": [
{
"outputWriters": [
{
"@class": "com.googlecode.jmxtrans.model.output.StdOutWriter"
},
{
"@class": "com.googlecode.jmxtrans.model.output.OpenTSDBWriter",
"settings": {
"host": "xx.xx.xx.xx",
"port": "4242"
}
}
],
"obj": "java.lang:type=OperatingSystem",
"attr": [
"SystemLoadAverage",
"AvailableProcessors",
"TotalPhysicalMemorySize",
"FreePhysicalMemorySize",
"TotalSwapSpaceSize",
"FreeSwapSpaceSize",
"OpenFileDescriptorCount",
"MaxFileDescriptorCount"
]
},
{
"outputWriters": [
{
"@class": "com.googlecode.jmxtrans.model.output.StdOutWriter"
},
{
"@class": "com.googlecode.jmxtrans.model.output.OpenTSDBWriter",
"settings": {
"host": "xx.xx.xx.xx",
"port": "4242"
}
}
],
"resultAlias": "heap",
"obj": "java.lang:type=Memory",
"attr": [
"HeapMemoryUsage",
"NonHeapMemoryUsage"
]
},
{
"outputWriters": [
{
"@class": "com.googlecode.jmxtrans.model.output.StdOutWriter"
},
{
"@class": "com.googlecode.jmxtrans.model.output.OpenTSDBWriter",
"settings": {
"host": "xx.xx.xx.xx",
"port": "4242"
}
}
],
"resultAlias": "cmsoldgen",
"obj": "java.lang:name=CMS Old Gen,type=MemoryPool",
"attr": [
"Usage"
]
},
{
"outputWriters": [
{
"@class": "com.googlecode.jmxtrans.model.output.StdOutWriter"
},
{
"@class": "com.googlecode.jmxtrans.model.output.OpenTSDBWriter",
"settings": {
"host": "xx.xx.xx.xx",
"port": "4242"
}
}
],
"resultAlias": "gc",
"obj": "java.lang:type=GarbageCollector,name=",
"attr": [
"CollectionCount",
"CollectionTime"
]
},
{
"outputWriters": [
{
"@class": "com.googlecode.jmxtrans.model.output.StdOutWriter",
"settings": {}
},
{
"@class": "com.googlecode.jmxtrans.model.output.OpenTSDBWriter",
"settings": {
"host": "xx.xx.xx.xx",
"port": "4242"
}
}
],
"resultAlias": "memorypool",
"obj": "java.lang:type=MemoryPool,name=",
"attr": [
"Usage"
]
},
{
"outputWriters": [
{
"@class": "com.googlecode.jmxtrans.model.output.StdOutWriter"
},
{
"@class": "com.googlecode.jmxtrans.model.output.OpenTSDBWriter",
"settings": {
"host": "xx.xx.xx.xx",
"port": "4242"
}
}
],
"resultAlias": "threads",
"obj": "java.lang:type=Threading",
"attr": [
"DaemonThreadCount",
"PeakThreadCount",
"ThreadCount",
"TotalStartedThreadCount"
]
},
{
"outputWriters": [
{
"@class": "com.googlecode.jmxtrans.model.output.StdOutWriter"
},
{
"@class": "com.googlecode.jmxtrans.model.output.OpenTSDBWriter",
"settings": {
"host": "xx.xx.xx.xx",
"port": "4242"
}
}
],
"resultAlias": "tomcat8-connectors",
"obj": "Catalina:type=ThreadPool,name=",
"attr": [
"currentThreadCount",
"currentThreadsBusy"
]
},
{
"outputWriters": [
{
"@class": "com.googlecode.jmxtrans.model.output.StdOutWriter"
},
{
"@class": "com.googlecode.jmxtrans.model.output.OpenTSDBWriter",
"settings": {
"host": "xx.xx.xx.xx",
"port": "4242"
}
}
],
"resultAlias": "tomcat8-requests",
"obj": "Catalina:type=GlobalRequestProcessor,name=",
"attr": [
"bytesReceived",
"bytesSent",
"errorCount",
"processingTime",
"requestCount"
]
}
]
}
]
}
4

1 回答 1

0

这是未设置设置时触发的 jmxtrans ( https://github.com/jmxtrans/jmxtrans/issues/487 ) 中的错误。typeNames

添加"typeNames": []到您的 OpenTSDBWriter 设置作为解决方法。您需要将其添加到所有相关部分。

于 2016-09-29T16:50:54.773 回答