基於Prometheus和Grafana的監控平臺 - MySQL監控

以前咱們講了使用Prometheus監控服務器狀態,今天咱們使用Prometheus監控下數據庫。node

安裝配置

  • mysqld_exporter 下載好mysql的exporter,上傳至服務器。mysql

  • 修改exporter配置
    在root目錄下創建文件 .my.cnf,輸入mysql的訪問參數linux

[client]
host = 192.168.249.129
user = root
password = 000000

使用以下shell命令進行安裝並啓動git

tar zxvf mysqld_exporter-0.12.1.linux-amd64.tar.gz
mv node_exporter-0.18.1.linux-amd64 mysqld_exporter
nohup ./mysqld_exporter --web.listen-address=":9200" &

啓動完成後,用瀏覽器打開http://192.168.249.129:9200/進行訪問,顯示效果以下:
github

  • 修改prometheus配置
    在prometheusscrape_configs中加入mysql的監聽地址
- job_name: 'mysql29'
    static_configs:
    - targets: ['192.168.249.129:9200']

監控報表

  • 從grafana官網上查找Mysql的監控dashboard MySQL_Overview並將其導入grafana。
    web

  • 查看監控效果

    sql

請關注我的公衆號:JAVA日知錄shell

avatar

相關文章
相關標籤/搜索