Include multiple configuration files (scrape_configs in different files)

2662 views
Skip to first unread message

lerh...@gmail.com

unread,
Oct 6, 2017, 12:48:00 AM10/6/17
to Prometheus Users
Hello all, 

This may sound like a stupid question but I haven't had much luck googling it. I'm wondering if there is an existing way to include multiple files in Prometheus. This is to help me with a few things: 

i) Make it more organizable instead of have everything in a single file. So I could have a scrape_config in one ec2.yaml, another scrape_config in k8s.yaml, and in my main prometheus.yaml I can just state that it includes both YAMLs. My Prometheus would then scrape both targets defined in both files. Currently it seems possible only with rule_files, which does not accept a prometheus config (it only accepts rules). 

ii) I currently am experimenting with Tectonic and would like to be able to drop rule files in set places to use with the Prometheus Operator resource. There's an existing config reloader image that is able to reload prometheus, but the trigger seems to be based only if there are rule file changes (the main prometheus.yaml is configured automatically by Tectonic). So if I added in a test.rules file, it will add it to the YAML, but I am unable to specify scrape_configs in that rule file because it will complain: unexpected <op:-> in record statement, expected "="

Anyone have any suggestions? 

Thanks! 

Ben Kochie

unread,
Oct 6, 2017, 3:37:36 AM10/6/17
to lerh...@gmail.com, Prometheus Users
Only one configuration file is supported, in order to reduce the complexity of the configuration loader.  Handling configuration is a job for configuration management software.

--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-users+unsubscribe@googlegroups.com.
To post to this group, send email to prometheus-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/e0106126-4fc0-42aa-824d-d5a0eef9d42f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

lerh...@gmail.com

unread,
Oct 8, 2017, 7:15:48 PM10/8/17
to Prometheus Users
I see, thanks for confirming. 


On Friday, October 6, 2017 at 6:37:36 PM UTC+11, Ben Kochie wrote:
Only one configuration file is supported, in order to reduce the complexity of the configuration loader.  Handling configuration is a job for configuration management software.
On Fri, Oct 6, 2017 at 6:48 AM, <lerh...@gmail.com> wrote:
Hello all, 

This may sound like a stupid question but I haven't had much luck googling it. I'm wondering if there is an existing way to include multiple files in Prometheus. This is to help me with a few things: 

i) Make it more organizable instead of have everything in a single file. So I could have a scrape_config in one ec2.yaml, another scrape_config in k8s.yaml, and in my main prometheus.yaml I can just state that it includes both YAMLs. My Prometheus would then scrape both targets defined in both files. Currently it seems possible only with rule_files, which does not accept a prometheus config (it only accepts rules). 

ii) I currently am experimenting with Tectonic and would like to be able to drop rule files in set places to use with the Prometheus Operator resource. There's an existing config reloader image that is able to reload prometheus, but the trigger seems to be based only if there are rule file changes (the main prometheus.yaml is configured automatically by Tectonic). So if I added in a test.rules file, it will add it to the YAML, but I am unable to specify scrape_configs in that rule file because it will complain: unexpected <op:-> in record statement, expected "="

Anyone have any suggestions? 

Thanks! 

--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
To post to this group, send email to promethe...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages