Jmx metrics using logstash jmx input plugin

Hello team
I have installed jmx plugin to logstash 6.6.2
How do this plugin work. When I start the logstash with jmx input and jmx config as the input file.....It is giving an error....no such file or directory found.

Input
{
jmx {
//Required
path => "/apps/logstash_conf/jmxconf"
//Optional, default 60s
polling_frequency => 15
type => "jmx"
//Optional, default 4
nb_thread => 4
}
}
Output
{
elasticsearch {
host......
Index..
}

}

Jmx conf file

{
//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 _
"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}"
} ]
}

Can u please help me out .....
About how this works and wt should given in the host and port fields of jmx config.
And where should the jmx config file be placed

What exactly is the error message that you get? Please include the stack trace.

HI Badger,

Thanks for the reply.

This is the error which I am getting


Sending Logstash logs to C:/Users/lpathuri/Downloads/ELK-6.6.2/logstash-6.6.2/logs which is now configured via log4j2.properties
[2019-06-06T17:42:27,171][WARN ][logstash.config.source.multilocal] Ignoring the 'pipelines.yml' file because modules or command line options are specified
[2019-06-06T17:42:27,191][INFO ][logstash.runner ] Starting Logstash {"logstash.version"=>"6.6.2"}
[2019-06-06T17:42:34,154][INFO ][logstash.pipeline ] Starting pipeline {:pipeline_id=>"main", "pipeline.workers"=>4, "pipeline.batch.size"=>125, "pipeline.batch.delay"=>50}
[2019-06-06T17:42:34,549][INFO ][logstash.outputs.elasticsearch] Elasticsearch pool URLs updated {:changes=>{:removed=>, :added=>[http://elastic:xxxxxx@10.51.22.121:9200/]}}
[2019-06-06T17:42:34,809][WARN ][logstash.outputs.elasticsearch] Restored connection to ES instance {:url=>"http://elastic:xxxxxx@10.51.22.121:9200/"}
[2019-06-06T17:42:34,916][INFO ][logstash.outputs.elasticsearch] ES Output version determined {:es_version=>6}
[2019-06-06T17:42:34,921][WARN ][logstash.outputs.elasticsearch] Detected a 6.x and above cluster: the type event field won't be used to determine the document _type {:es_version=>6}
[2019-06-06T17:42:34,947][INFO ][logstash.outputs.elasticsearch] New Elasticsearch output {:class=>"LogStash::Outputs::ElasticSearch", :hosts=>["http://10.51.22.121:9200"]}
[2019-06-06T17:42:34,954][INFO ][logstash.outputs.elasticsearch] Using mapping template from {:path=>nil}
[2019-06-06T17:42:34,976][INFO ][logstash.outputs.elasticsearch] Attempting to install template {:manage_template=>{"template"=>"logstash-", "version"=>60001, "settings"=>{"index.refresh_interval"=>"5s"}, "mappings"=>{"default"=>{"dynamic_templates"=>[{"message_field"=>{"path_match"=>"message", "match_mapping_type"=>"string", "mapping"=>{"type"=>"text", "norms"=>false}}}, {"string_fields"=>{"match"=>"", "match_mapping_type"=>"string", "mapping"=>{"type"=>"text", "norms"=>false, "fields"=>{"keyword"=>{"type"=>"keyword", "ignore_above"=>256}}}}}], "properties"=>{"@timestamp"=>{"type"=>"date"}, "@version"=>{"type"=>"keyword"}, "geoip"=>{"dynamic"=>true, "properties"=>{"ip"=>{"type"=>"ip"}, "location"=>{"type"=>"geo_point"}, "latitude"=>{"type"=>"half_float"}, "longitude"=>{"type"=>"half_float"}}}}}}}}
[2019-06-06T17:42:35,095][INFO ][logstash.inputs.jmx ] Create queue dispatching JMX requests to threads
[2019-06-06T17:42:35,097][INFO ][logstash.inputs.jmx ] Compile regexp for group alias object replacement
[2019-06-06T17:42:35,120][INFO ][logstash.pipeline ] Pipeline started successfully {:pipeline_id=>"main", :thread=>"#<Thread:0xc7a2c5f run>"}
[2019-06-06T17:42:35,123][INFO ][logstash.inputs.jmx ] Initialize 4 threads for JMX metrics collection
[2019-06-06T17:42:35,160][INFO ][logstash.inputs.jmx ] Loading configuration files in path {:path=>"C:/Users/lpathuri/Downloads/ELK-6.6.2/logstash-6.6.2/jmx.json"}
[2019-06-06T17:42:35,164][ERROR][logstash.inputs.jmx ] No such file or directory - No such directory: C:/Users/lpathuri/Downloads/ELK-6.6.2/logstash-6.6.2/jmx.json
[2019-06-06T17:42:35,166][ERROR][logstash.inputs.jmx ] org/jruby/RubyDir.java:146:in initialize' org/jruby/RubyDir.java:383:inforeach'
C:/Users/lpathuri/Downloads/ELK-6.6.2/logstash-6.6.2/vendor/bundle/jruby/2.3.0/gems/logstash-input-jmx-3.0.7/lib/logstash/inputs/jmx.rb:335:in run' C:/Users/lpathuri/Downloads/ELK-6.6.2/logstash-6.6.2/logstash-core/lib/logstash/pipeline.rb:426:ininputworker'
C:/Users/lpathuri/Downloads/ELK-6.6.2/logstash-6.6.2/logstash-core/lib/logstash/pipeline.rb:420:in `block in start_input'
[2019-06-06T17:42:35,182][INFO ][logstash.agent ] Pipelines running {:count=>1, :running_pipelines=>[:main], :non_running_pipelines=>}
[2019-06-06T17:42:35,468][INFO ][logstash.agent ] Successfully started Logstash API endpoint {:port=>9600}
[2019-06-06T17:42:35,975][INFO ][logstash.pipeline ] Pipeline has terminated {:pipeline_id=>"main", :thread=>"#<Thread:0xc7a2c5f run>"}


Regards,
Likhith

Even I am getting the same error. Any solution for the same.

Regards,
Get-Shareit.com Authorityapk.com

I am unable to understand why it would be looking for that file given the configuration you claim to be running.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.