service-prometheus: update config to export metrics via nginx

This commit is contained in:
Julian Labus 2018-09-11 13:49:03 +02:00
parent 8f495b79c8
commit a6faeb0ff6
No known key found for this signature in database
GPG key ID: 8AF209F2C6B3572A
2 changed files with 16 additions and 7 deletions

View file

@ -23,19 +23,15 @@ scrape_configs:
scrape_interval: 10s
scrape_timeout: 10s
static_configs:
- targets: ['localhost:9090', 'localhost:9100']
- targets: ['localhost:9090']
- job_name: "node"
file_sd_configs:
- files:
- '{{ prometheus_file_sd_config_path }}/*.json'
- '{{ prometheus_file_sd_config_path }}/*.yml'
- '{{ prometheus_file_sd_config_path }}/*.yaml'
scheme: "https"
static_configs:
{%for group in prometheus_groups %}
- targets:
{% for host in groups[group] %}
- '{{ host }}:9100'
- '{{ host }}'
{% endfor %}
labels:
group: '{{ group }}'

View file

@ -35,4 +35,17 @@ server {
autoindex on;
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 %}
}
}