Add Satellite JMX Counters to Nagios
This topic describes how to configure Nagios to pick up JMX counters from Deploy Satellite. For more information on how to setup and use JMX counters with Deploy Satellite, see Using JMX counters for Deploy Satellite.
Setting up Deploy Satellite JMX counters with Nagios requires a Nagios Server with Web UI and the setup of a Nagios Remote Plugin Executor (NRPE) agent on the machine running the Satellite JMX agent.
Setup the NRPE agent
- Setup the NRPE agent, follow the steps in the Nagios documentation corresponding to the OS of the Deploy Satellite server machine, see the Nagios documentation.
- Setup NRPE with SSL, follow the steps mentioned here.
- To verify that the installation is working on the Deploy Satellite machine, execute the following command from the machine running Nagios Server:
If the installation was successful, you should see this response:
/usr/local/nagios/libexec/check_nrpe -H <IP_ADDRESS_OF_SATELLITE_SERVER>
NRPE v3.2.1
- After NRPE is successfully installed, install the
check_jmx
plugin that monitors any javaobject/attribute
accessible through JMX, including the Satellite counters. - Install the
check_jmx
plugin, open a terminal and execute the following commands:cd /usr/local/nagios/libexec/
wget -O check_jmx "https://raw.githubusercontent.com/WillPlatnick/jmxquery/master/plugin/check_jmx"
wget -O jmxquery.jar "https://github.com/WillPlatnick/jmxquery/raw/master/plugin/jmxquery.jar"
chmod +x *jmx*
chown nagios:nagios *jmx* - If the JMX agent on the Deploy Satellite server has SSL enabled, execute the following steps:
- Copy the SSL
truststore
to/usr/local/nagios/libexec/
- Change the permissions on
truststore
to usernagios
:chmod +x <trustore_file_name>
chown nagios:nagios <trustore_file_name>
- Copy the SSL
- Change the content of
/usr/local/nagios/libexec/check_jmx
to:#!/bin/sh
#
# Nagios plugin to monitor Java JMX (http://java.sun.com/jmx)attributes.
#
RDIR=`dirname $0`
JMX_SSL_OPS='-Djavax.net.ssl.trustStore='$RDIR'/<trustore_file_name> -Djavax.net.ssl.trustStorePassword=<trustore_password>'
java $JMX_SSL_OPS -jar $RDIR/jmxquery.jar "$@"
Replace <trustore_file_name>
and <trustore_password>
with the actual values.
- Test the
check_jmx
plugin from the Nagios Server by executing this command:The sample output:/usr/local/nagios/libexec/check_jmx -U service:jmx:rmi:///jndi/rmi://<satellite_host>:<jmx_port>/jmxrmi -O com.xebialabs.satellite.metrics:name=task.done -A Count
JMX OK - Count=0 | Count=0
Configure the NRPE agent
-
To execute the
check_jmx
plugin, you must define a command for this plugin in thenrpe.cfg
file on the Satellite server. Edit the/usr/local/nagios/etc/nrpe.cfg
file by executing the following command:vi /usr/local/nagios/etc/nrpe.cfg
-
Add the following line to the end of the file:
command[check_jmx]=/usr/local/nagios/libexec/check_jmx $ARG1$
-
Restart the NRPE service on satellite server. To restart the NRPE service, refer to the documentation for the NRPE agent installation.
-
To test, establish a terminal session to your Nagios server and execute the following command, replace
<satellite_host>
with the IP address of your Deploy Satellite server:/usr/local/nagios/libexec/check_nrpe -H <satellite_host> -c check_jmx -a '-U service:jmx:rmi:///jndi/rmi://<satellite_host>:<jmx_port>/jmxrmi -O com.xebialabs.satellite.metrics:name=task.done -A Count'
Sample output:
JMX OK - Count=0 | Count=0