Jmx 输入插件
编辑Jmx 输入插件编辑
- 插件版本:v3.0.7
- 发布时间:2018-08-13
- 更新日志
有关其他版本,请参阅版本化插件文档。
获取帮助编辑
有关插件的问题,请在论坛中打开一个主题。对于错误或功能请求,请在Github中打开一个问题。有关 Elastic 支持的插件列表,请参阅Elastic 支持矩阵。
描述编辑
此输入插件允许使用 JMX 从远程 Java 应用程序检索指标。每隔 polling_frequency
,它都会扫描一个文件夹,该文件夹包含描述要使用要检索的指标监控的 JVM 的 json 配置文件。然后,线程池将检索指标并创建事件。
配置编辑
在 Logstash 配置中,您必须设置轮询频率、用于轮询指标的线程数以及包含每个要检索的指标的 jvm 配置的 json 文件的目录绝对路径。Logstash 输入配置示例
jmx { //Required path => "/apps/logstash_conf/jmxconf" //Optional, default 60s polling_frequency => 15 type => "jmx" //Optional, default 4 nb_thread => 4 }
Json JMX 配置示例
{ //Required, JMX listening host/ip "host" : "192.168.1.2", //Required, JMX listening port "port" : 1335, //Optional, the username to connect to JMX "username" : "user", //Optional, the password to connect to JMX "password": "pass", //Optional, use this alias as a prefix in the metric name. If not set use <host>_<port> "alias" : "test.homeserver.elasticsearch", //Required, list of JMX metrics to retrieve "queries" : [ { //Required, the object name of Mbean to request "object_name" : "java.lang:type=Memory", //Optional, use this alias in the metrics value instead of the object_name "object_alias" : "Memory" }, { "object_name" : "java.lang:type=Runtime", //Optional, set of attributes to retrieve. If not set retrieve //all metrics available on the configured object_name. "attributes" : [ "Uptime", "StartTime" ], "object_alias" : "Runtime" }, { //object_name can be configured with * to retrieve all matching Mbeans "object_name" : "java.lang:type=GarbageCollector,name=*", "attributes" : [ "CollectionCount", "CollectionTime" ], //object_alias can be based on specific value from the object_name thanks to ${<varname>}. //In this case ${type} will be replaced by GarbageCollector... "object_alias" : "${type}.${name}" }, { "object_name" : "java.nio:type=BufferPool,name=*", "object_alias" : "${type}.${name}" } ] }
以下是生成的事件示例。当返回的指标值类型为数字/布尔值时,它存储在 metric_value_number
事件字段中,否则存储在 metric_value_string
事件字段中。
{ "@version" => "1", "@timestamp" => "2014-02-18T20:57:27.688Z", "host" => "192.168.1.2", "path" => "/apps/logstash_conf/jmxconf", "type" => "jmx", "metric_path" => "test.homeserver.elasticsearch.GarbageCollector.ParNew.CollectionCount", "metric_value_number" => 2212 }
{ "@version" => "1", "@timestamp" => "2014-02-18T20:58:06.376Z", "host" => "localhost", "path" => "/apps/logstash_conf/jmxconf", "type" => "jmx", "metric_path" => "test.homeserver.elasticsearch.BufferPool.mapped.ObjectName", "metric_value_string" => "java.nio:type=BufferPool,name=mapped" }
通用选项编辑
以下配置选项受所有输入插件支持
详情编辑
codec
编辑
- 值类型为编解码器
- 默认值为
"plain"
用于输入数据的编解码器。输入编解码器是一种方便的方法,可以在数据进入输入之前对其进行解码,而无需在 Logstash 管道中使用单独的过滤器。