部署ONEAPM JMX远程监控无法找到JMX文件


#1

按照ONEAPM提供的教程配置JMX和tomact,最终查看启动无法看到tomcat的启动和agent的jmxfetch日志,一直说找不到JMX配置文件
2015-12-17 14:21:46 CST | INFO | ci.jmxfetch | jmxfetch(jmxfetch.py:154) | No valid JMX integration was found. Exiting …
2015-12-17 16:28:10 CST | INFO | ci.jmxfetch | jmxfetch(jmxfetch.py:154) | No valid JMX integration was found. Exiting …
2015-12-17 17:32:09 CST | INFO | ci.jmxfetch | jmxfetch(jmxfetch.py:154) | No valid JMX integration was found. Exiting …
2015-12-17 18:44:42 CST | INFO | ci.jmxfetch | jmxfetch(jmxfetch.py:154) | No valid JMX integration was found. Exiting …
2015-12-17 19:31:09 CST | ERROR | ci.jmxfetch | jmxfetch(jmxfetch.py:203) | Unable to parse yaml config in /etc/oneapm-ci-agent/conf.d/tomcat.yaml
2015-12-17 19:31:13 CST | INFO | ci.jmxfetch | jmxfetch(jmxfetch.py:154) | No valid JMX integration was found. Exiting …
2015-12-17 21:04:38 CST | INFO | ci.jmxfetch | jmxfetch(jmxfetch.py:154) | No valid JMX integration was found. Exiting …
2015-12-21 16:19:47 CST | INFO | ci.jmxfetch | jmxfetch(jmxfetch.py:154) | No valid JMX integration was found. Exiting …
2015-12-21 16:35:36 CST | INFO | ci.jmxfetch | jmxfetch(jmxfetch.py:154) | No valid JMX integration was found. Exiting …
2015-12-21 16:37:15 CST | ERROR | ci.jmxfetch | jmxfetch(jmxfetch.py:203) | Unable to parse yaml config in /etc/oneapm-ci-agent/conf.d/jmx.yaml
2015-12-21 16:37:15 CST | ERROR | ci.jmxfetch | jmxfetch(jmxfetch.py:203) | Unable to parse yaml config in /etc/oneapm-ci-agent/conf.d/tomcat.yaml
2015-12-21 16:37:19 CST | INFO | ci.jmxfetch | jmxfetch(jmxfetch.py:154) | No valid JMX integration was found. Exiting …
2015-12-21 16:55:28 CST | ERROR | ci.jmxfetch | jmxfetch(jmxfetch.py:203) | Unable to parse yaml config in /etc/oneapm-ci-agent/conf.d/jmx.yaml
2015-12-21 16:55:28 CST | ERROR | ci.jmxfetch | jmxfetch(jmxfetch.py:203) | Unable to parse yaml config in /etc/oneapm-ci-agent/conf.d/tomcat.yaml
2015-12-21 16:55:32 CST | INFO | ci.jmxfetch | jmxfetch(jmxfetch.py:154) | No valid JMX integration was found. Exiting …
2015-12-21 17:01:16 CST | ERROR | ci.jmxfetch | jmxfetch(jmxfetch.py:203) | Unable to parse yaml config in /etc/oneapm-ci-agent/conf.d/jmx.yaml
2015-12-21 17:01:16 CST | ERROR | ci.jmxfetch | jmxfetch(jmxfetch.py:203) | Unable to parse yaml config in /etc/oneapm-ci-agent/conf.d/tomcat.yaml
2015-12-21 17:01:20 CST | INFO | ci.jmxfetch | jmxfetch(jmxfetch.py:154) | No valid JMX integration was found. Exiting …
2015-12-21 17:05:35 CST | ERROR | ci.jmxfetch | jmxfetch(jmxfetch.py:203) | Unable to parse yaml config in /etc/oneapm-ci-agent/conf.d/jmx.yaml
2015-12-21 17:05:35 CST | ERROR | ci.jmxfetch | jmxfetch(jmxfetch.py:203) | Unable to parse yaml config in /etc/oneapm-ci-agent/conf.d/tomcat.yaml
2015-12-21 17:05:39 CST | INFO | ci.jmxfetch | jmxfetch(jmxfetch.py:154) | No valid JMX integration was found. Exiting …
2015-12-21 17:13:44 CST | INFO | ci.jmxfetch | jmxfetch(jmxfetch.py:154) | No valid JMX integration was found. Exiting …


#2

这个应该是 tomcat.yaml 配置报错,可以把配置都贴出来我们看一看


#3

这是tomcat.yaml的配置
instances:

  • host: localhost
    port: 7199

user: monitorRole

password: QED

process_name_regex: .process_name. # Instead of specifying a host, and port. The agent can connect using the attach api.

# This requires the JDK to be installed and the path to tools.jar to be set below.

tools_jar_path: /usr/lib/jvm/java/lib/tools.jar # To be set when process_name_regex is set

name: tomcat_instance
java_bin_path: /usr/lib/jvm/java/bin # Optional, should be set if the agent cannot find your java executable
java_options: “-Xmx200m -Xms50m” # Optional, Java JVM options
trust_store_path: /path/to/trustStore.jks # Optional, should be set if ssl is enabled
trust_store_password: password
tags:
env: stage

newTag: test

List of metrics to be collected by the integration

Read http://www.oneapm.com/docs/ci/services/jmx.html to learn how to customize it

init_config:
conf:
- include:
type: ThreadPool
attribute:
maxThreads:
alias: tomcat.threads.max
metric_type: gauge
currentThreadCount:
alias: tomcat.threads.count
metric_type: gauge
currentThreadsBusy:
alias: tomcat.threads.busy
metric_type: gauge
- include:
type: GlobalRequestProcessor
attribute:
bytesSent:
alias: tomcat.bytes_sent
metric_type: counter
bytesReceived:
alias: tomcat.bytes_rcvd
metric_type: counter
errorCount:
alias: tomcat.error_count
metric_type: counter
requestCount:
alias: tomcat.request_count
metric_type: counter
maxTime:
alias: tomcat.max_time
metric_type: gauge
processingTime:
alias: tomcat.processing_time
metric_type: counter
- include:
j2eeType: Servlet
attribute:
processingTime:
alias: tomcat.servlet.processing_time
metric_type: counter
errorCount:
alias: tomcat.servlet.error_count
metric_type: counter
requestCount:
alias: tomcat.servlet.request_count
metric_type: counter
- include:
type: Cache
accessCount:
alias: tomcat.cache.access_count
metric_type: counter
hitsCounts:
alias: tomcat.cache.hits_count
metric_type: counter
- include:
type: JspMonitor
jspCount:
alias: tomcat.jsp.count
metric_type: counter
jspReloadCount:
alias: tomcat.jsp.reload_count
metric_type: counter


#4

你的tomcat 的 jmx开启了么,需要jmx开启了才可以监控到数据呢:grin:


#5

开启了,指定的jmx端口也是通的


#7
  1. 你执行一下 sudo service oneapm-ci-agent configcheck 看看yaml有没有错误
  2. 执行 sudo service oneapm-ci-agent jmx list_everything

请把上面两个命令的输出贴出来吧


#8

root@bogon:/etc/oneapm-ci-agent/conf.d# /etc/init.d/oneapm-ci-agent configcheck
jmx.yaml contains errors:
while parsing a block mapping
in “”, line 1, column 1
did not find expected key
in “”, line 12, column 3
tomcat.yaml contains errors:
while parsing a block collection
in “”, line 2, column 3
did not find expected ‘-’ indicator
in “”, line 9, column 3
Fix the invalid yaml files above in order to start the OneAPM CI Agent. A useful external tool for yaml parsing can be found at http://yaml-online-parser.appspot.com/
root@bogon:/etc/oneapm-ci-agent/conf.d# /etc/init.d/oneapm-ci-agent jmx list_everything
2015-12-22 16:13:04,445 | ERROR | ci.collector | jmxfetch(jmxfetch.py:203) | Unable to parse yaml config in /etc/oneapm-ci-agent/conf.d/jmx.yaml
2015-12-22 16:13:04,447 | ERROR | ci.collector | jmxfetch(jmxfetch.py:203) | Unable to parse yaml config in /etc/oneapm-ci-agent/conf.d/tomcat.yaml
Couldn’t find any valid JMX configuration in your conf.d directory: /etc/oneapm-ci-agent/conf.d
Have you enabled any JMX check ?
If you think it’s not normal please get in touch with OneAPM Support
root@bogon:/etc/oneapm-ci-agent/conf.d# cat jmx.yaml
init_config:

instances:

  • host: localhost
    port: 7199

user: monitorRole

password: QED

process_name_regex: .process_name. # Instead of specifying a host, and port. The agent can connect using the attach api.

# This requires the JDK to be installed and the path to tools.jar to be set below.

tools_jar_path: /usr/lib/jvm/java-7-openjdk-amd64/lib/tools.jar # To be set when process_name_regex is set

name: jmx_instance

java_bin_path: /usr/lib/jvm/java/bin # Optional, should be set if the agent cannot find your java executable
java_options: “-Xmx200m -Xms50m” # Optional, Java JVM options
trust_store_path: /path/to/trustStore.jks # Optional, should be set if ssl is enabled
trust_store_password: password
tags:
env: stage

newTag: test

# List of metrics to be collected by the integration
# Read http://www.oneapm.com/docs/ci/services/jmx.html to learn how to customize it
# conf:
   - include:
       domain: my_domain
       bean:
         - my_bean
         - my_second_bean
       attribute:
         attribute1:
           metric_type: counter
           alias: jmx.my_metric_name
         attribute2:
           metric_type: gauge
           alias: jmx.my2ndattribute
   - include:
       domain: 2nd_domain
     exclude:
       bean:
         - excluded_bean
   - include:
       domain_regex: regex_on_domain
     exclude:
       bean_regex:
         - regex_on_excluded_bean

root@bogon:/etc/oneapm-ci-agent/conf.d# cat tomcat.yaml
instances:

  • host: localhost
    port: 7199

user: monitorRole

password: QED

process_name_regex: .process_name. # Instead of specifying a host, and port. The agent can connect using the attach api.

# This requires the JDK to be installed and the path to tools.jar to be set below.

tools_jar_path: /usr/lib/jvm/java/lib/tools.jar # To be set when process_name_regex is set

name: tomcat_instance
java_bin_path: /usr/lib/jvm/java/bin # Optional, should be set if the agent cannot find your java executable
java_options: “-Xmx200m -Xms50m” # Optional, Java JVM options
trust_store_path: /path/to/trustStore.jks # Optional, should be set if ssl is enabled
trust_store_password: password
tags:
env: stage

newTag: test

List of metrics to be collected by the integration

Read http://www.oneapm.com/docs/ci/services/jmx.html to learn how to customize it

init_config:
conf:
- include:
type: ThreadPool
attribute:
maxThreads:
alias: tomcat.threads.max
metric_type: gauge
currentThreadCount:
alias: tomcat.threads.count
metric_type: gauge
currentThreadsBusy:
alias: tomcat.threads.busy
metric_type: gauge
- include:
type: GlobalRequestProcessor
attribute:
bytesSent:
alias: tomcat.bytes_sent
metric_type: counter
bytesReceived:
alias: tomcat.bytes_rcvd
metric_type: counter
errorCount:
alias: tomcat.error_count
metric_type: counter
requestCount:
alias: tomcat.request_count
metric_type: counter
maxTime:
alias: tomcat.max_time
metric_type: gauge
processingTime:
alias: tomcat.processing_time
metric_type: counter
- include:
j2eeType: Servlet
attribute:
processingTime:
alias: tomcat.servlet.processing_time
metric_type: counter
errorCount:
alias: tomcat.servlet.error_count
metric_type: counter
requestCount:
alias: tomcat.servlet.request_count
metric_type: counter
- include:
type: Cache
accessCount:
alias: tomcat.cache.access_count
metric_type: counter
hitsCounts:
alias: tomcat.cache.hits_count
metric_type: counter
- include:
type: JspMonitor
jspCount:
alias: tomcat.jsp.count
metric_type: counter
jspReloadCount:
alias: tomcat.jsp.reload_count
metric_type: counter


#9

你贴出来的第一个命令的返回结果显示 ,你的 jmx.yaml 和 tomcat.yaml 配置文件的格式有错误。


#10

配置文件格式错误,不符合 yaml 缩进格式,此外 java 路径也不对,java_bin_path: /usr/lib/jvm/java/bin ,应该是 java_bin_path: /usr/lib/jvm/java/bin/java 修改后成功