JMX input not starting

Trying to read Kafka JMX metrics data into Logstash, Here are the config-

$ cat jmx.conf

input {
  jmx {
    path => "/home/ubuntu/dev/logstash-6.2.4/conf"
    polling_frequency => 10
    type => "jmx"
    nb_thread => 2
  }
}
output {
  stdout { codec => rubydebug }
 }

$ cat /home/ubuntu/dev/logstash-6.2.4/conf/jmx_config.json

{
  "host" : "kafka-hostname.com",
  "port" : 9000,
   "queries" : [
  {
    "object_name" : "java.lang:type=Memory",
    "object_alias" : "Memory"
  }
   ]
}

Error is -

[2018-06-13T09:55:23,893][ERROR][logstash.agent ] Failed to execute action {:action=>LogStash::PipelineAction::Create/pipeline_id:main, :exception=>"LogStash::ConfigurationError", :message=>"Expected one of #, if, ", ', } at line 2, column 1 (byte 9) after input {\n", :backtrace=>["/home/ubuntu/dev/logstash-6.2.4/logstash-core/lib/logstash/compiler.rb:42:in compile_imperative'", "/home/ubuntu/dev/logstash-6.2.4/logstash-core/lib/logstash/compiler.rb:50:incompile_graph'", "/home/ubuntu/dev/logstash-6.2.4/logstash-core/lib/logstash/compiler.rb:12:in block in compile_sources'", "org/jruby/RubyArray.java:2486:inmap'", "/home/ubuntu/dev/logstash-6.2.4/logstash-core/lib/logstash/compiler.rb:11:in compile_sources'", "/home/ubuntu/dev/logstash-6.2.4/logstash-core/lib/logstash/pipeline.rb:51:ininitialize'", "/home/ubuntu/dev/logstash-6.2.4/logstash-core/lib/logstash/pipeline.rb:169:in initialize'", "/home/ubuntu/dev/logstash-6.2.4/logstash-core/lib/logstash/pipeline_action/create.rb:40:inexecute'", "/home/ubuntu/dev/logstash-6.2.4/logstash-core/lib/logstash/agent.rb:315:in block in converge_state'", "/home/ubuntu/dev/logstash-6.2.4/logstash-core/lib/logstash/agent.rb:141:inwith_pipelines'", "/home/ubuntu/dev/logstash-6.2.4/logstash-core/lib/logstash/agent.rb:312:in block in converge_state'", "org/jruby/RubyArray.java:1734:ineach'", "/home/ubuntu/dev/logstash-6.2.4/logstash-core/lib/logstash/agent.rb:299:in converge_state'", "/home/ubuntu/dev/logstash-6.2.4/logstash-core/lib/logstash/agent.rb:166:inblock in converge_state_and_update'", "/home/ubuntu/dev/logstash-6.2.4/logstash-core/lib/logstash/agent.rb:141:in with_pipelines'", "/home/ubuntu/dev/logstash-6.2.4/logstash-core/lib/logstash/agent.rb:164:inconverge_state_and_update'", "/home/ubuntu/dev/logstash-6.2.4/logstash-core/lib/logstash/agent.rb:90:in execute'", "/home/ubuntu/dev/logstash-6.2.4/logstash-core/lib/logstash/runner.rb:348:inblock in execute'", "/home/ubuntu/dev/logstash-6.2.4/vendor/bundle/jruby/2.3.0/gems/stud-0.0.23/lib/stud/task.rb:24:in `block in initialize'"]}

jmx host-port are accessible and jmx plugin is installed-
$ ./bin/logstash-plugin list | grep jmx
logstash-input-jmx

Do you by any chance have any garbage characters at the start of line 2?

No, I don't think there are any garbage characters, Pasted the configs as above.
I doubt there might be a case that it's not able to understand the input type- "jmx" in line 2?
Couldn't find anything related to plugin missing in logs, I tried to run with old version of Logstash, but no luck

No, I don't think there are any garbage characters, Pasted the configs as above.

Check with a hex editor. You can also delete parts of the file to narrow things down.

I doubt there might be a case that it's not able to understand the input type- "jmx" in line 2?

A missing plugin will result in another error message.

Got it running by renaming file extension type-

$ mv /home/ubuntu/dev/logstash-6.2.4/conf/jmx_config.json /home/ubuntu/dev/logstash-6.2.4/conf/jmx_config.conf

$ mv /home/ubuntu/dev/logstash-6.2.4/config/jmx.conf /home/ubuntu/dev/logstash-6.2.4/config/jmx.yml

Now Running logstash as : sudo ./bin/logstash -f /home/ubuntu/dev/logstash-6.2.4/config/jmx.yml

What? That doesn't make any sense. jmx.yml isn't a YAML file so calling it such can only result in surprises. If you pass a directory with config files to Logstash (e.g. logstash -f /home/ubuntu/dev/logstash-6.2.4/config) Logstash will only care about .conf files.

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