Jmx4Perl

As described in this story, Jolokia has its origins in the Perl world where it starts as a simple solution for monitoring Java EE applications with Nagios. Jmx4perl was its former name, which in addition to the agents contains powerfule Perl modules for accessing Jolokia instrumented servers. These modules are the foundation for tools like check_jmx4perl, a Nagios plugin with a rich feature set, jmx4perl, a command line utility for accessing the agents and j4psh, a readline based remote JMX shell.

Jmx4perl requests looks like

use strict;
use JMX::Jmx4Perl;
use JMX::Jmx4Perl::Alias;   # Import MBean aliases

# Basic usage
print "Memory Used: ",
      JMX::Jmx4Perl
          ->new(url => "http://localhost:8080/jolokia",
                user => "jolokia",
                password => "jolokia")
          ->get_attribute(MEMORY_HEAP_USED), "\n";

# Advanced:
my $jmx = new JMX::Jmx4Perl(url => "http://localhost:8080/jolokia",
                            user => "jolokia",
                            password => "jolokia",
                            product => "tomcat");
my $request = new JMX::Jmx4Perl::Request({type => "read",
                                         mbean => "java.lang:type=Memory",
                                         attribute => "HeapMemoryUsage",
                                         path => "used"});
my $response = $jmx->request($request);
print "Memory used: ",$response->value(),"\n";

More information about jmx4perl can be found on its CPAN page.