Skip to main content Skip to complementary content

Building the jmx4perl plugin

We use the Perl CPAN (Comprehensive Perl Archive Network) shell here to download missing dependencies.

Before you begin

The main commands and scripts in this section (cpan, Build.PL, the Build perl script) need to be run with root permissions, for example, as root or using sudo.


  1. Extract the jmx4perl distribution:
    $ cd /usr/local/src
    # tar zxvf /tmp/jmx4perl-1.05.tar.gz
    # ln -s -f jmx4perl-1.05 jmx4perl
  2. Install the build module:
    # cpan 
    cpan[1]> install Module::Build
    cpan[1]> exit
  3. This step installs missing dependencies for jmx4perl. There are two ways of doing this:
    • A Build perl script is created later in this section; if you have a Build script that was previously created (for example, during an similar installation on another machine), then it's quicker to use it here:
      # cd /usr/local/src/jmx4perl
      # ./Build installdeps
    • If you do not have a previously-created Build script, then explicitly install jmx4perl dependencies (and accept the default values to any questions):

      # cpan
      cpan[1]> install Config::General
      cpan[2]> install Crypt::Blowfish_PP
      cpan[3]> install File::SearchPath
      cpan[4]> install JSON
      cpan[5]> install Module::Find
      cpan[6]> install Nagios::Plugin
      cpan[7]> install Term::Clui
      cpan[8]> install Term::ReadKey
      cpan[9]> install Term::ReadLine::Perl
      cpan[10]> install Term::ShellUI
      cpan[11]> install Term::Size
      cpan[12]> exit
  4. Run the newly-created Build.PL script, which generates the ./Build perl script:
    # cd /usr/local/src/jmx4perl
    # perl Build.PL
    Information noteNote: Choose 'n' in response to "Install 'jolokia'" in the following script. Jolokia is not required directly on the Nagios server host, and only needs to be installed within the monitored containers (Talend containers have it pre-installed). Adding Jolokia would require installing additional modules and has not been tested.

    When running this script give the following answers:

    Install 'jmx4perl' ? (y/n) [y ]y
    Install 'check_jmx4perl' ? (y/n) [y ]y
    Install 'cacti_jmx4perl' ? (y/n) [y ]y
    Install 'j4psh' ? (y/n) [y ]y
    Install Term::ReadLine::Gnu ? (y/n) [n ]n
    Install 'jolokia' ? (y/n) [y ]n 

    * see note above

    Run the ./Build script to recheck all dependencies are installed:

    # ./Build installdeps
  5. Run the Build comand:
    # ./Build install

What to do next

When all these steps finished successfully, the jmx4perl plugin should be installed onto Nagios.

Check everything has been correctly installed by communicating with a Talend Runtime Container (this already has an active Jolokia agent) (please replace <jolokia_host> with the host where the Talend Runtime Container is running):

$ check_jmx4perl -u http://<jolokia_host>:8040/jolokia --alias 
			MEMORY_HEAP_USED --base MEMORY_HEAP_MAX --warning 80 --critical 90

If you have problems getting this running, try disabling the firewall on the Jolokia (Talend Runtime Container) host.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!