node_exporter、mysql_exporter、redis_exporter使用

  • node_exporter,監(jiān)聽在指定端口
nohup ./node_exporter --web.listen-address=":9200" &> /dev/null &
  • redis_exporter,監(jiān)聽指定的redis地址、端口、密碼
nohup ./redis_exporter -redis.addr "redis://192.168.244.133:6379" -redis.password "123456" -web.listen-address :9300 &> /dev/null &
  • mysql_exporter,請參見配置

    1. 安裝mysqld_exporter
    wget https://github.com/prometheus/mysqld_exporter/releases/download/v0.12.1/mysqld_exporter-0.12.1.darwin-amd64.tar.gz
    tar -zxvf mysqld_exporter-0.12.1.linux-amd64.tar.gz
    mv mysqld_exporter-0.12.1.linux-amd64 mysqld_exporter
    
    1. 進入mysql創(chuàng)建exporter用戶并授權(quán)
    CREATE USER 'exporter'@'%' IDENTIFIED BY '123456' WITH MAX_USER_CONNECTIONS 3;
    GRANT ALL PRIVILEGES ON *.* TO 'exporter'@'%' IDENTIFIED BY '123456';
    flush privileges;
    
    1. 在和mysqld_exporter文件同級的文件夾中創(chuàng)建my.cnf文件,文件內(nèi)容如下
    • vim my.cnf
    [client]
    user=exporter
    password=123456
    
    1. 創(chuàng)建mysqld_exporter啟動腳本vim /usr/lib/systemd/system/mysqld_exporter.service
    [Unit]
    Description=mysqld_exporter
    Documentation=https://prometheus.io
    Wants=network-online.target
    After=network.target
    [Service]
    Type=simple
    User=root
    ExecStart=/datadrive/software/mysqld_exporter/mysqld_exporter --config.my-cnf=/datadrive/software/mysqld_exporter/my.cnf
    Restart=on-failure
    [Install]
    WantedBy=multi-user.target
    

    (根據(jù)實際目錄位置改變其中的ExecStart選項內(nèi)容)

    1. 相關(guān)命令
    systemctl daemon-reload
    systemctl start mysqld_exporter
    systemctl stop mysqld_exporter
    systemctl status mysqld_exporter
    
    1. 測試
    curl localhost:9104/metrics
    
    mysql_exporter
  • 附prometheus相關(guān)下載地址

    1. prometheus、node_exporter、mysqld_exporter下載地址
    2. redis_exporter下載地址
  • 結(jié)合grafana、prometheus使用,相關(guān)儀表板id獲取如下:
    node_exporter:1860、mysql_exporter:7362、redis_exporter:12776

  • redis_exporter加入系統(tǒng)服務(wù)

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容