prometheusconfigmonitoringmetricsvictoriametrics

Filter input metrics in vmagent (prometheus)


I have vmagent with 1 target. It`s scrape 4k+ samples, but i need about 20. How can I filter unnecessary metrics so as not to store from?

I tried to use this design, but it did not work:

global:
  scrape_interval: 60s
  scrape_timeout: 60s
  external_labels:
    server_name: vmagent

scrape_configs:
  - job_name: "kafka_exporter"
    file_sd_configs:
    - files:
      - kafka_exporter.yml
    params:
      match[]:
        - '{__name__=~"kafka_topic_partitions"}'

Solution

  • Thanks, @hagen1778 https://docs.victoriametrics.com/relabeling/#how-to-drop-metrics-during-scrape Drop and keep is the way.

    But I have a problem: extra metrics are keep. Ask one more question about it: my other question about it p.s. drop, keep, and add label has same problem.