Unable to get logstash-input-jmx working


(Mike Delaney) #1

While trying to configure the logstash-input-jmx plugin, I've hit a brick wall where I can't seem to find why an exception is getting raise.

The error that I'm getting is this:

Apr 16 18:03:07 elk logstash[15125]: [2019-04-16T18:03:07,340][INFO ][logstash.inputs.jmx      ] Loading configuration files in path {:path=>"/etc/logstash/monitor/dev-jira.alertinnovation.com.jmx"}
Apr 16 18:03:07 elk logstash[15125]: [2019-04-16T18:03:07,357][ERROR][logstash.inputs.jmx      ] Connection refused to host: 127.0.1.1; nested exception is:
Apr 16 18:03:07 elk logstash[15125]: #011java.net.ConnectException: Connection refused (Connection refused)
Apr 16 18:03:07 elk logstash[15125]: [2019-04-16T18:03:07,358][ERROR][logstash.inputs.jmx      ] sun.rmi.transport.tcp.TCPEndpoint.newSocket(sun/rmi/transport/tcp/TCPEndpoint.java:619)
Apr 16 18:03:07 elk logstash[15125]: sun.rmi.transport.tcp.TCPChannel.createConnection(sun/rmi/transport/tcp/TCPChannel.java:216)
Apr 16 18:03:07 elk logstash[15125]: sun.rmi.transport.tcp.TCPChannel.newConnection(sun/rmi/transport/tcp/TCPChannel.java:202)
Apr 16 18:03:07 elk logstash[15125]: sun.rmi.server.UnicastRef.invoke(sun/rmi/server/UnicastRef.java:129)
Apr 16 18:03:07 elk logstash[15125]: java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(java/rmi/server/RemoteObjectInvocationHandler.java:227)
Apr 16 18:03:07 elk logstash[15125]: java.rmi.server.RemoteObjectInvocationHandler.invoke(java/rmi/server/RemoteObjectInvocationHandler.java:179)
Apr 16 18:03:07 elk logstash[15125]: com.sun.proxy.$Proxy45.newClient(com/sun/proxy/$Proxy45)
Apr 16 18:03:07 elk logstash[15125]: javax.management.remote.rmi.RMIConnector.getConnection(javax/management/remote/rmi/RMIConnector.java:2430)
Apr 16 18:03:07 elk logstash[15125]: javax.management.remote.rmi.RMIConnector.connect(javax/management/remote/rmi/RMIConnector.java:308)
Apr 16 18:03:07 elk logstash[15125]: javax.management.remote.JMXConnectorFactory.connect(javax/management/remote/JMXConnectorFactory.java:270)
Apr 16 18:03:07 elk logstash[15125]: java.lang.reflect.Method.invoke(java/lang/reflect/Method.java:498)
Apr 16 18:03:07 elk logstash[15125]: org.jruby.javasupport.JavaMethod.invokeDirectWithExceptionHandling(org/jruby/javasupport/JavaMethod.java:468)
Apr 16 18:03:07 elk logstash[15125]: org.jruby.javasupport.JavaMethod.invokeStaticDirect(org/jruby/javasupport/JavaMethod.java:370)
Apr 16 18:03:07 elk logstash[15125]: RUBY.create_connection(/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/jmx4r-0.1.4/lib/jmx4r.rb:222)
Apr 16 18:03:07 elk logstash[15125]: RUBY.connection(/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/jmx4r-0.1.4/lib/jmx4r.rb:137)
Apr 16 18:03:07 elk logstash[15125]: RUBY.thread_jmx(/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-input-jmx-3.0.7/lib/logstash/inputs/jmx.rb:224)
Apr 16 18:03:07 elk logstash[15125]: RUBY.block in run(/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-input-jmx-3.0.7/lib/logstash/inputs/jmx.rb:330)
Apr 16 18:03:07 elk logstash[15125]: org.jruby.RubyProc.call(org/jruby/RubyProc.java:289)
Apr 16 18:03:07 elk logstash[15125]: org.jruby.RubyProc.call(org/jruby/RubyProc.java:246)
Apr 16 18:03:07 elk logstash[15125]: java.lang.Thread.run(java/lang/Thread.java:748)

I'm not sure where the address 127.0.1.1 is coming from.

My configuration for the input is as follows:
= jxm_input.conf

input {
  jmx {
    path => "/etc/logstash/conf.d/jmx/"
    polling_frequency => 30
    type => "jmx"
    nb_thread => 4
  }
}

output {
  elasticsearch {
    hosts => ["10.10.9.231:9200"]
  }

  stdout {
    codec => rubydebug
  }
}

= jmx_conf.json

{
  "host" : "10.10.9.73",
  "port" : 9010,
  "alias" : "test.homeserver.elasticsearch",
  "queries" : [
  {
    "object_name" : "java.lang:type=Memory",
    "object_alias" : "Memory"
  }, {
    "object_name" : "java.lang:type=Runtime",
    "attributes" : [ "Uptime", "StartTime" ],
    "object_alias" : "Runtime"
  }, {
    "object_name" : "java.lang:type=GarbageCollector,name=*",
    "attributes" : [ "CollectionCount", "CollectionTime" ],
    "object_alias" : "${type}.${name}"
  }, {
    "object_name" : "java.nio:type=BufferPool,name=*",
    "object_alias" : "${type}.${name}"
  } ]
}