Skip to content

Instantly share code, notes, and snippets.

@Jivvon
Created February 7, 2022 16:30
Show Gist options
  • Save Jivvon/3476ad68540f0d6201f260ccd386c1bc to your computer and use it in GitHub Desktop.
Save Jivvon/3476ad68540f0d6201f260ccd386c1bc to your computer and use it in GitHub Desktop.
scrape configs for dcgm exporter in prometheus
prometheus:
extraScrapeConfigs: |
- job_name: gpu-metrics
kubernetes_sd_configs:
- role: endpoints
relabel_configs:
- action: keep
regex: dcgm-exporter;monitoring
source_labels:
- __meta_kubernetes_pod_label_app_kubernetes_io_name
- __meta_kubernetes_namespace
- action: replace
regex: (.+)
source_labels:
- __meta_kubernetes_service_annotation_prometheus_io_path
target_label: __metrics_path__
- action: replace
regex: ([^:]+)(?::\d+)?;(\d+)
replacement: $1:$2
source_labels:
- __address__
- __meta_kubernetes_service_annotation_prometheus_io_port
target_label: __address__
- action: labelmap
regex: __meta_kubernetes_service_label_(.+)
- action: replace
source_labels:
- __meta_kubernetes_namespace
target_label: kubernetes_namespace
- action: replace
source_labels:
- __meta_kubernetes_service_name
target_label: kubernetes_name
- action: replace
source_labels:
- __meta_kubernetes_pod_node_name
target_label: kubernetes_node
scrape_interval: 1s
...
@Jivvon
Copy link
Author

Jivvon commented Feb 7, 2022

Pod's info
label: app.kubernetes.io/name=dcgm-exporter
namespace: monitoring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment