Prometheus 监控Mysql服务器及Grafana可视化
Prometheus 监控Mysql服务器及Grafana可视化、
mysql_exporter:用于收集MySQL性能信息。
- 使用版本
- mysqld_exporter 0.11.0
- 官方地址
- 使用文档:https://github.com/prometheus/mysqld_exporter
- 图标模板:https://grafana.com/dashboards/7362
- 下载地址:https://github.com/prometheus/mysqld_exporter/releases/download/v0.12.1/mysqld_exporter-0.12.1.linux-amd64.tar.gz
- 百度云:mysqld_exporter 0.11.0
- 下载地址:https://pan.baidu.com/s/1JfjbK3uOMXObc7-F8h13Dw
- 密码:dxsn
注:要求数据库mysql 5.5 以上版本。
安装mysql_exporter
1、下载到被监控端解压压缩包
tar zxvf mysqld_exporter-0.11.0.linux-amd64.tar.gz
2、改名并移动到指定目录
mv mysqld_exporter-0.11.0.linux-amd64 /usr/local/mysql_exporter
cd /usr/local/mysql_exporter
3、登录mysql为exporter创建账号并授权
# 创建数据库用户。
mysql> CREATE USER 'exporter'@'localhost' IDENTIFIED BY 'XXXXXXXX';
# 可查看主从运行情况查看线程,及所有数据库。
mysql> GRANT PROCESS, REPLICATION CLIENT, SELECT ON *.* TO 'exporter'@'localhost';
4、创建mysql配置文件、运行时可免密码连接数据库:vim /usr/local/mysql_exporter/.my.cnf
[client]
user=exporter
password=xiangsikai
5、启动exporter客户端
./mysqld_exporter --config.my-cnf=.my.cnf
常用参数:
# 选择采集innodb
--collect.info_schema.innodb_cmp
# innodb存储引擎状态
--collect.engine_innodb_status
# 指定配置文件
--config.my-cnf=".my.cnf"
启动常用参数
6、添加系统服务:vi /usr/lib/systemd/system/mysql_exporter.service
[Unit]
Description=https://prometheus.io [Service]
Restart=on-failureExecStart=/usr/local/mysql_exporter/mysqld_exporter --config.my-cnf=.my.cnf [Install]
WantedBy=multi-user.target
7、启动添加后的系统服务
systemctl daemon-reload
systemctl restart mysql_exporter.service
8、网站查看捕获mysql数据
访问:http://47.98.138.176:9104/metrics

9、使用prometheus监控修改监控端配置文件:vim prometheus.yml
scrape_configs:
# 添加作业并命名
- job_name: 'mysql'
# 静态添加node
static_configs:
# 指定监控端
- targets: ['47.98.138.176:9104']
10、检查并重启服务
./promtool check config prometheus.yml
kill -hup 5997
11、查看监控端是否介入

12、使用promSQL查看mysql监控信息
# 测试查看mysqlglobal状态信息
mysql_global_status_aborted_clients
PromSQL

13、Granfana 导入Mysql 监控图表
- 推荐图标ID:https://grafana.com/dashboards/7362

14、输入导入图标ID等待3秒弹出如下,修改后保存

15、监控展示

