Menu
Grafana Cloud

Wildfly integration for Grafana Cloud

Wildfly is a modular & lightweight application server that handles deploying and managing several Java application servers. The Wildfly integration uses the Grafana Agent to collect metrics and logs for monitoring a Wildfly instance. Including metrics for monitoring sessions, deployments, network traffic, and datasource connections. This also includes monitoring server log files of a Wildfly instance which provides valuable information for usage and operations of the instance.

This integration supports Wildfly 27.X onwards.

This integration includes 2 useful alerts and 2 pre-built dashboards to help monitor and visualize Wildfly metrics and logs.

Before you begin

In order to collect metrics from Wildfly, ensure the metric subsystem is enabled by following the official documentation.

To enable session metrics, run the following command in the CLI:

/subsystem=undertow:write-attribute(name=statistics-enabled,value=true)

To enable transaction metrics, run the following command in the CLI:

/subsystem=transactions:write-attribute(name=statistics-enabled, value=true)

Wildfly has authentication enabled by default (for Wildfly management interfaces). This includes a simple username and password from an established user. To setup a user, simply run the add-user.sh script inside the Wildfly installation’s bin folder. Once script is complete, add your new <wildfly_user> and <wildfly_password> to the username and password fields underneath basic_auth. However, in the case that Wildlfly authentication is not enabled, basic_auth may need to be removed in your metrics config.

More info on user creation can be found here.

The CLI is launched using jboss-cli.sh or jboss-cli.bat located in the WildFly bin directory. For more information on default directory structure visit Getting Started Guide.

Next, connect to the WildFly instance. This is done by running connect command.

./bin/jboss-cli.sh
You are disconnected at the moment. Type 'connect' to connect to the server
or 'help' for the list of supported commands.
[disconnected /]

[disconnected /] connect
[domain@localhost:9990 /]

[domain@localhost:9990 /] quit
Closed connection to localhost:9990

To terminate the session type quit.

Install Wildfly integration for Grafana Cloud

  1. In your Grafana Cloud stack, click Connections in the left-hand menu.
  2. Find Wildfly and click its tile to open the integration.
  3. Review the prequisites in the Configuration Details tab and set up Grafana Agent by following the steps provided to start sending Wildfly metrics and logs to your Grafana Cloud instance.
  4. Click Install to add this integration’s pre-built dashboards and alerts to your Grafana Cloud instance and start monitoring your Wildfly setup.

Post-install configuration for the Wildfly integration

After ensuring subsystem metrics are enabled, instruct the Grafana Agent to scrape Metrics from a WildFly instance.

Make sure to change targets in the snippet according to your environment.

If you want to show logs and metrics signals in your dashboards, ensure the following:

  • instance label must be set to a value that uniquely identifies your Wildfly Instance. Please replace the default hostname value according to your environment - it should be set manually.
  • job must be set to integrations/wildfly

In the case that Wildlfly authentication is not enabled, basic_auth may need to be removed in your metrics config.

Configuration snippets for Grafana Agent

Below metrics.configs.scrape_configs, insert the following lines changing the urls according to your environment:

    - job_name: integrations/wildfly
      metrics_path: /metrics
      basic_auth:
        username: <wildfly_user>
        password: <wildfly_password>
      static_configs:
        - targets: ["localhost:9990"]

Below logs.configs.scrape_configs, insert the following lines according to your environment.

    - job_name: integrations/wildfly
      static_configs:
        - targets: [localhost]
          labels:
            instance: <your-instance-name>
            job: integrations/wildfly
            __path__: /opt/wildfly/standalone/log/server.log
      pipeline_stages:
        - multiline:
        # match on timestamp. Format should be like '2023-01-20 09:38:23,454'
        # but feel free to modify to match your logs
          firstline: '\d+-\d+-\d+ \d+:\d+:\d+,\d+'

Full example configuration for Grafana Agent

Below is a complete example Grafana Agent configuration with all the snippets to be used for the Wildfly integration. It also includes a few metrics that are sent to monitor your Grafana Agent instance. Beware that you should replace urls, credentials and labels according to your stack and instructions from the previous section.

integrations:
  agent:
    enabled: true
    relabel_configs:
    - action: replace
      source_labels:
      - agent_hostname
      target_label: instance
    metric_relabel_configs:
    - action: keep
      regex: (prometheus_target_.*|prometheus_sd_discovered_targets|agent_build.*|agent_wal_samples_appended_total|process_start_time_seconds)
      source_labels:
      - __name__
  prometheus_remote_write:
  - basic_auth:
      password: <your_prom_pass>
      username: <your_prom_user>
    url: <your_prom_url>
logs:
  configs:
  - clients:
    - basic_auth:
        password: <your_loki_pass>
        username: <your_loki_user>
      url: <your_loki_url>
    name: integrations
    positions:
      filename: /tmp/positions.yaml
    scrape_configs:
    - job_name: integrations/wildfly
      static_configs:
        - targets: [localhost]
          labels:
            instance: <your-instance-name>
            job: integrations/wildfly
            __path__: /opt/wildfly/standalone/log/server.log
      pipeline_stages:
        - multiline:
        # match on timestamp. Format should be like '2023-01-20 09:38:23,454'
        # but feel free to modify to match your logs
          firstline: '\d+-\d+-\d+ \d+:\d+:\d+,\d+'
metrics:
  configs:
  - name: integrations
    remote_write:
    - basic_auth:
        password: <your_prom_pass>
        username: <your_prom_user>
      url: <your_prom_url>
    scrape_configs:
    - job_name: integrations/wildfly
      metrics_path: /metrics
      basic_auth:
        username: <wildfly_user>
        password: <wildfly_password>
      static_configs:
        - targets: ["localhost:9990"]
  global:
    scrape_interval: 60s
  wal_directory: /tmp/grafana-agent-wal

Dashboards

The Wildfly integration installs the following dashboards in your Grafana Cloud instance to help monitor your system.

  • Wildfly datasource
  • Wildfly overview

Wildfly overview

image

Wildfly overview (Sessions)

image

Wildfly datasource dashboard

image

Alerts

The Wildfly integration includes the following useful alerts:

AlertDescription
HighPercentageOfErrorResponsesCritical: Large percentage of requests are resulting in 5XX responses.
HighNumberOfRejectedSessionsForDeploymentCritical: Large number of sessions are being rejected for a deployment.

Metrics

The most important metrics provided by the Wildfly integration, which are used on the dashboards (and Prometheus Alerts and rules) are as follows:

  • wildfly_batch_jberet_active_count
  • wildfly_datasources_pool_idle_count
  • wildfly_datasources_pool_in_use_count
  • wildfly_transactions_number_of_aborted_transactions_total
  • wildfly_transactions_number_of_inflight_transactions
  • wildfly_transactions_number_of_transactions_total
  • wildfly_undertow_active_sessions
  • wildfly_undertow_bytes_received_total_bytes
  • wildfly_undertow_bytes_sent_total_bytes
  • wildfly_undertow_error_count_total
  • wildfly_undertow_expired_sessions_total
  • wildfly_undertow_rejected_sessions_total
  • wildfly_undertow_request_count_total

Changelog

# 0.0.1 - April 2023

- Initial release

Cost

By connecting your Wildfly instance to Grafana Cloud you might incur charges. To view information on the number of active series that your Grafana Cloud account uses for metrics included in each Cloud tier, see Active series and dpm usage and Cloud tier pricing.