Skip to main content

Monitoring with JMXMP

All Clematis API are configured to use JMXMP without SSL and authentication, since it is still the internal network with Zabbix. For production, we would've used JMXMP with SSL and authentication, of course, so if production happens with any of the home projects. This also would mean that we need to use Cloud hosting, not the home network.

Setting Up Zabbix Java Gateway and Pollers

For Zabbix to be able to work with JMXMP, the Java Gateway component needs to be set up:

On Zabbix server
sudo apt install zabbix-java-gateway

The required configuration is done in the Zabbix configuration file:

On Zabbix server
sudo nano /etc/zabbix/zabbix_server.conf 

Uncomment the following lines:

### Option: JavaGateway
# IP address (or hostname) of Zabbix Java gateway.
# Only required if Java pollers are started.
#
# Mandatory: no
# Default:
JavaGateway=127.0.0.1

### Option: JavaGatewayPort
# Port that Zabbix Java gateway listens on.
#
# Mandatory: no
# Range: 1024-32767
# Default:
JavaGatewayPort=10052

### Option: StartJavaPollers
# Number of pre-forked instances of Java pollers.
#
# Mandatory: no
# Range: 0-1000
# Default:
StartJavaPollers=10

Add jmxremote_optional-repackaged-5.0.jar library to Java Gateway classpath:

On Zabbix server
sudo mv jmxremote_optional-repackaged-5.0.jar /usr/share/zabbix/java-gateway/lib/

Restart the Zabbix Java Gateway:

On Zabbix server
sudo systemctl restart zabbix-java-gateway

Create JMXMP Template

Zabbix has a template for JMX called Generic Java JMX, but it is configured to work with RMI protocol, the connection URL template is service:jmx:rmi:///jndi/rmi://{HOST.CONN}:{HOST.PORT}/jmxrmi.

The easiest way to change the protocol is to create a new template, and change the connection URL to service:jmx:jmxmp://{HOST.CONN}:{HOST.PORT}.

  1. Clone the Generic Java JMX template in Zabbix UI, I called the clone Generic Java JMXMP:
  2. Now go to the Items section of the clone, select 'Mass Update' and change URL of all the items to service:jmx:jmxmp://{HOST.CONN}:{HOST.PORT}:
  3. There will be 8 more places not editable via mass update, so you need to change them manually. Export the template, change all the URLs, and import it back.

Download Generic Java JMXMP template

Use JMXMP Template

Create a new Java application host in Zabbix, and use the Generic Java JMXMP template:

The host will be able to connect to the JMXMP: