Jmx 输入插件
编辑Jmx 输入插件
编辑- 插件版本:v3.0.7
- 发布于:2018-08-13
- 变更日志
对于其他版本,请参阅版本化插件文档。
获取帮助
编辑有关插件的问题,请在Discuss论坛中开一个主题。对于错误或功能请求,请在Github中打开一个问题。有关 Elastic 支持的插件列表,请查阅Elastic 支持矩阵。
描述
编辑此输入插件允许使用 JMX 从远程 Java 应用程序检索指标。每个 polling_frequency
,它会扫描一个包含 JSON 配置文件的文件夹,这些文件描述了要监控的 JVM 以及要检索的指标。然后,一个线程池将检索指标并创建事件。
配置
编辑在 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" }