Monitoring GPU

You can monitor the GPU metrics on the Instana UI. To monitor GPUmetrics, install the NVIDIA GPU Operator and configure an OpenTelemetry-based data collector such as the Instana Distribution of OpenTelemetry Collector (IDOT) or an open source OpenTelemetry Collector.

NVIDIA GPU operator

You can install the NVIDIA GPU Operator on your GPU environment that helps manage and collect GPU metrics. Enable components such as NVIDIA drivers (to enable CUDA), Kubernetes device plugin for GPUs, and the NVIDIA Container Toolkit if you need them. For more information, see NVIDIA GPU Operator.

helm install gpu-operator \
   --repo https://helm.ngc.nvidia.com/nvidia \
   --namespace gpu-operator \
   --create-namespace \
   -set driver.enabled=false \
   -set toolkit.enabled=false \
   -set devicePlugin.enabled=false \
   -set mig.strategy=single \
   gpu-operator
 

The NVIDIA GPU Operator installs the NVIDIA Data Center GPU Manager (DCGM) by default. DCGM Exporter is a tool to NVIDIA DCGM that allows users to gather GPU metrics and understand workload behavior or monitor GPUs in clusters.

DCGM Exporter exposes GPU metrics at an HTTP endpoint (/metrics) for monitoring solutions. For more information, see DCGM Exporter.

Instana supports MIG (Multi-Instance GPU) through the DCGM Exporter that provides visibility into partitioned GPU usage. Metrics can be collected for each MIG instance independently, helping you monitor and allocate GPU resources more effectively in shared environments.

OpenTelemetry-based data collectors

You can forward the OpenTelemetry data of the GPU to an Instana agent or Instana backend by using the OpenTelemetry Collector.

You can use one of the following OpenTelemetry Collectors:
  • Instana Distribution of OpenTelemetry Collector (IDOT): IDOT is a preconfigured, optimized distribution that simplifies GPU monitoring setup. For more information, see IDOT and the OpenTelemetry project.
  • An open source OpenTelemetry Collector: An OpenTelemetry Collector is the core component of the OpenTelemetry ecosystem, offering vendor-independent functions for telemetry data collection, processing, and export. Use it for custom deployments or environments where IDOT is not available. For more information, see OpenTelemetry Collector.

Instana supports the following models to collect the GPU data:

  • Agent model: For this pattern, the GPU data is sent to the Instana agent first, and the agent helps aggregate the data and send to the Instana backend.
  • Agentless model: For this pattern, the GPU data is sent to the Instana backend directly without going through the agent.

Forwarding Telemetry data to an Instana agent (agent pattern)

  1. The following snippet shows a typical configuration for the OpenTelemetry Collector to forward telemetry data to a local Instana host agent by using the OTLP/gRPC protocol.

    Create a YAML file, such as config.yaml, as follows:

    receivers:
      otlp:
        protocols:
          grpc:
      prometheus/nvidia-dcgm:
        config:
          scrape_configs:
            - job_name: 'nvidia-dcgm'
              scrape_interval: 10s
              static_configs:
                - targets: 
                  - "$(DCGM_EXPORTOR_ENDPOINT)"
    processors:
      batch:
      resource:
        attributes:
          - key: server.address
            from_attribute: net.host.name
            action: insert
          - key: server.port
            from_attribute: net.host.port
            action: insert
          - key: service.name
            value: nvidia-dcgm
            action: update
          - key: INSTANA_PLUGIN
            value: dcgm
            action: insert
    exporters:
      otlp:
        endpoint: "$(INSTANA_AGENT_HOST):4317"
        tls:
          insecure: true
    service:
      pipelines:
        metrics/nvidia-dcgm:
          receivers: [prometheus/nvidia-dcgm]
          processors: [batch, resource]
          exporters: [otlp]
     
    Note:
    Data Center GPU Manager (DCGM) is an NVIDIA tool for GPU monitoring and management. The exporter exposes GPU metrics for Prometheus scraping. DCGM_EXPORTER_ENDPOINT represents the endpoint where the DCGM exporter runs. For example, the value of DCGM is 127.0.0.1:9400.

    The following example shows a typical configuration of the OpenTelemetry Collector for forwarding Telemetry data to a local Instana host agent with the OTLP/HTTP protocol.

    exporters:
      otlphttp:
        endpoint: "http://$(INSTANA_AGENT_HOST):4318"
        tls:
          insecure: true
     
    • Set the DCGM_EXPORTOR_ENDPOINT field with the DCGM Exporter endpoint.
    • Set the INSTANA_AGENT_HOST field with the IP or the host of the Instana agent to connect to.
    • Instana uses OTLP standard port numbers, such as 4317 for OTLP/gRPC and 4318 for OTLP/HTTP.
  2. After you complete all configuration changes in the config.yaml file, run the following command to use the OpenTelemetry Collector:
docker run -d -p 4317:4317 -v $(pwd)/config.yaml:/etc/otelcol-contrib/config.yaml otel/opentelemetry-collector-contrib:latest
 

Forwarding Telemetry data to the Instana backend (agentless pattern)

