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.
We use the Perl CPAN (Comprehensive Perl Archive Network) shell here to download missing dependencies.
Extract the jmx4perl distribution:
$ cd /usr/local/src
# tar zxvf /tmp/jmx4perl-1.05.tar.gz
# ln -s -f jmx4perl-1.05 jmx4perl
Install the build module:
cpan> install Module::Build
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> install Config::General
cpan> install Crypt::Blowfish_PP
cpan> install File::SearchPath
cpan> install JSON
cpan> install Module::Find
cpan> install Nagios::Plugin
cpan> install Term::Clui
cpan> install Term::ReadKey
cpan> install Term::ReadLine::Perl
cpan> install Term::ShellUI
cpan> install Term::Size
Run the newly-created Build.PL script, which generates the ./Build perl script:
# cd /usr/local/src/jmx4perl
# perl Build.PL
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
Run the Build comand:
# ./Build install
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.