service-prometheus: update config to export metrics via nginx
This commit is contained in:
parent
8f495b79c8
commit
a6faeb0ff6
2 changed files with 16 additions and 7 deletions
|
@ -23,19 +23,15 @@ scrape_configs:
|
||||||
scrape_interval: 10s
|
scrape_interval: 10s
|
||||||
scrape_timeout: 10s
|
scrape_timeout: 10s
|
||||||
static_configs:
|
static_configs:
|
||||||
- targets: ['localhost:9090', 'localhost:9100']
|
- targets: ['localhost:9090']
|
||||||
|
|
||||||
- job_name: "node"
|
- job_name: "node"
|
||||||
file_sd_configs:
|
scheme: "https"
|
||||||
- files:
|
|
||||||
- '{{ prometheus_file_sd_config_path }}/*.json'
|
|
||||||
- '{{ prometheus_file_sd_config_path }}/*.yml'
|
|
||||||
- '{{ prometheus_file_sd_config_path }}/*.yaml'
|
|
||||||
static_configs:
|
static_configs:
|
||||||
{%for group in prometheus_groups %}
|
{%for group in prometheus_groups %}
|
||||||
- targets:
|
- targets:
|
||||||
{% for host in groups[group] %}
|
{% for host in groups[group] %}
|
||||||
- '{{ host }}:9100'
|
- '{{ host }}'
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
labels:
|
labels:
|
||||||
group: '{{ group }}'
|
group: '{{ group }}'
|
||||||
|
|
|
@ -35,4 +35,17 @@ server {
|
||||||
autoindex on;
|
autoindex on;
|
||||||
autoindex_exact_size off;
|
autoindex_exact_size off;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
location ^~ /metrics {
|
||||||
|
set $metric_addr 127.0.0.1;
|
||||||
|
proxy_pass http://$metric_addr:9100/metrics;
|
||||||
|
|
||||||
|
allow 127.0.0.0/8;
|
||||||
|
allow ::1/128;
|
||||||
|
{% for host in groups['ffmwu-monitoring'] %}
|
||||||
|
allow {{ lookup('dig', host, 'qtype=A') }};
|
||||||
|
allow {{ lookup('dig', host, 'qtype=AAAA') }};
|
||||||
|
deny all;
|
||||||
|
{% endfor %}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue