需求背景:公司已有统一部署的prometheus,该prometheus后端数据库改用了分布式的timescaledb,承载量较大,所以不希望另起一套prometheus。
在已经部署完成的tidb,比较直接的办法:
对接prometheus
配置公司已有的prometheus,增加对tidb的监控,增加内容可以仿照tidb的prometheus的配置,例如:
static_configs:
- targets:
- ‘192.168.17.2’
…
- ‘192.168.17.9’
relabel_configs:
- source_labels: [address]
regex: (.)(:80)?
target_label: __param_target
replacement: ${1}
- source_labels: [__param_target]
regex: (.)
target_label: ping
replacement: ${1}
- source_labels: []
regex: .*
target_label: address
replacement: 192.168.17.10:9115
- job_name: “blackbox_exporter_192.168.17.9:9115_icmp”
scrape_interval: 6s
metrics_path: /probe
params:
module: [icmp]
static_configs:- targets:
- ‘192.168.17.2’
… - ‘192.168.17.9’
relabel_configs: - source_labels: [address]
regex: (.*)(:80)?
target_label: __param_target
replacement: ${1} - source_labels: [__param_target]
regex: (.*)
target_label: ping
replacement: ${1} - source_labels: []
regex: .*
target_label: address
replacement: 192.168.17.9:9115
- ‘192.168.17.2’
- targets:
对接grafana
在公司统一的grafana上,导入tidb的模板,参考:
https://github.com/pingcap/tidb-ansible/tree/master/scripts
停掉tidb自己的grafana和prometheus
2 个赞