Este contenido no está disponible en el idioma seleccionado.

Chapter 11. Monitoring Data Grid with Prometheus


Data Grid exposes a metrics endpoint that provides statistics and events to Prometheus.

11.1. Creating a Prometheus Service Monitor

Define a service monitor instances that configures Prometheus to monitor your Data Grid cluster.

Prerequisites

  • Set up a Prometheus stack on your OpenShift cluster.

Procedure

  1. Create an authentication secret that contains Data Grid credentials so that Prometheus can authenticate with your Data Grid cluster.

    apiVersion: v1
    stringData:
      username: developer 
    1
    
      password: dIRs5cAAsHIeeRIL 
    2
    
    kind: Secret
    metadata:
      name: basic-auth
    type: Opaque
    Copy to Clipboard Toggle word wrap
    1
    Specifies an application user. developer is the default.
    2
    Specifies the corresponding password.
  2. Add the authentication secret to your Prometheus namespace.

    $ oc apply -f basic-auth.yaml
    Copy to Clipboard Toggle word wrap
  3. Create a service monitor that configures Prometheus to monitor your Data Grid cluster.

    apiVersion: monitoring.coreos.com/v1
    kind: ServiceMonitor
    metadata:
      labels:
        k8s-app: prometheus
      name: datagrid-monitoring 
    1
    
      namespace: infinispan-monitoring 
    2
    
    spec:
      endpoints:
        - targetPort: 11222 
    3
    
          path: /metrics 
    4
    
          honorLabels: true
          basicAuth:
            username:
              key: username
              name: basic-auth 
    5
    
            password:
              key: password
              name: basic-auth
          interval: 30s
          scrapeTimeout: 10s
          scheme: https 
    6
    
          tlsConfig:
            insecureSkipVerify: true
            serverName: example-infinispan 
    7
    
      namespaceSelector:
        matchNames:
          - infinispan 
    8
    
      selector:
        matchLabels:
          app: infinispan-service
          clusterName: example-infinispan 
    9
    Copy to Clipboard Toggle word wrap
    1
    Names the service monitor instances.
    2
    Specifies the namespace of your Prometheus stack.
    3
    Sets the port of 11222 for the Data Grid metrics endpoint.
    4
    Sets the path where Data Grid exposes metrics.
    5
    Specifies the authentication secret with Data Grid credentials.
    6
    Specifies that Data Grid clusters use endpoint encryption.
    7
    Specifies the Common Name (CN) of the TLS certificate for Data Grid encryption. If you use an OpenShift service certificate, the CN matches the metadata.name resource for your Data Grid cluster.
    8
    Specifies the namespace of your Data Grid cluster.
    9
    Specifies the name of your Data Grid cluster.
  4. Add the service monitor instance to your Prometheus namespace.

    $ oc apply -f service-monitor.yaml
    Copy to Clipboard Toggle word wrap
Volver arriba
Red Hat logoGithubredditYoutubeTwitter

Aprender

Pruebe, compre y venda

Comunidades

Acerca de la documentación de Red Hat

Ayudamos a los usuarios de Red Hat a innovar y alcanzar sus objetivos con nuestros productos y servicios con contenido en el que pueden confiar. Explore nuestras recientes actualizaciones.

Hacer que el código abierto sea más inclusivo

Red Hat se compromete a reemplazar el lenguaje problemático en nuestro código, documentación y propiedades web. Para más detalles, consulte el Blog de Red Hat.

Acerca de Red Hat

Ofrecemos soluciones reforzadas que facilitan a las empresas trabajar en plataformas y entornos, desde el centro de datos central hasta el perímetro de la red.

Theme

© 2025 Red Hat