Monitoring Data Grid services

  • Red Hat Data Grid 8.3
  • Updated 08 February 2022
  • Published 02 December 2021

Monitoring Data Grid services

Red Hat Data Grid 8.3
  • Updated 08 February 2022
  • Published 02 December 2021

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

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.

Creating a Prometheus service monitor

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


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 'true' annotation to your Infinispan CR metadata, if the value is not already explicitly set:

    kind: Infinispan
      name: infinispan
      annotations: 'true'

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


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:


Disabling the Prometheus service monitor

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

  1. Set 'false' as the value for the annotation in your Infinispan CR.

    kind: Infinispan
      name: infinispan
      annotations: 'false'
  2. Apply the changes.

Installing the Grafana Operator

To support various needs, Data Grid Operator integrates with the community version of the Grafana Operator to create dashboards for Data Grid services.

Until Grafana is integrated with OpenShift user workload monitoring, the only option is to rely on the community version. You can install the Grafana Operator on OpenShift from the OperatorHub and should create a subscription for the alpha channel.

However, as is the policy for all Community Operators, Red Hat does not certify the Grafana Operator and does not provide support for it in combination with Data Grid. When you install the Grafana Operator you are prompted to acknowledge a warning about the community version before you can continue.

Creating Grafana data sources

Create a GrafanaDatasource CR so you can visualize Data Grid metrics in Grafana dashboards.

  • Have an oc client.

  • Have cluster-admin access to OpenShift Container Platform.

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

  • Install the Grafana Operator from the alpha channel and create a Grafana CR.

  1. Create a ServiceAccount that lets Grafana read Data Grid metrics from Prometheus.

    apiVersion: v1
    kind: ServiceAccount
      name: infinispan-monitoring
    1. Apply the ServiceAccount.

      $ oc apply -f service-account.yaml
    2. Grant cluster-monitoring-view permissions to the ServiceAccount.

      $ oc adm policy add-cluster-role-to-user cluster-monitoring-view -z infinispan-monitoring
  2. Create a Grafana data source.

    1. Retrieve the token for the ServiceAccount.

      $ oc serviceaccounts get-token infinispan-monitoring
    2. Define a GrafanaDataSource that includes the token in the spec.datasources.secureJsonData.httpHeaderValue1 field, as in the following example:

      kind: GrafanaDataSource
        name: grafanadatasource
        name: datasource.yaml
          - access: proxy
            editable: true
            isDefault: true
              httpHeaderName1: Authorization
              timeInterval: 5s
              tlsSkipVerify: true
            name: Prometheus
              httpHeaderValue1: >-
            type: prometheus
            url: 'https://thanos-querier.openshift-monitoring.svc.cluster.local:9091'
  3. Apply the GrafanaDataSource.

    $ oc apply -f grafana-datasource.yaml
Next steps

Enable Grafana dashboards with the Data Grid Operator configuration properties.

Configuring Data Grid dashboards

Data Grid Operator provides global configuration properties that let you configure Grafana dashboards for Data Grid clusters.

You can modify global configuration properties while Data Grid Operator is running.

  • Data Grid Operator must watch the namespace where the Grafana Operator is running.

  1. Create a ConfigMap named infinispan-operator-config in the Data Grid Operator namespace.

    apiVersion: v1
    kind: ConfigMap
      name: infinispan-operator-config
      grafana.dashboard.namespace: infinispan infinispan
      grafana.dashboard.monitoring.key: middleware
  2. Specify the namespace of your Data Grid cluster with the data.grafana.dashboard.namespace property.

    Deleting the value for this property removes the dashboard. Changing the value moves the dashboard to that namespace.

  3. Specify a name for the dashboard with the property.

  4. If necessary, specify a monitoring key with the data.grafana.dashboard.monitoring.key property.

  5. Create infinispan-operator-config or update the configuration.

    $ oc apply -f infinispan-operator-config.yaml
  6. Open the Grafana UI, which is available at:

    $ oc get routes grafana-route -o jsonpath=https://"{}"