File tree 3 files changed +30
-1
lines changed
3 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ packages:
5
5
- prometheus2
6
6
7
7
templates:
8
+ bin/pre-start.erb: bin/pre-start
8
9
bin/prometheus_ctl: bin/prometheus_ctl
9
10
config/prometheus.yml: config/prometheus.yml
10
11
config/custom.rules.yml: config/custom.rules.yml
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ < % if_p(" prometheus.scrape_configs" ) do | scrape_configs| %>
4
+ < % scrape_configs.each do | scrape_config| %>
5
+ < % if scrape_config[' tls_config' ] %>
6
+ < % if scrape_config[' tls_config' ][' cert_contents' ] %>
7
+ mkdir -p $( dirname < %= scrape_config[' tls_config' ][' cert_file' ] %> )
8
+ echo " <%= scrape_config['tls_config']['cert_contents'] %>" > < %= scrape_config[' tls_config' ][' cert_file' ] %>
9
+ < % end %>
10
+ < % if scrape_config[' tls_config' ][' key_contents' ] %>
11
+ mkdir -p $( dirname < %= scrape_config[' tls_config' ][' key_file' ] %> )
12
+ echo " <%= scrape_config['tls_config']['key_contents'] %>" > < %= scrape_config[' tls_config' ][' key_file' ] %>
13
+ < % end %>
14
+ < % if scrape_config[' tls_config' ][' ca_contents' ] %>
15
+ mkdir -p $( dirname < %= scrape_config[' tls_config' ][' ca_file' ] %> )
16
+ echo " <%= scrape_config['tls_config']['ca_contents'] %>" > < %= scrape_config[' tls_config' ][' ca_file' ] %>
17
+ < % end %>
18
+ < % end %>
19
+ < % end %>
20
+ < % end %>
Original file line number Diff line number Diff line change @@ -22,7 +22,15 @@ global:
22
22
rule_files : <%= p('prometheus.rule_files', []).push('/var/vcap/jobs/prometheus2/config/custom.rules.yml').to_json %>
23
23
24
24
# A list of scrape configurations.
25
- scrape_configs : <%= p('prometheus.scrape_configs', []).to_json %>
25
+ <% scrape_configs = p('prometheus.scrape_configs', []).map do |scrape_config|
26
+
27
+ scrape_config = scrape_config.clone
28
+ scrape_config['tls_config'] = scrape_config['tls_config'].clone
29
+ ['ca_contents', 'cert_contents', 'key_contents'].each { |key| scrape_config['tls_config'].delete(key) } if scrape_config['tls_config']
30
+ scrape_config
31
+ end % >
32
+
33
+ scrape_configs : <%= scrape_configs.to_json %>
26
34
27
35
# Alerting specifies settings related to the Alertmanager.
28
36
alerting :
You can’t perform that action at this time.
0 commit comments