Skip to main content

Jmx4Perl on OS X

·347 words·2 mins

The HTTP-JMX Bridge Jolokia allows easy access to JMX. It exposes all JMX information and operations via an REST-like interface and has tons of nifty features. Jmx4Perl on the other side is a client for Jolokia, which beside Perl access modules also provides quite some nice CLI tools for accessing and installing Jolokia. This post explains how install these tools on OS X.

Jmx4Perl provides some nice CLI commands:

  • jmx4perl is a simple access tool which is useful for quick queries and ideal for inclusion in shell scripts.
  • j4psh is a powerful interactive, readline based JMX shell with tab completion and syntax highlighting.
  • jolokia is a tool for managing Jolokia agents (downloading, changing init properties etc.)

All this tools are very helpful in order to explore the JMX namespace and installing the agent. They all are fairly good documented and each of them probably deserves an own blog post.

However, the installation or Perl modules and programs is a bit tedious. Although cpan helps here and also resolves transitive dependencies it’s still a lengthy process, which fails from time to time. Native Linux packages are planned, but don’t hold your breath ;-).

For OS X users with Homebrew can install Jmx4Perl quite easily, though:

$ brew install cpanm
$ cpanm --sudo install JMX::Jmx4Perl

This will do all the heavy lifting for you and at the end all the fine Jmx4Perl tools are installed and available under /usr/local/bin.

j4psh uses libreadline for the input handling. For the best user experience GNU ReadLine is recommended. Unfortunately, OS X doesn’t ship with a true libreadline but with libedit which is a stripped down version of libreadline. In order to use GNU readline, some tricks are needed which are described in this recipe. For me, the following steps worked (but are probably a bit “dirty”):

$ brew install readline
$ brew link --force readline
$ sudo mv /usr/lib/libreadline.dylib /tmp/libreadline.dylib 
$ cpanm --sudo Term::ReadLine::Gnu
$ sudo mv /tmp/libreadline.dylib /usr/lib/libreadline.dylib
$ brew unlink readline

These steps are really only necessary if you need advanced readline functionality (or a coloured prompt in j4psh ;-).

Related

Health Checks with Jolokia

·516 words·3 mins
A health check is a useful technique for determining the overall operational state of a system in a consolidated form. It provides some kind of internal monitoring which collects metrics, evaluates them against some thresholds and provides a unified result. Health checks are now coming to Jolokia. This post explains the strategy to include health checks into Jolokia without blowing up the agents to much.

Spicy Docker Java Images with Jolokia

·358 words·2 mins
While on the way of transforming the Jolokia integration test suite from a tedious, manual, half-a-day procedure to a full automated process I ran into and felt in love with Docker. As a byproduct a java-jolokia docker repository emerged, which can be easily used as a Java base image for enabling a Jolokia JVM agent during startup for any Java application.

Jolokia and CORS

·1042 words·5 mins
Jolokia has configurable CORS support so that it plays nicely together with the Browser world when it comes to cross origin requests. However, Jolokia’s CORS support is not without gotchas. This post explains how Jolokias CORS supports works, what are the issues and how I plan to solve them.