prometheusvictoriametrics

How to add `metric_relabel_configs` from a separate file via `file_sd_configs`?


I have a vmagent configuration where I can only add extra configuration options via separate files.

prom.yml

Let's take this file to be static, as in I can not modify this file.

I can only add my own configuration in file.yml which looks like this.

file.yml

This configuration does not work, removing metric_relabel_configs makes the configuration work. How can I add metric_relabel_configs from a file config?

This is the error I get.

promtool check config error


Solution

  • From what you described, you basically cannot.

    metric_relabel_config is defined at the job level as documented in scrape_config section of Prometheus ; and VictoriaMetrics documents the same behavior.

    So you have to have access to the scrape configuration.

    It looks like a odd constraint as headers, scheme and metrics_path are very common configuration points.