ActiveMQ Artemis 和 Logstash JMX 输入
ActiveMQ Artemis and Logstash JMX input
我想使用 logstash 从 JMX 监控 ActiveMQ Artemis 并将数据发送到 Elastic。
对于 Artemis 2.13.0,
management.xml
:
- 注释掉
<authorisation>
标签
- 已添加
<connector connector-port="1099">
artemis.profile.cmd
:
- 在 JAVA_ARGS 下添加了
-Djava.rmi.server.hostname=localhost
,因为 Jconsole/Logstash 无法发现 RMI JMX
在我本地windows10台机器上设置ELK
local-jmx.config
input {
jmx {
path => "/path/to/config/" //This has a file jmxquery.config
polling_frequency => 60
nb_thread => 5
type => "jmx"
}
}
output {
elasticsearch {
hosts => [ "localhost:9200" ]
}
}
jmxquery.config
:
{
"host" : "127.0.0.1",
"port" : 1099,
"url": "service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi",
"username" : "guest",
"password" : "guest",
"alias" : "Version",
"queries" : [
{
"object_name" : "org.apache.activemq.artemis:broker=0.0.0.0,attribute=Version" ,
"object_alias" : "version"
}
]
}
我可以使用 localhost:1099
和 JConsole
但是,当我启动 logstash 时,JMX 能够连接,但有一条消息说“没有 jmx 对象”。
[2020-07-29T13:57:40,030][DEBUG][logstash.inputs.jmx ] Wait until the queue conf is empty
[2020-07-29T13:57:40,030][DEBUG][logstash.inputs.jmx ] Retrieve config {"host"=>"127.0.0.1", "port"=>1099, "url"=>"service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi", "username"=>"guest", "password"=>"guest", "alias"=>"ActiveMQ", "queries"=>[{"object_name"=>"org.apache.activemq.artemis:broker=0.0.0.0,attribute=Version", "object_alias"=>"version"}]} from queue conf
[2020-07-29T13:57:40,031][DEBUG][logstash.inputs.jmx ] Check if jmx connection need a user/password
[2020-07-29T13:57:40,031][DEBUG][logstash.inputs.jmx ] Wait 60s (60-0(seconds wait until queue conf empty)) before to launch again a new jmx metrics collection
[2020-07-29T13:57:40,031][DEBUG][logstash.inputs.jmx ] Connect to 127.0.0.1:1099 with user guest
[2020-07-29T13:57:40,044][DEBUG][logstash.inputs.jmx ] Set base_metric_path to alias: Version
[2020-07-29T13:57:40,044][DEBUG][logstash.inputs.jmx ] Treat queries [{"object_name"=>"org.apache.activemq.artemis:broker=0.0.0.0,attribute=Version", "object_alias"=>"version"}]
[2020-07-29T13:57:40,044][DEBUG][logstash.inputs.jmx ] Find all objects name org.apache.activemq.artemis:broker=0.0.0.0,attribute=Version
[2020-07-29T13:57:40,045][WARN ][logstash.inputs.jmx ] No jmx object found for org.apache.activemq.artemis:broker=0.0.0.0,attribute=Version
我希望return 这里的版本号。 logstash 的对象名称或配置是否不正确?
object_name 创建存在一些问题。
使用控制台获取队列对象名称如下
并将其包含在 jmxquery.config
...
"queries" : [
{
"object_name" : "org.apache.activemq.artemis:broker=\"0.0.0.0\",component=addresses,address=\"demo\"" ,
"object_alias" : "version"
}
]
....
现在可以看到发送到 kibana 的信息。
完成配置,以防限制推送到 Elastic 的属性数量,使用 attributes
属性.
{
"host" : "127.0.0.1",
"port" : 1099,
"url": "service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi",
"username" : "usern-name",
"password" : "password-so-it-can-access-jmx-of-artemis",
"alias" : "ActiveMQ",
"queries" : [
{
"object_name" : "org.apache.activemq.artemis:broker=\"broker-*\",component=addresses,address=*,subcomponent=queues,routing-type=\"anycast\",queue=*" ,
"attributes" : ["Address","MessageCount","ConsumerCount","MessagesAcknowledged"],
"object_alias" : "${address}"
}
]
}
我想使用 logstash 从 JMX 监控 ActiveMQ Artemis 并将数据发送到 Elastic。
对于 Artemis 2.13.0,
management.xml
:
- 注释掉
<authorisation>
标签 - 已添加
<connector connector-port="1099">
artemis.profile.cmd
:
- 在 JAVA_ARGS 下添加了
-Djava.rmi.server.hostname=localhost
,因为 Jconsole/Logstash 无法发现 RMI JMX
在我本地windows10台机器上设置ELK
local-jmx.config
input {
jmx {
path => "/path/to/config/" //This has a file jmxquery.config
polling_frequency => 60
nb_thread => 5
type => "jmx"
}
}
output {
elasticsearch {
hosts => [ "localhost:9200" ]
}
}
jmxquery.config
:
{
"host" : "127.0.0.1",
"port" : 1099,
"url": "service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi",
"username" : "guest",
"password" : "guest",
"alias" : "Version",
"queries" : [
{
"object_name" : "org.apache.activemq.artemis:broker=0.0.0.0,attribute=Version" ,
"object_alias" : "version"
}
]
}
我可以使用 localhost:1099
和 JConsole
但是,当我启动 logstash 时,JMX 能够连接,但有一条消息说“没有 jmx 对象”。
[2020-07-29T13:57:40,030][DEBUG][logstash.inputs.jmx ] Wait until the queue conf is empty
[2020-07-29T13:57:40,030][DEBUG][logstash.inputs.jmx ] Retrieve config {"host"=>"127.0.0.1", "port"=>1099, "url"=>"service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi", "username"=>"guest", "password"=>"guest", "alias"=>"ActiveMQ", "queries"=>[{"object_name"=>"org.apache.activemq.artemis:broker=0.0.0.0,attribute=Version", "object_alias"=>"version"}]} from queue conf
[2020-07-29T13:57:40,031][DEBUG][logstash.inputs.jmx ] Check if jmx connection need a user/password
[2020-07-29T13:57:40,031][DEBUG][logstash.inputs.jmx ] Wait 60s (60-0(seconds wait until queue conf empty)) before to launch again a new jmx metrics collection
[2020-07-29T13:57:40,031][DEBUG][logstash.inputs.jmx ] Connect to 127.0.0.1:1099 with user guest
[2020-07-29T13:57:40,044][DEBUG][logstash.inputs.jmx ] Set base_metric_path to alias: Version
[2020-07-29T13:57:40,044][DEBUG][logstash.inputs.jmx ] Treat queries [{"object_name"=>"org.apache.activemq.artemis:broker=0.0.0.0,attribute=Version", "object_alias"=>"version"}]
[2020-07-29T13:57:40,044][DEBUG][logstash.inputs.jmx ] Find all objects name org.apache.activemq.artemis:broker=0.0.0.0,attribute=Version
[2020-07-29T13:57:40,045][WARN ][logstash.inputs.jmx ] No jmx object found for org.apache.activemq.artemis:broker=0.0.0.0,attribute=Version
我希望return 这里的版本号。 logstash 的对象名称或配置是否不正确?
object_name 创建存在一些问题。
使用控制台获取队列对象名称如下
并将其包含在 jmxquery.config
...
"queries" : [
{
"object_name" : "org.apache.activemq.artemis:broker=\"0.0.0.0\",component=addresses,address=\"demo\"" ,
"object_alias" : "version"
}
]
....
现在可以看到发送到 kibana 的信息。
完成配置,以防限制推送到 Elastic 的属性数量,使用 attributes
属性.
{
"host" : "127.0.0.1",
"port" : 1099,
"url": "service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi",
"username" : "usern-name",
"password" : "password-so-it-can-access-jmx-of-artemis",
"alias" : "ActiveMQ",
"queries" : [
{
"object_name" : "org.apache.activemq.artemis:broker=\"broker-*\",component=addresses,address=*,subcomponent=queues,routing-type=\"anycast\",queue=*" ,
"attributes" : ["Address","MessageCount","ConsumerCount","MessagesAcknowledged"],
"object_alias" : "${address}"
}
]
}