jboss & jmxtrans & logstash/kibana

1,002 views
Skip to first unread message

Guillaume Massé

unread,
Aug 15, 2013, 2:14:39 PM8/15/13
to jmxt...@googlegroups.com
I was writing a question but I found it out while writing, so I'm leaving this for documentation purpose :P

I want to output jmx output to logstash and visualize it with kibana

my goal is to pipe jmxtrans output to logstash (http://logstash.net/docs/1.1.13/inputs/pipe)

I have some server running Jboss AS 7. I can connect to it's jmx interface via jconsole adding some jar in the classpath
host: service:jmx:remoting-jmx://192.168.111.113:9999

So I run jmxtras like that:
java \
-Djmxtrans.log.dir=. \
-cp \
/usr/share/jmxtrans/jmxtrans-all.jar:\
/usr/lib/jvm/java-7-oracle/lib/jconsole.jar:\
/usr/lib/jvm/java-7-oracle/lib/tools.jar:\
/home/vagrant/torquebox-2.3.2/jboss/modules/org/jboss/remoting3/remoting-jmx/main/remoting-jmx-1.0.5.Final.jar:\
/home/vagrant/torquebox-2.3.2/jboss/modules/org/jboss/remoting3/main/jboss-remoting-3.2.12.GA.jar:\
/home/vagrant/torquebox-2.3.2/jboss/modules/org/jboss/logging/main/jboss-logging-3.1.2.GA.jar:\
/home/vagrant/torquebox-2.3.2/jboss/modules/org/jboss/xnio/main/xnio-api-3.0.7.GA.jar:\
/home/vagrant/torquebox-2.3.2/jboss/modules/org/jboss/xnio/nio/main/xnio-nio-3.0.7.GA.jar:\
/home/vagrant/torquebox-2.3.2/jboss/modules/org/jboss/sasl/main/jboss-sasl-1.0.3.Final.jar:\
/home/vagrant/torquebox-2.3.2/jboss/modules/org/jboss/marshalling/main/jboss-marshalling-1.3.16.GA.jar:\
/home/vagrant/torquebox-2.3.2/jboss/modules/org/jboss/marshalling/river/main/jboss-marshalling-river-1.3.16.GA.jar:\
/home/vagrant/torquebox-2.3.2/jboss/modules/org/jboss/as/cli/main/jboss-as-cli-7.1.x.incremental.129.jar:\
/home/vagrant/torquebox-2.3.2/jboss/modules/org/jboss/staxmapper/main/staxmapper-1.1.0.Final.jar:\
/home/vagrant/torquebox-2.3.2/jboss/modules/org/jboss/as/protocol/main/jboss-as-protocol-7.1.x.incremental.129.jar:\
/home/vagrant/torquebox-2.3.2/jboss/modules/org/jboss/dmr/main/jboss-dmr-1.1.1.Final.jar:\
/home/vagrant/torquebox-2.3.2/jboss/modules/org/jboss/as/controller-client/main/jboss-as-controller-client-7.1.x.incremental.129.jar:\
/home/vagrant/torquebox-2.3.2/jboss/modules/org/jboss/threads/main/jboss-threads-2.0.0.GA.jar:\
/home/vagrant/torquebox-2.3.2/jboss/modules/org/jboss/as/controller/main/jboss-as-controller-7.1.x.incremental.129.jar \
com.googlecode.jmxtrans.JmxTransformer -e -f /home/vagrant/test.json -s 60

( classpath from jboss/bin/jconsole.sh )

/home/vagrant/test.json
{
  "servers" : [ {
    "url" : "service:jmx:remoting-jmx://192.168.111.113:9999",
    "queries" : [ {
  "obj" : "java.lang:type=OperatingSystem",
      "attr" : [ "SystemLoadAverage", "AvailableProcessors", "TotalPhysicalMemorySize",
                        "FreePhysicalMemorySize", "TotalSwapSpaceSize", "FreeSwapSpaceSize",
                        "OpenFileDescriptorCount", "MaxFileDescriptorCount" ],
      "outputWriters" : [ {
        "@class" : "com.googlecode.jmxtrans.model.output.StdOutWriter",
        "settings" : {}
      } ]
    } ]
  } ]
}

Maybe I will end up writing jmxtrans elasticsearch output to save me the trouble of parsing stdout with logstash filter


Jon Stevens

unread,
Aug 15, 2013, 3:16:22 PM8/15/13
to jmxt...@googlegroups.com, jmxt...@googlegroups.com
The whole point of Jmxtrans is that you can create your own outputwriters. Just create one to out to logstash in the format that you want. Could be a easy as just using log4j to output things as logstash supports reading from its socket appender. Or you can stdout a format that you want. Parsing seems like wasted effort. 

Jon
--
You received this message because you are subscribed to the Google Groups "jmxtrans" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jmxtrans+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Yannick Robin

unread,
Jan 5, 2014, 9:10:17 AM1/5/14
to jmxt...@googlegroups.com
See this post for a solution similar to what Jon proposed: https://groups.google.com/forum/#!topic/jmxtrans/EAreWa2S7Yc.

Yannick

Dzmitry Zavalei

unread,
Nov 30, 2017, 3:06:31 PM11/30/17
to jmxtrans
Hi, I using proposed approach of providing jmx-remoting URL and including extra jars from jboss EAP 6.4 installation.
Unfortunately latest stable jmxtrans jar (268) can't connect to eap-6.4 while jconsole works (even adding modules similarly to jconsole.sh script didn't help).

I have not tried using rpm installation as java service wrapper makes it harder to include extra jars to class path.

For what is worse, jmxtrans logs don't show any error during connection to jmx, (with TRACE log level) - it just mentions scheduler shutdown.

Is there any way to log extra details?

It is strange logs don't change when class path only contains jmxtrans-268-all.jar (no complaints on jmx-remoting protocol).

Best regards,
Dzmitry

Reply all
Reply to author
Forward
0 new messages