I&B Monitoring Platform documentation

JMX exporter

To set up the JMX Exporter for monitoring WildFly with Prometheus, you can use the example configuration provided for WildFly. Below is a concise guide and an example configuration:

Steps to Configure JMX Exporter for WildFly

  1. Download JMX Exporter: Obtain the jmx_prometheus_javaagent.jar from the official Prometheus JMX Exporter GitHub repository.

  1. Place the Agent: Copy the jmx_prometheus_javaagent.jar to a directory accessible by your WildFly server.

  1. Create a Configuration File: Use the example wildfly-10.yaml configuration file or customize it as needed.

  1. Modify WildFly Startup Script:

    • Add the following JVM argument to the standalone.conf or domain.conf file:

      Bash
      -javaagent:/path/to/jmx_prometheus_javaagent.jar=12345:/path/to/wildfly-10.yaml
      

      Replace /path/to/ with the actual paths and 12345 with the desired port for metrics exposure.

  1. Restart WildFly: Restart the server to apply the changes.

  1. Verify Metrics: Access the metrics at http://127.0.0.1:12345/metrics.

Example Configuration (wildfly-10.yaml)

Bash
startDelaySeconds: 0
rules:
  - pattern: ".*"
    name: "wildfly_jmx_$1"
    type: GAUGE
    help: "WildFly JMX metric $1"
    labels:
      instance: "wildfly"

This configuration collects all JMX metrics and exposes them with a generic naming convention. You can customize the rules section to filter or rename metrics as needed.

Additional Notes

  • Ensure the port you specify is closed and not accessible from outside

  • For production, refine the rules to avoid collecting unnecessary metrics, which can lead to performance overhead.

For access with basic auth and encryption from outside the wildfly server need to deploy nginx reverse proxy with basic auth and tls encryption. For do this read Install NGINX as reverse proxy to add basic auth and tls encription for exporters not support this out of box .

After install nginx reverse proxy, metrics of your wildfly application will exposed on url:https://<wildfly-host-or-ip>:12345/metrics

after login to this URL you will see some like this:

image-20251007-123610.png

Enjoy!)