Skip to content

Instantly share code, notes, and snippets.

@siddontang
Last active May 15, 2019 03:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save siddontang/873082cefbfa564d628e2cdfe3a7de17 to your computer and use it in GitHub Desktop.
Save siddontang/873082cefbfa564d628e2cdfe3a7de17 to your computer and use it in GitHub Desktop.

Preparation

Assume you have already deployed PD, TiKV, Prometheus and Grafana.

PD: 127.0.0.1:2379 TiKV: 127.0.0.1:20181, 127.0.0.1:20182, 127.0.0.1:20183 Prometheus: 127.0.0.1:9090 Grafana: 127.0.0.1:3000

Prometheus Config

global:
  scrape_interval:     15s
  evaluation_interval: 15s

scrape_configs:
  - job_name: tikv
    static_configs:
      - targets: ['127.0.0.1:20181', '127.0.0.1:20182', '127.0.0.1:20183']
  - job_name: pd
    static_configs:
      - targets: ['127.0.0.1:2379']

You can access http://127.0.0.1:9090 and type the "up" command to check all PD and TiKV services are up. See https://gist.github.com/siddontang/873082cefbfa564d628e2cdfe3a7de17#gistcomment-2917505

Grafana

  1. Refer to https://grafana.com/docs/features/datasources/prometheus/ to use Prometheus in Grafana.
  2. Choose a Grafana JSON config file from https://github.com/pingcap/tidb-ansible/tree/master/scripts, like:
    wget https://raw.githubusercontent.com/pingcap/tidb-ansible/master/scripts/tikv_details.json
  3. Import the download file to Grafana (see https://gist.github.com/siddontang/873082cefbfa564d628e2cdfe3a7de17#gistcomment-2917506) and enjoy yourself
@siddontang
Copy link
Author

image

@siddontang
Copy link
Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment