Windows_exporter metric_relabel_config

I use Grafana Cloud with windows_exporter integration.
Here is my agent-config.yaml

server:
  http_listen_port: 12345
  #log_level: debug
prometheus:
  wal_directory: C:\ProgramData\grafana-agent-wal
  global:
    scrape_interval: 15s
    remote_write:
    - url: https://prometheus-blocks-prod-us-central1.grafana.net/api/prom/push
      basic_auth:
        username: USERNAME
        password: PASSWORD
  configs:
    - name: integrations
integrations:
  windows_exporter:
    enabled: true
    enabled_collectors: "system"
    relabel_configs:
      - source_labels: ['__name__']
        regex: 'windows_system_system_up_time'
        action: keep

Please help to drop some metrics. I need to keep only one metric with name ‘windows_system_system_up_time’ - all other metrics need to be droped.

You’re almost there @oriondvd5.

First, it should be metric_relabel_configs rather than relabel_configs. Also, your values need not be in single quotes.

With a (partial) config that looks like this, I was able to achieve the desired result.

  windows_exporter:
    enabled: true
    metric_relabel_configs:
      - source_labels: [__name__]
        regex: windows_system_system_up_time
        action: keep
1 Like