This repository has been archived by the owner on Jun 24, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 274
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Support multiple monitor nodes
- Loading branch information
Showing
6 changed files
with
63 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,20 @@ | ||
{% set metric_host = hostvars[groups.monitoring_servers[0]].ansible_host | default(hostvars[groups.monitoring_servers[0]].inventory_hostname) if groups.monitoring_servers else "" -%} | ||
{% set metric_port = hostvars[groups.monitoring_servers[0]].prometheus_port if groups.monitoring_servers else ''-%} | ||
{% if groups.monitoring_servers | length == groups.grafana_servers | length -%} | ||
{% set index = [] -%} | ||
{% for host in groups.monitoring_servers -%} | ||
{% if inventory_hostname == hostvars[host].inventory_hostname -%} | ||
{% set _ = index.append(loop.index0) -%} | ||
{% endif -%} | ||
{% endfor -%} | ||
{% set metric_host = hostvars[groups.monitoring_servers[index.0]].ansible_host | default(hostvars[groups.monitoring_servers[index.0]].inventory_hostname) -%} | ||
{% set metric_port = hostvars[groups.monitoring_servers[index.0]].prometheus_port -%} | ||
{% else -%} | ||
{% set metric_host = hostvars[groups.monitoring_servers[0]].ansible_host | default(hostvars[groups.monitoring_servers[0]].inventory_hostname) -%} | ||
{% set metric_port = hostvars[groups.monitoring_servers[0]].prometheus_port -%} | ||
{% endif -%} | ||
{ | ||
"name":"{{ cluster_name }}", | ||
"type":"prometheus", | ||
"access":"proxy", | ||
"url":"http://{{ metric_host }}:{{ metric_port }}/", | ||
"basicAuth":false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters