Skip to content
This repository has been archived by the owner on Jun 24, 2021. It is now read-only.

Commit

Permalink
add tiflash conf in prometheus for tiflash dashboard (#1146)
Browse files Browse the repository at this point in the history
* add tiflash conf in prometheus for tiflash dashboard
  • Loading branch information
liubo0127 authored Feb 18, 2020
1 parent 23822f0 commit 112915b
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions roles/prometheus/templates/prometheus.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,18 @@ alerting:
{% set _ = tikv_status_addrs.append("%s:%s" % (tikv_ip, tikv_status_port)) -%}
{% endfor -%}

{% set tiflash_metrics_addrs = [] -%}
{% set tiflash_http_addrs = [] -%}
{% for host in groups.tiflash_servers -%}
{% set tiflash_ip = hostvars[host].ansible_host | default(hostvars[host].inventory_hostname) -%}
{% set tiflash_metrics_port = hostvars[host].metrics_port -%}
{% set tiflash_proxy_status_port = hostvars[host].flash_proxy_status_port -%}
{% set tiflash_http_port = hostvars[host].http_port -%}
{% set _ = tiflash_metrics_addrs.append("%s:%s" % (tiflash_ip, tiflash_metrics_port)) -%}
{% set _ = tiflash_metrics_addrs.append("%s:%s" % (tiflash_ip, tiflash_proxy_status_port)) -%}
{% set _ = tiflash_http_addrs.append("%s:%s" % (tiflash_ip, tiflash_http_port)) -%}
{% endfor -%}

{% set pd_addrs = [] -%}
{% for host in groups.pd_servers -%}
{% set pd_ip = hostvars[host].ansible_host | default(hostvars[host].inventory_hostname) -%}
Expand Down Expand Up @@ -177,6 +189,16 @@ scrape_configs:
- '{{ tikv_status_addr }}'
{% endfor %}

{% if tiflash_metrics_addrs %}
- job_name: 'tiflash'
honor_labels: true # don't overwrite job & instance labels
static_configs:
- targets:
{% for tiflash_metrics_addr in tiflash_metrics_addrs %}
- '{{ tiflash_metrics_addr }}'
{% endfor %}
{% endif %}

- job_name: "pd"
honor_labels: true # don't overwrite job & instance labels
static_configs:
Expand Down Expand Up @@ -293,6 +315,12 @@ scrape_configs:
labels:
group: 'tikv'
- targets:
{% for tiflash_http_addr in tiflash_http_addrs %}
- '{{ tiflash_http_addr }}'
{% endfor %}
labels:
group: 'tiflash'
- targets:
{% for pd_addr in pd_addrs %}
- '{{ pd_addr }}'
{% endfor %}
Expand Down

0 comments on commit 112915b

Please sign in to comment.