匿名
未登录
登录
Linux78|wiki
搜索
查看“Prometheus 监控插件mysqld exporter”的源代码
来自Linux78|wiki
名字空间
页面
讨论
更多
更多
页面选项
查看
查看源代码
历史
←
Prometheus 监控插件mysqld exporter
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
wiki:用户|用户
您可以查看与复制此页面的源代码。
== 要增加授权 == mysql> GRANT PROCESS, REPLICATION CLIENT, SELECT ON *.* TO 'exporter'@'localhost' IDENTIFIED BY 'exporter123' WITH MAX_USER_CONNECTIONS 3; mysql> flush privileges; == 安装mysqld_exporter == wget https://github.com/prometheus/mysqld_exporter/releases/download/v0.12.1/mysqld_exporter-0.12.1.linux-amd64.tar.gz tar xzvf mysqld_exporter-0.12.1.linux-amd64.tar.gz mv mysqld_exporter-0.12.1.linux-amd64.tar.gz mysqld_exporter chown -R root:root /usr/local/prometheus/mysqld_exporter/mysqld_exporter chmod 755 /usr/local/prometheus/mysqld_exporter/mysqld_exporter == 修改启动参数 == 启动参数参考 https://github.com/prometheus/mysqld_exporter vim /usr/lib/systemd/system/mysqld_exporter.service [Unit] Description=mysqld_exporter After=network.target [Service] Type=simple User=mysql Environment=DATA_SOURCE_NAME=exporter:exporter123@(localhost:3306)/ ExecStart=/usr/local/prometheus/mysqld_exporter/mysqld_exporter --web.listen-address=0.0.0.0:9104 --config.my-cnf /etc/my.cnf \ --collect.slave_status \ --collect.slave_hosts \ --log.level=error \ --collect.info_schema.processlist \ --collect.info_schema.innodb_metrics \ --collect.info_schema.innodb_tablespaces \ --collect.info_schema.innodb_cmp \ --collect.info_schema.innodb_cmpmem Restart=on-failure [Install] WantedBy=multi-user.targe [Unit] Description=mysqld_exporter [Service] Type=simple Restart=on-failure ExecStart=/usr/local/mysqld_exporter/mysqld_exporter --config.my-cnf=/usr/local/mysqld_exporter/my.cnf [Install] WantedBy=multi-user.target == 启动exporter == chown -R root:root /usr/lib/systemd/system/mysqld_exporter.service chmod 644 /usr/lib/systemd/system/mysqld_exporter.service systemctl daemon-reload systemctl enable mysqld_exporter.service systemctl start mysqld_exporter.service 访问localhost:9104/metrics可以看到mysql的指标 == 修改prometheus配置文件 == scrape_configs下面添加 vim /usr/local/prometheus/prometheus.yml scrape_configs: - job_name: 'mysql' static_configs: - targets: ['localhost:9104'] == 设置报警规则 == 可参考示例:https://github.com/prometheus/mysqld_exporter/blob/master/example.rules groups: - name: GaleraAlerts rules: - alert: MySQLReplicationNotRunning expr: mysql_slave_status_slave_io_running == 0 or mysql_slave_status_slave_sql_running == 0 for: 2m labels: severity: critical annotations: description: Slave replication (IO or SQL) has been down for more than 2 minutes. summary: Slave replication is not running
返回至
Prometheus 监控插件mysqld exporter
。
导航
导航
首页
最近更改
随机页面
栏目
Nginx
Kubernetes
Spring Cloud
Wiki工具
Wiki工具
特殊页面
页面工具
页面工具
用户页面工具
更多
链入页面
相关更改
页面信息
页面日志