Prometheus 监控Mysql服务器及Grafana可视化的更多相关文章
- Prometheus 监控Docker服务器及Granfanna可视化
Prometheus 监控Docker服务器及Granfanna可视化 cAdvisor(Container Advisor)用于收集正在运行的容器资源使用和性能信息. 使用Prometheus监控c ...
- Grafana+Prometheus 监控 MySQL
转自:Grafana+Prometheus 监控 MySQL 架构图 环境 IP 环境 需装软件 192.168.0.237 mysql-5.7.20 node_exporter-0.15.2.lin ...
- 详解 Spotlight on MySQL监控MySQL服务器
前一章详解了Spotlight on Unix 监控Linux服务器 ,今天再来看看Spotlight on MySQL怎么监控MySQL服务器. 注:http://www.cnblogs.com/J ...
- Prometheus 监控linux服务器
Prometheus 监控linux服务器 node_exporter:用于*NIX系统监控,使用Go语言编写的收集器. 使用版本 node_exporter 0.17.0 相关文档 使用文档:htt ...
- Grafana+Prometheus监控mysql性能
#cmd /usr/local 今天讲一下如何监控服务器中的mysql数据库的性能 一.数据库操作 1.mysql启动 #service mysqld start #启动数据库 #service my ...
- 使用 Docker 部署 Grafana + Prometheus 监控 MySQL 数据库
一.背景 在平时开发过程当中需要针对 MySQL 数据库进行监控,这里我们可以使用 Grafana 和 Prometheus 来实现监控功能.Grafana 是一款功能强大的仪表盘面板,支持多种数据源 ...
- 采用prometheus 监控mysql
1. prometheus 是什么 开源的系统监控和报警工具,监控项目的流量.内存量.负载量等实时数据. 它通过直接或短时jobs中介收集监控数据,在本地存储所有收集到的数据,并且通过定义好的rule ...
- Grafan+Prometheus 监控 MySQL
架构图 环境 IP 环境 需装软件 192.168.0.237 mysql-5.7.20 node_exporter-0.15.2.linux-amd64.tar.gz mysqld_exporter ...
- Prometheus 监控MySQL
目录 0.简介 1.mysql_exporter部署 2.mysql报警规则 0.简介 文中主要监控MySQL/MySQL主从信息 版本:mysql-5.7,mysql_exporter-0.12.1 ...
随机推荐
- Scrum冲刺第四篇
一.每日例会 会议照片 成员 昨日已完成的工作 今日计划完成的工作 工作中遇到的困难 陈嘉欣 撰写博客,管理成员提交代码 和队友一同开发音乐控制模块 对音频控制方面知识了解少,功能实现困难 邓镇港 帮 ...
- SQL Server学习内容(一)
SQL Server SQL Server对大小写不敏感,每条语句末端使用分号. 1.SQL命令 SELECT 从数据中提取数据 UPDATE 更新数据中的数据 DELETE 从数据库中删除数据 IN ...
- 《高性能 Go 代码工坊》中译
深入研究 Go 应用性能提升的英语系列文章,这里是中译 https://www.yuque.com/ksco/uiondt
- angular6 表单验证
这里使用的是模型驱动的表单 1.app.module.ts import { ReactiveFormsModule } from '@angular/forms'; @NgModule({ ... ...
- odoo10学习笔记十二:web controller
转载请注明原文地址:https://www.cnblogs.com/ygj0930/p/11189332.html 一:路由 odoo.http.route(route=None, **kw) 装饰器 ...
- Python列表操作与深浅拷贝(6)——列表索引、查询、修改、扩展
列表list定义 L1 = [] L2 = [1,2,'abc'] L3 = list() L4 = list(range(5)) L5 = [1,'abc',True,None,[4,5,'abc' ...
- MongoDB 之pymongodb
import pymongo import json from bson import ObjectId mongoclient = pymongo.MongoClient(host="12 ...
- 201871010124-王生涛《面向对象程序设计(java)》第十四周学习总结
项目 内容 这个作业属于哪个课程 <任课教师博客主页链接>https://www.cnblogs.com/nwnu-daizh/ 这个作业的要求在哪里 <作业链接地址>http ...
- JVM 常用启动参数
JVM 常用启动参数 默认值 -xms -xmx
- day34_8_16 MySQL数据库一
一.数据库概念 在没有数据库时,编写项目都是使用db模拟数据库.将文件以列表或字典等存入文件夹. 但是,不同的程序员存放数据的方式都是各不相同的,而且摆放的位置都是不一样的. 如何同一数据格式,和如何 ...