一、安裝准備
1.下載prometheus和grafana,以及監控插件
prometheus官網地址:https://prometheus.io/download/
grafana官網地址:https://grafana.com/grafana/download
prometheus github地址: https://github.com/prometheus
windows系統監控exporter
windows_exporter 地址:https://github.com/prometheus-community/windows_exporter/tags
linux系統監控exporter
node_exporter 地址:https://github.com/prometheus/node_exporter/releases
mysql系統監控exporter
mysql_exporter 地址:https://github.com/prometheus/mysqld_exporter/releases/tag/v0.12.1
二、配置運行
1.配置運行prometheus
1.1打開prometheus.yml文件,把所需要監控的服務器或者數據庫寫入配置文件中

scrape_configs:
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
- job_name: 'windows'
# metrics_path defaults to '/metrics'
# scheme defaults to 'http'.
static_configs:
- targets: ['localhost:9182']
- job_name: 'mysql'
static_configs:
- targets: ['localhost:3306']
1.2啟動windows_exporter和mysql_exporter
1.3點擊prometheus.exe運行promethus

默認訪問地址為http://localhost:9090 出現如下界面即為prometheus安裝成功、數據采集器驗證成功 (PS: up為成功,down 為不成功。)

1.4訪問http://127.0.0.1:9182/metrics就可以看到監控的數據信息,這樣的數據顯然很難進行數據分析,所以我們需要安裝grafana進行進行圖表化

2.grafana配置啟動
2.1點擊grafana-server.exe運行grafana,默認訪問地址為http://localhost:3000

2.2在grnfana添加數據源和Dashboards模




如果需要換其他的dashboards,可以去這個網站查找
dashboards網址:https://grafana.com/grafana/dashboards
