创建一个用于mysqld_exporter连接到MySQL的用户并赋予所需的权限

mysql> GRANT REPLICATION CLIENT, PROCESS ON *.* TO 'mysqld_exporter'@'localhost' identified by '';
mysql> GRANT SELECT ON performance_schema.* TO 'mysqld_exporter'@'localhost';
mysql> flush privileges;

创建一个用于连接MySQL的配置文件

mysqld_exporter默认会读取~/.my.cnf文件。这里是创建在mysqld_exporter的安装目录下的。

$ vim /usr/local/prom/mysqld_exporter_0110/.my.cnf

[client]
user=mysqld_exporter
password=

创建Systemd服务

#vim /etc/systemd/system/mysql_exporter.service
[Unit]
Description=mysql_exporter
After=network.target
[Service]
Type=simple
User=prometheus
ExecStart=/usr/local/prom/exporter/mysqld_exporter_0110/mysqld_exporter --config.my-cnf=/usr/local/prom/exporter/mysqld_exporter_0110/.my.cnf
Restart=on-failure
[Install]
WantedBy=multi-user.target

启动mysqld_exporter

# systemctl start mysql_exporter
# systemctl status mysql_exporter

添加prometheus相关配置

# vi prometheus280/prometheus.yml

  - job_name: 'mysql'

    static_configs:
- targets: ['localhost:9104']
labels:
instance: db1

重启prometheus即可

prometheus监控mysql的更多相关文章

  1. Grafana+Prometheus 监控 MySQL

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

  2. Prometheus 监控Mysql服务器及Grafana可视化

    Prometheus 监控Mysql服务器及Grafana可视化. mysql_exporter:用于收集MySQL性能信息. 使用版本 mysqld_exporter 0.11.0 官方地址 使用文 ...

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

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

  4. 采用prometheus 监控mysql

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

  5. Grafana+Prometheus监控mysql性能

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

  6. Prometheus 监控MySQL

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

  7. 手把手教你使用 Prometheus 监控 MySQL 与 MariaDB.md

    概述 MySQL 是常用的关系型数据库,MariaDB 作为 MySQL 的分支版本,兼容 MySQL 协议,也越来越流行.在 Kubernetes 环境中如何使用 Prometheus 来对它们进行 ...

  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监控SpringBoot应用

    通过之前的文章我们使用Prometheus监控了应用服务器node_exporter,数据库mysqld_exporter,今天我们来监控一下你的应用.(本文以SpringBoot 2.1.9.REL ...

随机推荐

  1. shiro之IniRealm

    Shiro认证过程 创建SecurityManager--->主体提交认证--->SecurityManager认证--->Authenticsto认证--->Realm验证 ...

  2. c语言程序设计案例教程(第2版)笔记(二)—函数、递归

    零散知识点 模块化:将一个问题分解成若干个子问题的过程成为模块化. 模块化的优点:不但可以将一个复杂的问题分解成几个相对简单的问题:还可以提高程序代码的重用性. 函数:函数是构成C程序的基本单位.函数 ...

  3. 题解报告:hdu 1421 搬寝室(递推dp)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1421 Problem Description 搬寝室是很累的,xhd深有体会.时间追述2006年7月9 ...

  4. jQuery 常见面试题

    一 :Q: What is the difference between .get(), [], and .eq()? A: eq返回原生jQuery对象,截取某些el元素生成Jquery新对象 ge ...

  5. F 点与多边形 数学 + 观察

    https://biancheng.love/contest-ng/index.html#/123/problems 做题要在纸上弄弄,才会有发现. 发现到答案只是-1和4,因为坐标都是整数. 然后就 ...

  6. AJPFX:如何保证对象唯一性呢?

    思想: 1,不让其他程序创建该类对象. 2,在本类中创建一个本类对象. 3,对外提供方法,让其他程序获取这个对象. 步骤: 1,因为创建对象都需要构造函数初始化,只要将本类中的构造函数私有化,其他程序 ...

  7. [BZOJ1257][CQOI2007]余数之和sum 数学+分块

    题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=1257 题目所求为$$Ans=\sum_{i=1}^nk%i$$ 将其简单变形一下$$Ans ...

  8. vue 数组和对象的双向绑定不响应问题

    对象和数组的数据类型是对象,对象是对象这个是毫无疑问的.数组可以把索引当成键名,把索引对应的元素当成该键名的键值. vue对象有些操作不能双向绑定的原因是vue未改变原对象,以及未给新增属性增加set ...

  9. 常用linux命令大全 转载自:https://www.cnblogs.com/laov/p/3541414.html(大牛笔记)

    Linux简介及Ubuntu安装 Linux,免费开源,多用户多任务系统.基于Linux有多个版本的衍生.RedHat.Ubuntu.Debian 安装VMware或VirtualBox虚拟机.具体安 ...

  10. Sqlmap脱库之“你的数据我所见”

    废话不多说,介绍和理论啥的网上一搜一大把,一次只为tuoku. 实战操作: 1.在网上找个index.php?id=1的站点 2.很明显看到了脱下裤子的希望,sqlmap走一把.查看数据库 3.怎么看 ...