-
Notifications
You must be signed in to change notification settings - Fork 26
Using jconsole to read data from the sysmon daemon
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.
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:
-
com.sun.management.jmxremote.port=10001
- sets the port number to bind to -
com.sun.management.jmxremote.authenticate=false
- turns off authentication -
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.
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.
When jconsole
starts up, you should be presented with a screen that looks like this:
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).
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.
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.
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.
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: