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可视化的更多相关文章

  1. Prometheus 监控Docker服务器及Granfanna可视化

    Prometheus 监控Docker服务器及Granfanna可视化 cAdvisor(Container Advisor)用于收集正在运行的容器资源使用和性能信息. 使用Prometheus监控c ...

  2. Grafana+Prometheus 监控 MySQL

    转自:Grafana+Prometheus 监控 MySQL 架构图 环境 IP 环境 需装软件 192.168.0.237 mysql-5.7.20 node_exporter-0.15.2.lin ...

  3. 详解 Spotlight on MySQL监控MySQL服务器

    前一章详解了Spotlight on Unix 监控Linux服务器 ,今天再来看看Spotlight on MySQL怎么监控MySQL服务器. 注:http://www.cnblogs.com/J ...

  4. Prometheus 监控linux服务器

    Prometheus 监控linux服务器 node_exporter:用于*NIX系统监控,使用Go语言编写的收集器. 使用版本 node_exporter 0.17.0 相关文档 使用文档:htt ...

  5. Grafana+Prometheus监控mysql性能

    #cmd /usr/local 今天讲一下如何监控服务器中的mysql数据库的性能 一.数据库操作 1.mysql启动 #service mysqld start #启动数据库 #service my ...

  6. 使用 Docker 部署 Grafana + Prometheus 监控 MySQL 数据库

    一.背景 在平时开发过程当中需要针对 MySQL 数据库进行监控,这里我们可以使用 Grafana 和 Prometheus 来实现监控功能.Grafana 是一款功能强大的仪表盘面板,支持多种数据源 ...

  7. 采用prometheus 监控mysql

    1. prometheus 是什么 开源的系统监控和报警工具,监控项目的流量.内存量.负载量等实时数据. 它通过直接或短时jobs中介收集监控数据,在本地存储所有收集到的数据,并且通过定义好的rule ...

  8. Grafan+Prometheus 监控 MySQL

    架构图 环境 IP 环境 需装软件 192.168.0.237 mysql-5.7.20 node_exporter-0.15.2.linux-amd64.tar.gz mysqld_exporter ...

  9. Prometheus 监控MySQL

    目录 0.简介 1.mysql_exporter部署 2.mysql报警规则 0.简介 文中主要监控MySQL/MySQL主从信息 版本:mysql-5.7,mysql_exporter-0.12.1 ...

随机推荐

  1. JAVA8新特性--集合流操作Stream

    原文链接:https://blog.csdn.net/bluuusea/article/details/79967039 Stream类全路径为:java.util.stream.Stream 对St ...

  2. A dependency may only have one source

    在使用Flutter的时候添加依赖报错了 Error on line 21, column 5 of pubspec.yaml: A dependency may only have one sour ...

  3. 谈谈<? extends T> 和<? super T>理解

    项目中遇到<? extends T> 和<? super T> 这两者,来说说自己的理解.首先我们先了解什么是泛型 什么是泛型 泛型是在编译阶段一种防止错误对象输入的机制.编译 ...

  4. 多个python版本共存时的pip配置

    两种方法来配置pip Func1: 1.1 找到python环境的安装包,将python.exe文件重命名,如:将python2.7版本的python.exe重命名为Python2.exe,将pyth ...

  5. liteos时间管理(九)

    1. 时间管理 1.1 概述 1.1.1 概念 时间管理以系统时钟为基础.时间管理提供给应用程序所有和时间有关的服务. 系统时钟是由定时/计数器产生的输出脉冲触发中断而产生的,一般定义为整数或长整数. ...

  6. linux wake on lan功能通过ethtool配置【转】

    转自:https://blog.csdn.net/fanlilei/article/details/38042063 ethtool工具中的wol功能一直很迷惑.今天看了代码将其帮助中下面的参数说明下 ...

  7. Linux 多线程应用中如何编写安全的信号处理函数【转】

    转自:https://www.cnblogs.com/virusolf/p/4945642.html http://blog.163.com/he_junwei/blog/static/1979376 ...

  8. 001-k8s集群的安装

    k8s集群的安装 1.实验描述 通过搭建 K8S 的集群,来学习对容器的编排 2.实验环境 [你可能需要][CentOS 7 搭建模板机]点我快速打开文章 [你可能需要][VMware 从模板机快速克 ...

  9. django之三剑客、静态文件配置、请求响应对象、数据库操作

    三剑客 from django.shortcuts import render,HttpResponse,redirect HttpResponse # 返回字符串 render(response, ...

  10. BZOJ 4491: 我也不知道题目名字是什么 线段树+离线

    code: #include <string> #include <cstring> #include <cstdio> #include <algorith ...