Merge "Allow to configure relabeling for alerts"
diff --git a/prometheus/files/grafana_dashboards/pushgateway_prometheus.json b/prometheus/files/grafana_dashboards/pushgateway_prometheus.json
index e1e341c..83c4b09 100644
--- a/prometheus/files/grafana_dashboards/pushgateway_prometheus.json
+++ b/prometheus/files/grafana_dashboards/pushgateway_prometheus.json
@@ -136,7 +136,7 @@
"steppedLine": false,
"targets": [
{
- "expr": "rate(http_requests_total{handler=\"push\",job=\"pushgateway\",instance=~\"$Pushgateway:[1-9][0-9]*\"}[10m])",
+ "expr": "rate(http_requests_total{job=\"pushgateway\",instance=~\"$Pushgateway:[1-9][0-9]*\"}[10m])",
"format": "time_series",
"hide": false,
"intervalFactor": 2,
@@ -145,7 +145,7 @@
"step": 4
},
{
- "expr": "rate(http_requests_total{handler=\"push\",job=\"pushgateway\",instance=~\"$Pushgateway:[1-9][0-9]*\"}[1h])",
+ "expr": "rate(http_requests_total{job=\"pushgateway\",instance=~\"$Pushgateway:[1-9][0-9]*\"}[1h])",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "1h rate",
@@ -153,7 +153,7 @@
"step": 4
},
{
- "expr": "rate(http_requests_total{handler=\"push\",job=\"pushgateway\",instance=~\"$Pushgateway:[1-9][0-9]*\"}[6h])",
+ "expr": "rate(http_requests_total{job=\"pushgateway\",instance=~\"$Pushgateway:[1-9][0-9]*\"}[6h])",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "6h rate",
diff --git a/prometheus/files/server/prometheus.yml b/prometheus/files/server/prometheus.yml
index 53c7b0c..6a2ddf1 100644
--- a/prometheus/files/server/prometheus.yml
+++ b/prometheus/files/server/prometheus.yml
@@ -340,15 +340,31 @@
{%- endif %}
{%- endif %}
-{%- if server.get('target', {}).get('dns', {}).get('enabled', False) %}
- {%- for target in server.get('target', {}).get('dns', {}).get('endpoint', []) %}
- - job_name: {{ target.name }}
- dns_sd_configs:
- - names:
- {%- for domain in target.domain %}
- - {{ domain }}
- {%- endfor %}
- type: {{ target.type }}
- port: {{ target.port }}
+{%- set dns_endpoints = {} %}
+{%- if server.get('use_grains', {}).get('target', True) %}
+ {%- for node_name, node_grains in salt['mine.get']('*', 'grains.items').iteritems() %}
+ {%- set dns_grain = node_grains.get('prometheus', {}).get('server', {}).get('target', {}).get('dns', {}) %}
+ {%- if dns_grain.get('enabled', False) %}
+ {%- for endpoint in dns_grain.get('endpoint', []) %}
+ {%- do dns_endpoints.update({endpoint.name: endpoint}) %}
+ {%- endfor %}
+ {%- endif %}
{%- endfor %}
{%- endif %}
+
+{%- if server.get('target', {}).get('dns', {}).get('enabled', False) %}
+ {%- for endpoint in server.get('target', {}).get('dns', {}).get('endpoint', []) %}
+ {%- do dns_endpoints.update({endpoint.name: endpoint}) %}
+ {%- endfor %}
+{%- endif %}
+
+{%- for name, endpoint in dns_endpoints | dictsort %}
+ - job_name: {{ endpoint.name }}
+ dns_sd_configs:
+ - names:
+ {%- for domain in endpoint.domain %}
+ - {{ domain }}
+ {%- endfor %}
+ type: {{ endpoint.type }}
+ port: {{ endpoint.port }}
+{%- endfor %}