jmx-exporter 无法从 activemq 中抓取指标
我将 jmx 导出器下载到我的虚拟机,然后按照说明运行命令,如下所示:
java -javaagent:./jmx_prometheus_javaagent-0.12.0.jar=8980:config.yaml -jar /usr/local/tomcat/apache-activemq/apache-activemq-5.8.0_56/bin/activemq.jar
我得到了一些关于activemq的输出信息。然后我尝试卷曲它:
curl http://localhost:8980/metrics
。
并得到错误:curl: (7) couldn't connect to host
我检查了过程。发现没有jvm-exporter的java进程。
为什么?我做错了什么?
这是我的 config.yaml
[root@sz-7-centos162 test]# cat config.yaml
{
startDelaySeconds: 0,
username: admin,
password: admin,
jmxUrl: "service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi",
ssl: false,
lowercaseOutputName: false,
lowercaseOutputLabelNames: false
}
我希望 curl http://localhost:8980/metrics获取指标,但实际上它只是向我显示一些有关 activemq 的信息,但什么也不做。所有输出信息和我的操作都粘贴在下面:
[root@sz-7-centos162 test]# java -javaagent:./jmx_prometheus_javaagent-0.12.0.jar=8980:config.yaml -jar /usr/local/tomcat/apache-activemq/apache-activemq-5.8.0_56/bin/activemq.jar
Java Runtime: Oracle Corporation 1.8.0_51 /usr/jdk1.8.0_51/jre
Heap sizes: current=243712k free=233469k max=3608576k
JVM args: -javaagent:./jmx_prometheus_javaagent-0.12.0.jar=8980:config.yaml
Extensions classpath:
[/usr/local/tomcat/apache-activemq/apache-activemq-5.8.0_56/lib,/usr/local/tomcat/apache-activemq/apache-activemq-5.8.0_56/lib/camel,/usr/local/tomcat/apache-activemq/apache-activemq-5.8.0_56/lib/optional,/usr/local/tomcat/apache-activemq/apache-activemq-5.8.0_56/lib/web,/usr/local/tomcat/apache-activemq/apache-activemq-5.8.0_56/lib/extra]
ACTIVEMQ_HOME: /usr/local/tomcat/apache-activemq/apache-activemq-5.8.0_56
ACTIVEMQ_BASE: /usr/local/tomcat/apache-activemq/apache-activemq-5.8.0_56
ACTIVEMQ_CONF: /usr/local/tomcat/apache-activemq/apache-activemq-5.8.0_56/conf
ACTIVEMQ_DATA: /usr/local/tomcat/apache-activemq/apache-activemq-5.8.0_56/data
Usage: Main [--extdir <dir>] [task] [task-options] [task data]
Tasks:
browse - Display selected messages in a specified destination.
bstat - Performs a predefined query that displays useful statistics regarding the specified broker
create - Creates a runnable broker instance in the specified path.
decrypt - Decrypts given text
encrypt - Encrypts given text
export - Exports a stopped brokers data files to an archive file
list - Lists all available brokers in the specified JMX context
purge - Delete selected destination's messages that matches the message selector
query - Display selected broker component's attributes and statistics.
start - Creates and starts a broker using a configuration file, or a broker URI.
stop - Stops a running broker specified by the broker name.
Task Options (Options specific to each task):
--extdir <dir> - Add the jar files in the directory to the classpath.
--version - Display the version information.
-h,-?,--help - Display this help information. To display task specific help, use Main [task] -h,-?,--help
Task Data:
- Information needed by each specific task.
JMX system property options:
-Dactivemq.jmx.url=<jmx service uri> (default is: 'service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi')
-Dactivemq.jmx.user=<user name>
-Dactivemq.jmx.password=<password>
[root@sz-7-centos162 test]# curl http://localhost:8980/metrics
curl: (7) couldn't connect to host
[root@sz-7-centos162 test]# ps -ef|grep javaagent
root 23739 21179 0 23:46 pts/0 00:00:00 grep javaagent
[root@sz-7-centos162 test]# cat config.yaml
{
startDelaySeconds: 0,
username: admin,
password: admin,
jmxUrl: "service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi",
ssl: false,
lowercaseOutputName: false,
lowercaseOutputLabelNames: false
}
[root@sz-7-centos162 test]# ll
total 368
-rw-r--r-- 1 root root 252 Aug 26 23:19 config.yaml
-rw-r--r-- 1 root root 370075 Aug 26 17:45 jmx_prometheus_javaagent-0.12.0.jar
[root@sz-7-centos162 test]#