Skip to content
This repository was archived by the owner on Jan 11, 2020. It is now read-only.

Using jconsole to read data from the sysmon daemon

Nick Miyake edited this page Dec 6, 2016 · 3 revisions

Start the daemon for local monitoring

Local monitoring is performed via an RMI connection and requires no special configuration. If you're running out of the git repo (assuming you've done a build), it will look something like this:

$ java -jar target/dist/ptoss-platofrm-monitoring-daemon-1.0-SNAPSHOT.jar
No config file specified.  Using platform defaults.
Sysmon daemon started. Ctrl-C to quit.

Start the daemon for remote monitoring

Things get a little tricky here, but this due to the power and complexity of JMX. Enabling remote connections, by default, requires password authentication and SSL/TLS keys to make it work. For the purposes of a simple example, I've disabled those and picked a random port to bind the daemon to, 10001. Here are the System properties I'm setting to make this work:

  1. com.sun.management.jmxremote.port=10001 - sets the port number to bind to
  2. com.sun.management.jmxremote.authenticate=false - turns off authentication
  3. com.sun.management.jmxremote.ssl=false - turns of SSL/TLS for connecting via JMX

Note that I don't recommend running with this configuration unless you're 100% sure of the security implications, but it certainly simplifies getting things up and running for testing purposes.

The whole breadth of options is fairly well explained in the Java documentation: Monitoring and Management Using JMX Technology

If you're running out of the git repo (assuming you've done a build), it will look something like this:

$ java -Dcom.sun.management.jmxremote.port=10001 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -jar target/dist/ptoss-platform-monitoring-daemon-1.0-SNAPSHOT.jar
No config file specified.  Using platform defaults.
Sysmon daemon started. Ctrl-C to quit.

Fire up jconsole

jconsole lives in your JDK directory: $JAVA_HOME/bin/jconsole. For most machines, this just means typing jconsole at a prompt, assuming your paths are set up correctly.

Connect to a local daemon

When jconsole starts up, you should be presented with a screen that looks like this:

jconsole connect local

Just double-click on the entry that corresponds to the daemon (the one that says ptoss-platform-monitoring-daemon-1.0-SNAPSHOT.jar, in this case).

Connect to a remote daemon

It's very similar to connecting to a local daemon (assuming that you've started as specified above, with security disabled) - the only difference is you put in the host and port. Note that there is some complexity involved if you're using firewall on the machine running the daemon. That's out of scope for these instructions, but check out the JMX FAQ for more on firewalls.

jconsole connect remote

Looking at the data

Switch over to the beans tab. Along the left side, notice the list of beans. The data from the monitoring daemon is under the sysmon.linux folder.

jconsole look at the data

Drill down to individual metrics by opening the tree and finding the Attributes node. Click on that and all values for that bean will be revealed.

viewing attributes

Making Graphs

Double-clicking on a numeric value will start graphing that value over time. Here I've raised the sampling period for iostat to 1 seconds to generate some pretty graphs while generating some load on my workstation:

graphs