Files
chef/site-cookbooks/kosmos_prometheus/templates/default/prometheus.yml.erb
T
raucao 821b56e6ab Set node name as prometheus instance name
And DRY up the recipe so it's easy and expressive to add more
metrics/targets
2026-07-05 12:41:46 +02:00

34 lines
757 B
Plaintext

global:
<% @global_config.each do |k, v| %>
<%= k %>: "<%= v %>"
<% end %>
scrape_configs:
<% @jobs.each do |name, job| %>
- job_name: "<%= name %>"
<% if job['scrape_interval'] %>
scrape_interval: "<%= job['scrape_interval'] %>"
<% end %>
<% if job['scrape_timeout'] %>
scrape_timeout: "<%= job['scrape_timeout'] %>"
<% end %>
metrics_path: "<%= job.fetch('metrics_path', '/metrics') %>"
static_configs:
<% job['targets'].each do |t| %>
- targets:
- <%= t['target'] %>
labels:
instance: <%= t['instance'] %>
<% if t['env'] %>
env: <%= t['env'] %>
<% end %>
<% end %>
<% end %>
<% if @rule_files && !@rule_files.empty? %>
rule_files:
<% @rule_files.each do |filename| %>
- <%= filename %>
<% end %>
<% end %>