美文网首页
node_exporter、mysql_exporter、red

node_exporter、mysql_exporter、red

作者: 木火应 | 来源:发表于2022-07-21 20:42 被阅读0次
    • node_exporter,监听在指定端口
    nohup ./node_exporter --web.listen-address=":9200" &> /dev/null &
    
    • redis_exporter,监听指定的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创建exporter用户并授权
      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文件同级的文件夹中创建my.cnf文件,文件内容如下
      • vim my.cnf
      [client]
      user=exporter
      password=123456
      
      1. 创建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
      

      (根据实际目录位置改变其中的ExecStart选项内容)

      1. 相关命令
      systemctl daemon-reload
      systemctl start mysqld_exporter
      systemctl stop mysqld_exporter
      systemctl status mysqld_exporter
      
      1. 测试
      curl localhost:9104/metrics
      
      mysql_exporter
    • 附prometheus相关下载地址

      1. prometheus、node_exporter、mysqld_exporter下载地址
      2. redis_exporter下载地址
    • 结合grafana、prometheus使用,相关仪表板id获取如下:
      node_exporter:1860、mysql_exporter:7362、redis_exporter:12776

    相关文章

      网友评论

          本文标题:node_exporter、mysql_exporter、red

          本文链接:https://www.haomeiwen.com/subject/vtkpirtx.html