windows上prometheus+Grafana監控mysql8.0狀態

第一步:mysql

由於mysql_exporter須要鏈接到mysql,因此須要建立mysql用戶監控mysql數據庫,並賦權限git

create user 'exporter'@'localhost' identified by '123456';
 GRANT REPLICATION CLIENT, PROCESS ON *.* TO 'exporter'@'localhost';
 GRANT SELECT ON performance_schema.* TO 'exporter'@'localhost';
 ALTER USER exporter@localhost IDENTIFIED WITH mysql_native_password BY '123456';
 flush privileges;

 

第二步:github

1.下載sql_exporter,地址:https://github.com/prometheus/mysqld_exporter/releases/download/v0.11.0/mysqld_exporter-0.11.0.windows-amd64.tar.gzsql

2.mysqld_exporter-0.11.0.windows-amd64下建立.my.cnf文件,內容以下:數據庫

[client]
user=exporter
password=123456

3.啓動mysqld_exporter.exe --config.my-cnf=「xxx/mysqld_exporter-0.11.0.windows-amd64/.my.cnf」windows

4.http://localhost:9104/metrics測試是否能正常訪問,顯示監控數據,以下圖ide

 

第三步:測試

配置prometheus文件,修改prometheus.yml配置以下,啓動prometheus.exe,查看targets狀態正常,以下圖code

- job_name: 'mysql'
    static_configs:
    - targets: ['localhost:9104']
      labels:
        instance: datav

 

第四步:orm

經過Grafana的**+**圖標導入(Import) MySQL Overview dashboard:

1.Grafana id= 7362

2.注意選中數據源

 

第五步:

測試驗證是否集成成功,打開dashboard,查看數據是否正常,以下圖所示

相關文章
相關標籤/搜索