DEV Community

Jean-François Lamy
Jean-François Lamy

Posted on

1

Interactive Java JVM Monitoring on Kubernetes - Configuring VisualVM to use JMXMP

This is part 2 of a 2-part series.

Despite feature requests to do so and some work to create a plugin, VisualVM does not ship with JMXMP configured by default. The following recipe has been tested with VisualVM 2.0.1.

If we used Maven to enable our application, we have a copy of the required java archive (jar) in the .m2 directory. The simple way is to add that jar to the class path using the --cp:a option. This jar would normally have to be "endorsed" to be used, but starting from the directory where it is found allows things to work.

cd C:\Dev\.m2\repository\org\glassfish\external\opendmk_jmxremote_optional_jar\1.0-b01-ea
C:\Dev\Java\visualvm_201\bin\visualvm.exe --cp:a opendmk_jmxremote_optional_jar-1.0-b01-ea.jar

You can also create a shortcut on your desktop to run the command. Use the Start In option to select the directory where the jmxremote jar is found.

Adding a remote host

When accessing a remote host such as KubeSail, add it using the add remote host option
image

Configure a connection

Under the new host (or under Local if connecting locally), right-click and use Add JMX Connection. Use the accessible address.

  • If running locally, this will be localhost, and the syntax will be service:jmx:jmxmp://localhost:1098
  • if remote, the external address obtained by querying the pod. In our example, that yieldsservice:jmx:jmxmp://54.151.2.??:300?? (the port is the one listed in the NodePort configuration as explained in Part 1.)

image

  • Double-clicking on the new connection will open it, and the name of the monitored application will be shown. You can then use the various tabs to monitor, examine or sample the application.

image

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more →

Top comments (0)

👋 Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay