2

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

Diptangsu Goswami
  • 5,554
  • 3
  • 25
  • 36

1 Answers1

0

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.

Michael Doubez
  • 5,937
  • 25
  • 39
  • That's unfortunate, but thank you because I can now stop spending time on this. – Diptangsu Goswami Sep 05 '22 at 18:30
  • 2
    `file_sd_configs` is rather intended as a generic interface to external service discovery. It is not a way to extend the configuration file. There is a features to allow better config split: see https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1559. Now it all depends on your setup. – Michael Doubez Sep 05 '22 at 18:46
  • thank you, unfortunately I don't have control over the main config file, another team handles it. There are other ways to solve my problem, this was one of them but no problem if it's a dead end. – Diptangsu Goswami Sep 06 '22 at 08:12