Chapter 14. Monitoring Data Grid services


Data Grid exposes metrics that can be used by Prometheus for monitoring and visualizing the cluster state.

Note

This documentation explains how to set up monitoring on OpenShift Container Platform. If you’re working with community Prometheus deployments, you might find these instructions useful as a general guide. However you should refer to the Prometheus documentation for installation and usage instructions.

See the Prometheus Operator documentation.

14.1. Creating a Prometheus service monitor

Data Grid Operator automatically creates a Prometheus ServiceMonitor that scrapes metrics from your Data Grid cluster.

Procedure

Enable monitoring for user-defined projects on OpenShift Container Platform.

When the Operator detects an Infinispan CR with the monitoring annotation set to true, which is the default, Data Grid Operator does the following:

  • Creates a ServiceMonitor named <cluster_name>-monitor.
  • Adds the infinispan.org/monitoring: 'true' annotation to your Infinispan CR metadata, if the value is not already explicitly set:

    apiVersion: infinispan.org/v1
    kind: Infinispan
    metadata:
      name: infinispan
      annotations:
        infinispan.org/monitoring: 'true'
Note

To authenticate with Data Grid, Prometheus uses the operator credentials.

Verification

You can check that Prometheus is scraping Data Grid metrics as follows:

  1. In the OpenShift Web Console, select the </> Developer perspective and then select Monitoring.
  2. Open the Dashboard tab for the namespace where your Data Grid cluster runs.
  3. Open the Metrics tab and confirm that you can query Data Grid metrics such as:

    vendor_cache_manager_default_cluster_size

14.1.1. Disabling the Prometheus service monitor

You can disable the ServiceMonitor if you do not want Prometheus to scrape metrics for your Data Grid cluster.

Procedure

  1. Set 'false' as the value for the infinispan.org/monitoring annotation in your Infinispan CR.

    apiVersion: infinispan.org/v1
    kind: Infinispan
    metadata:
      name: infinispan
      annotations:
        infinispan.org/monitoring: 'false'
  2. Apply the changes.

14.1.2. Configuring Service Monitor Target Labels

You can configure the generated ServiceMonitor to propagate Service labels to the underlying metrics using the ServiceMonitor spec.targetLabels field. Use the Service labels to filter and aggregate the metrics collected from the monitored endpoints.

Procedure

  1. Define labels to apply to your service by setting the infinispan.org/targetLabels annotation in your Infinispan CR.
  2. Specify a comma-separated list of the labels required in your metrics using the infinispan.org/serviceMonitorTargetLabels annotation on your Infinispan CR.

    apiVersion: infinispan.org/v1
    kind: Infinispan
    metadata:
      name: infinispan
      annotations:
        infinispan.org/targetLabels: "label1,label2,label3"
        infinispan.org/serviceMonitorTargetLabels: "label1,label2"
  3. Apply the changes.

Enable JMX remote ports to expose Data Grid MBeans and to integrate Data Grid with external monitoring systems such as Cryostat.

When you enable JMX for Data Grid cluster, the following occurs:

  1. Each Data Grid server pod exposes an authenticated JMX endpoint on port 9999 utilizing the "admin" security-realm, which includes the Operator user credentials.
  2. The <cluster-name>-admin Service exposes port 9999.
Note

You can enable or disable JMX only during the creation of the Infinispan CR. Once the CR instance is created, you cannot modify the JMX settings.

Procedure

  1. Enable JMX in your Infinispan CR.

    apiVersion: infinispan.org/v1
    kind: Infinispan
    metadata:
      name: infinispan
    spec:
      jmx:
        enabled: true
  2. Retrieve the Operator user credentials to authenticate client JMX connections.

    oc get secret infinispan-generated-operator-secret -o jsonpath="{.data.identities\.yaml}" | base64 --decode

Additional resources

14.3. Setting up JFR recordings with Cryostat

Enable JDK Flight Recorder (JFR) monitoring for your Data Grid clusters that run on OpenShift.

JFR recordings with Cryostat

JFR provides insights into various aspects of JVM performance to ease cluster inspection and debugging. Depending on your requirements, you can store and analyze your recordings using the integrated tools provided by Cryostat or export the recordings to an external monitoring application.

Prerequisites

  • Install the Cryostat Operator. You can install the Cryostat Operator in your OpenShift project by using Operator Lifecycle Manager (OLM).
  • Have JMX enabled on your Data Grid cluster. You must enable JMX before deploying the cluster, as JMX settings cannot be modified after deployment.

Procedure

  1. Create a Cryostat CR in the same namespace as your Infinispan CR.

    apiVersion: operator.cryostat.io/v1beta1
    kind: Cryostat
    metadata:
      name: cryostat-sample
    spec:
      minimal: false
      enableCertManager: true
    Note

    The Cryostat Operator requires cert-manager for traffic encryption. If the cert-manager is enabled but not installed, the deployment fails. For details, see the Installing Cryostat guide.

  2. Wait for the Cryostat CR to be ready.

    oc wait -n <namespace> --for=condition=MainDeploymentAvailable cryostat/cryostat-sample
  3. Open the Cryostat status.applicationUrl.

    oc -n <namespace> get cryostat cryostat-sample
  4. Retrieve the Operator user credentials to authenticate client JMX connections in the Cryostat UI.

    oc get secret infinispan-generated-operator-secret -o jsonpath="{.data.identities\.yaml}" | base64 --decode
  5. In the Cryostat UI, navigate to the Security menu.
  6. In the Store Credentials window, click the Add button. The Store Credentials window opens.
  7. In the Match Expression filed, enter match expression details in the following format:

    target.labels['infinispan_cr'] == '<cluster_name>'
Red Hat logoGithubredditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust. Explore our recent updates.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

Theme

© 2026 Red Hat
Back to top