0

我正在通过 JMX 端口使用 Jmxtrans 检索 Kafka 指标,并尝试发布到 CloudWatch。以下是我的 Jmxtrans 配置:

{
   "servers":[
      {
         "alias":"kafka_broker",
         "host":"localhost",
         "port":"9999",
         "queries":[
            {
               "obj":"kafka.controller:type=ControllerStats,name=LeaderElectionRateAndTimeMs",
               "attr":[
                  "99thPercentile",
                  "MeanRate"
               ],
               "resultAlias":"LeaderElectionRateTimeMs",
               "outputWriters":[
                  {
                     "@class":"com.googlecode.jmxtrans.model.output.CloudWatchWriter",
                     "settings":{
                        "namespace":"samplekafkanamespace",
                        "dimensions":[
                           {
                              "name":"InstanceId",
                              "value":"$InstanceId"
                           }
                        ]
                     }
                  }
               ]
            }
         ]
      }
   ]
}

还有我的 /etc/default/jmxtrans 文件:

http_proxy=http://proxy.com:3128
https_proxy=https://proxy.com:3128
HTTPS_PROXY=https://proxy.com:3128
HTTP_PROXY=http://proxy.com:3128
NO_PROXY=169.254.169.254
no_proxy=169.254.169.254

但是 Cloudwatch 请求超时。有没有我缺少的设置?

2018-10-19 11:25:35 [jmxtrans-result-1] level com.googlecode.jmxtrans.jmx.ResultProcessor [ResultProcessor.java:65] - Could not write results [Result(attributeName=99thPercentile, className=com.yammer.metrics.reporting.JmxReporter$Timer, objDomain=kafka.controller, typeName=type=ControllerStats,name=LeaderElectionRateAndTimeMs, valuePath=[], value=0.0, epoch=1539908694623, keyAlias=LeaderElectionRateTimeMs), Result(attributeName=MeanRate, className=com.yammer.metrics.reporting.JmxReporter$Timer, objDomain=kafka.controller, typeName=type=ControllerStats,name=LeaderElectionRateAndTimeMs, valuePath=[], value=0.0, epoch=1539908694623, keyAlias=LeaderElectionRateTimeMs)] of query Query(objectName=kafka.controller:type=ControllerStats,name=LeaderElectionRateAndTimeMs, keys=[], attr=[99thPercentile, MeanRate], typeNames=[], resultAlias=LeaderElectionRateTimeMs, useObjDomainAsKey=false, allowDottedKeys=false, useAllTypeNames=false, outputWriterInstances=[com.googlecode.jmxtrans.model.output.support.ResultTransformerOutputWriter@10934918]) to output writer com.googlecode.jmxtrans.model.output.support.ResultTransformerOutputWriter@10934918
com.amazonaws.SdkClientException: Unable to execute HTTP request: Connect to monitoring.ap-southeast-2.amazonaws.com:443 [monitoring.ap-southeast-2.amazonaws.com/103.8.175.93] failed: connect timed out
        at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleRetryableException(AmazonHttpClient.java:1114)
        at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1064)
        at com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:743)
        at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeWithTimer(AmazonHttpClient.java:717)
        at com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:699)
        at com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$500(AmazonHttpClient.java:667)
        at com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:649)
        at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:513)
        at com.amazonaws.services.cloudwatch.AmazonCloudWatchClient.doInvoke(AmazonCloudWatchClient.java:1320)
        at com.amazonaws.services.cloudwatch.AmazonCloudWatchClient.invoke(AmazonCloudWatchClient.java:1296)
        at com.amazonaws.services.cloudwatch.AmazonCloudWatchClient.executePutMetricData(AmazonCloudWatchClient.java:1204)
        at com.amazonaws.services.cloudwatch.AmazonCloudWatchClient.putMetricData(AmazonCloudWatchClient.java:1181)
        at com.googlecode.jmxtrans.model.output.CloudWatchWriter$Writer.doWrite(CloudWatchWriter.java:147)
        at com.googlecode.jmxtrans.model.output.support.ResultTransformerOutputWriter.doWrite(ResultTransformerOutputWriter.java:53)
        at com.googlecode.jmxtrans.jmx.ResultProcessor$1.run(ResultProcessor.java:63)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
        at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.base/java.lang.Thread.run(Unknown Source)

有人熟悉这个工具吗?

4

1 回答 1

0

通过在包装器配置中提供代理设置,我设法让 Jmxstans 利用代理设置。我将参数添加为Java Additional Parameter. wrapper.conf 位于/etc/jmxtrans/wrapper.conf

wrapper.java.additional.7=-Dhttp.proxyHost=proxy
wrapper.java.additional.8=-Dhttp.proxyPort=3128
wrapper.java.additional.9=-Dhttps.proxyHost=proxy
wrapper.java.additional.10=-Dhttps.proxyPort=3128
于 2018-10-23T01:40:03.807 回答