1.setup prom
https://github.com/prometheus/prometheus/releases/tag/v1.6.2
nohup .
/
prometheus
--
config.
file
=
prometheus.yml &
WEB頁面訪問http://localhost:9090/ ,可以看到Prometheus的graph頁面。
2 熱加載配置
curl -X POST http://localhost:9090/-/reload
3 node exporter / mysql exporter client
https://prometheus.io/download/
mysql 還需要編輯:.my.cnf
[client] host=127.0.0.1 user=fast password=1qaz@WSX
nohup ./node_exporter &
nohup .
/
mysqld_exporter
--
config.my
-
cnf
=
".my.cnf"
&
通過localhost:9104,9100 就可以看到exporter導出的數據了:
4 server vi prometheus.yml
37 - job_name: 'linux' 38 static_configs: 39 - targets: ['192.168.57.67:9100'] 40 labels: 41 instance: db1
31 - job_name: 'mysql' 32 static_configs: 33 - targets: ['192.168.57.67:9104'] 34 labels: 35 instance: db1
重啟prometheus,點擊導航欄中的status->targets可以看到,mysql的exporter已經集成進來了。
https://blog.csdn.net/hfut_wowo/article/details/78536022
5 grafana setup
http://docs.grafana.org/installation/rpm/
1、安裝
1
2
3
|
wget https:
/
/
s3
-
us
-
west
-
2.amazonaws
.com
/
grafana
-
releases
/
release
/
grafana
-
4.2
.
0
-
1.x86_64
.rpm
sudo yum install initscripts fontconfig
-
y
sudo rpm
-
Uvh grafana
-
4.2
.
0
-
1.x86_64
.rpm
|
2、啟動服務service grafana-server start
3、訪問頁面http://localhost:3000 ,默認賬號、密碼admin/admin
6 Prometheus 和 Grafana 的對接
datasource
7 node mysql dashboards
import .json 文件:https://grafana.com/dashboards 挑選喜歡的
https://www.cnblogs.com/shhnwangjian/p/6878199.html
12.11
redis
wget https://github.com/oliver006/redis_exporter/releases/download/v0.15.0/redis_exporter-v0.15.0.linux-amd64.tar.gz
tar -zxvf redis_exporter-v0.15.0.linux-amd64.tar.gz -C /prometheus_exporters --strip-components=1
./redis_exporter
- job_name: redis_exporter static_configs: - targets: ['192.168.0.17:9122']
json模版可以使用763