role service-nginx: only provide location /metrics if node_exporter is availible
This commit is contained in:
parent
c6277df3b7
commit
c4f04df30b
1 changed files with 2 additions and 0 deletions
|
@ -36,6 +36,7 @@ server {
|
||||||
autoindex_exact_size off;
|
autoindex_exact_size off;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{% if node_exporter_present is defined %}
|
||||||
location ^~ /metrics {
|
location ^~ /metrics {
|
||||||
set $metric_addr 127.0.0.1;
|
set $metric_addr 127.0.0.1;
|
||||||
proxy_pass http://$metric_addr:9100/metrics;
|
proxy_pass http://$metric_addr:9100/metrics;
|
||||||
|
@ -47,5 +48,6 @@ server {
|
||||||
allow {{ lookup('dig', host, 'qtype=AAAA') }};
|
allow {{ lookup('dig', host, 'qtype=AAAA') }};
|
||||||
deny all;
|
deny all;
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue