1

I'd like to use Munin to monitor the status of the JVM used by Elasticsearch, which is run via Java (output of ps follows):

elastic+  1083     1  3 09:29 ?        00:13:23 /usr/bin/java -Xms8g -Xmx8g -Djava.awt.headless=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -XX:+DisableExplicitGC -Dfile.encoding=UTF-8 -Djna.nosys=true -Des.path.home=/usr/share/elasticsearch -cp /usr/share/elasticsearch/lib/elasticsearch-2.1.0.jar:/usr/share/elasticsearch/lib/* org.elasticsearch.bootstrap.Elasticsearch start -d -p /var/run/elasticsearch/elasticsearch.pid --default.path.home=/usr/share/elasticsearch --default.path.logs=/var/log/elasticsearch --default.path.data=/var/lib/elasticsearch --default.path.conf=/etc/elasticsearch

There are several Munin plugins for Java; however,

  • the jstat__* ones require to run the program via JSVC, which as far as I know requires modifications to the source code:

    Requirements: You need to execute your Java program under jsvc provided by http://jakarta.apache.org/commons/daemon/ which enables you to run your Java program with specified pid file with -pidfile option.

  • the jmx_* ones require the Java process to expose JMX remote interface, which is done by passing specific parameters to the Java binary:

    For Java process to be monitored, it must expose JMX remote interface. With Java 1.5 it can be done by adding parameters as: -Dcom.sun.management.jmxremote.port=<PORT> -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false

In fact, the existing Elasticsearch plugins for Munin skip the JVM altogether and get their data via JSON on port 9200.

So, how could this be done via the JVM? If this is not possible I'm also interested in other free solutions to monitor Elasticsearch.

1
+50

If you're only interested in JVM's own stats (not Elasticsearch's), try using JVM's built-in SNMP agent -- a tutorial from OpenNMS should help.

JMX can operate in local mode as well; the client must be running under the same user account as the JVM. jmxterm is capable of this (here's what it does), but apparently, Munin's jmxquery tool is not.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.