Merge "Updating reference from github to gerrit - Changing Maintainer to dev@mirantis.com"
diff --git a/etcd/meta/prometheus.yml b/etcd/meta/prometheus.yml
index 88b5419..d30feef 100644
--- a/etcd/meta/prometheus.yml
+++ b/etcd/meta/prometheus.yml
@@ -1,5 +1,16 @@
{%- from "etcd/map.jinja" import server, monitoring with context %}
+
+{%- set hostname = grains.get('nodename') %}
+{%- set etcd = {} %}
+{%- for member in server.members %}
+ {%- if member.name == hostname %}
+ {%- do etcd.update({'hostname': hostname}) %}
+ {%- do etcd.update({'host': member.host}) %}
+ {%- do etcd.update({'port': member.port}) %}
+ {%- endif %}
+{%- endfor %}
server:
+ {%- if etcd.host is defined and etcd.port is defined and etcd.hostname is defined %}
target:
static:
etcd:
@@ -14,13 +25,14 @@
scheme: http
{%- endif %}
endpoint:
- {%- set hostname = grains.get('nodename') %}
- {%- for member in server.members %}
- {%- if member.name == hostname %}
- - address: {{ member.host }}
- port: {{ member.port }}
- {%- endif %}
- {%- endfor %}
+ - address: {{ etcd.host }}
+ port: {{ etcd.port }}
+ relabel_configs:
+ - regex: {{ etcd.host }}:{{ etcd.port }}
+ replacement: {{ etcd.hostname }}
+ source_labels: "__address__"
+ target_label: "host"
+ {%- endif %}
alert:
EtcdRequestFailureTooHigh:
{%- set failed_http_requests = monitoring.failed_http_requests_percentage / 100.0 %}