As described in this story, Jolokia has its origins in the Perl world where it starts as a simple solution for monitoring Java Java EE applications with Nagios. Jmx4perl was its former name, which in addition the agents contains powerfule Perl modules for accessing Jolokia instrumented servers. This modules are the fundaments 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") ->get_attribute(MEMORY_HEAP_USED); # Advanced: my $jmx = new JMX::Jmx4Perl(url => "http://localhost:8080/jolokia", product => "jboss"); 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.