To forward OpenTelemetry data to the Instana backend by using the OpenTelemetry Collector, complete the following steps:

  1. Create a YAML file, such as config.yaml in the preceding section. Change the endpoint from Instana agent endpoint to Instana backend endpoint. The special endpoints of the backend otlp-acceptor component are used when the OpenTelemetry data is sent. The Instana backend requires an Instana agent key for validation. The Instana backend also requires the host.id, faas.id, or device.id resource attribute.

    exporters:
      otlp:
        endpoint: INSTANA_OTLP_GRPC_BACKEND:4317
        headers:
          x-instana-key: xxxxxxx
          x-instana-host: xxxx
     

    Notes:

    • Set the INSTANA_OTLP_GRPC_BACKEND field with the correct domain name of the otlp-acceptor component of the Instana backend. For more information about the endpoint of the Instana backend otlp-acceptor, see Endpoints of Self-Hosted Instana backend otlp-acceptor or Endpoints of SaaS Instana backend otlp-acceptor
    • Set the x-instana-key field with the agent key of the Instana agent for targeting the Instana backend. To find your agent key, you can click More > Agents in the navigation bar of the Instana UI and then click Install Agents > Windows.
    • Set the x-instana-host field with the host ID if no host.id, faas.id, or device.id resource attribute is defined in your application or system.
    • Instana uses OTLP standard port numbers, such as 4317 for OTLP/gRPC and 4318 for OTLP/HTTP. Port 443 is also supported for OTLP/HTTP.
  2. After you complete all configuration changes in the config.yaml file, run the following command to use the OpenTelemetry Collector:
docker run -d -p 4317:4317 -v $(pwd)/config.yaml:/etc/otelcol-contrib/config.yaml otel/opentelemetry-collector-contrib:latest
 

Automatic pod discovery configuration

Instead of specifying static DCGM exporter endpoints, you can configure the OpenTelemetry Collector to automatically discover DCGM exporter pods in your Kubernetes cluster by using kubernetes_sd_configs. This approach removes the need to hard-code individual pod addresses.

receivers:
  otlp:
    protocols:
      grpc: {}
  prometheus/nvidia-dcgm:
    config:
      scrape_configs:
        - job_name: nvidia-dcgm
          scrape_interval: 10s
          kubernetes_sd_configs:
            - role: pod
              namespaces:
                names: ['nvidia-gpu-operator']
          relabel_configs:
            - source_labels: [__meta_kubernetes_pod_label_app]
              regex: nvidia-dcgm-exporter
              action: keep
            - source_labels: [__meta_kubernetes_pod_container_port_name]
              regex: metrics
              action: keep
            - source_labels: [__meta_kubernetes_pod_node_name]
              target_label: node_name
              action: replace
          metric_relabel_configs:
            - source_labels: [__name__]
              regex: 'DCGM_FI_DEV_(GPU_UTIL|MEM_COPY_UTIL|FB_USED|FB_FREE|GPU_TEMP|POWER_USAGE|SM_CLOCK)|DCGM_FI_PROF_GR_ENGINE_ACTIVE'
              action: keep
processors:
  batch: {}
  transform:
    metric_statements:
      - context: datapoint
        statements:
          - set(resource.attributes["service.name"], Concat(["nvidia-dcgm@", resource.attributes["k8s.node.name"]], "")
          - set(resource.attributes["service.instance.id"], attributes["node_name"])
  resource:
    attributes:
      - action: insert
        from_attribute: net.host.name
        key: server.address
      - action: insert
        from_attribute: net.host.port
        key: server.port
      - action: update
        key: service.name
        value: nvidia-dcgm
      - action: insert
        key: INSTANA_PLUGIN
        value: dcgm

exporters:
  debug:
    verbosity: detailed
  otlp:
    endpoint: "http://<instana-grpc-host>:443"
    headers:
      x-instana-key: <api-key>
      x-instana-host: <instana-host>
  otlphttp:
    endpoint: "https://<instana-http-host>:443"
    headers:
      x-instana-key: <api-key>
      x-instana-host: <instana-host>

service:
  pipelines:
    metrics/nvidia-dcgm:
      receivers:
        - prometheus/nvidia-dcgm
      processors:
        - transform
        - batch
        - resource
      exporters:
        - otlp
        - debug
        - otlphttp
  telemetry:
    metrics:
      readers:
        - pull:
            exporter:
              prometheus:
                host: 0.0.0.0
                port: 8888

Viewing metrics

After you install OpenTelemetry (OTel) Data Collector, you can view the GPU metrics in the Instana UI.

  1. Open the Instana UI, and click Infrastructure. Then, click Analyze Infrastructure.
  2. Select OTEL Dcgm from the list of types of the entities.
  3. Click the entity instance of OTEL Dcgm entity type to open the associated dashboard.

GPU metrics

Metric Description
DCGM_FI_DEV_GPU_TEMP GPU temperature in celsius
DCGM_FI_DEV_POWER_USAGE Power consumption in watts
DCGM_FI_DEV_GPU_UTIL GPU utilization percentage
DCGM_FI_DEV_MEM_COPY_UTIL Memory copy engine utilization
DCGM_FI_DEV_FB_USED Used framebuffer memory
DCGM_FI_DEV_FB_FREE Free framebuffer memory
DCGM_FI_DEV_SM_CLOCK Streaming multiprocessor clock frequency
DCGM_FI_DEV_MEM_CLOCK GPU Memory clock frequency