MySQL Exporter

mysqld_exporter是用来搜集mysql的性能指标的,适用于mysql5.5及其以上版本

程序安装

下载地址:https://prometheus.io/download/#mysqld_exporter

安装mysqld_exporter
tar -zxvf mysqld_exporter-0.11.0.linux-amd64.tar.gz
mv mysqld_exporter-0.11.0.linux-amd64 /usr/local/mysqld_exporter
赋权

mysqld_exporter需要连接到Mysql,所以需要Mysql的权限,我们先为它创建用户并赋予所需的权限:

CREATE USER 'exporter'@'localhost' IDENTIFIED BY 'abc123' WITH MAX_USER_CONNECTIONS 3;
GRANT PROCESS, REPLICATION CLIENT, SELECT ON *.* TO 'exporter'@'localhost';
创建.my.cnf文件
cd /usr/local/mysqld_exporter
cat << EOF > .my.cnf
[client]
user=exporter
password=abc123
EOF
创建systemd服务
cat <<EOF > /etc/systemd/system/mysqld_exporter.service
[Unit]
Description=mysqld_exporter
After=network.target [Service]
Type=simple
User=prometheus
ExecStart=/usr/local/mysqld_exporter/mysqld_exporter --config.my-cnf=/usr/local/mysqld_exporter/.my.cnf
Restart=on-failure [Install]
WantedBy=multi-user.target
EOF
启动myslqd_exporter
systemctl daemon-reload
systemctl start mysqld_exporter
systemctl status mysqld_exporter
systemctl enable mysqld_exporter
验证
curl localhost:9104/metrics

拉取数据

利用 Prometheus 的 static_configs 来拉取 mysqld_exporter 的数据。

编辑prometheus.yml文件,添加内容

- job_name: 'mysql'
static_configs:
- targets: ['localhost:9104']

重启prometheus,然后在Prometheus页面中的Targets中就能看到新加入的mysql

MySQL exporter Dashboard 模板

搜索mysql的Grafana Dashboard,导入进去

Prometheus MySQL_exporter的更多相关文章

  1. Prometheus+Grafana打造Mysql监控平台

    prometheus/node_exporter/mysqld_exporter都是由go语言编写,需要先安装GoLang环境 下载node_exporter(监控服务器的CPU.内存.存储使用情况) ...

  2. prometheus监控linux系统

    安装node exporter 创建Systemd服务 #vim /etc/systemd/system/node_exporter.service[Unit]Description=mysql_ex ...

  3. prometheus监控mysql

    创建一个用于mysqld_exporter连接到MySQL的用户并赋予所需的权限 mysql> GRANT REPLICATION CLIENT, PROCESS ON *.* TO '; my ...

  4. Prometheus Operator 监控Kubernetes

    Prometheus Operator 监控Kubernetes 1. Prometheus的基本架构 ​ Prometheus是一个开源的完整监控解决方案,涵盖数据采集.查询.告警.展示整个监控流程 ...

  5. centos7下安装配置prometheus

    prometheus官网:https://prometheus.io/download/ 搭建环境参考:https://blog.csdn.net/baidu_36943075/article/det ...

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

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

  7. Prometheus初体验(三)

    一.安装部署 Prometheus基于Golang编写,编译后的软件包,不依赖于任何的第三方依赖.用户只需要下载对应平台的二进制包,解压并且添加基本的配置即可正常启动Prometheus Server ...

  8. prometheus+grafana监控mysql

    prometheus+grafana监控mysql 1.安装配置MySQL官方的 Yum Repository(有mysql只需设置监控账号即可) [root@localhost ~]# wget - ...

  9. 实战 Prometheus 搭建监控系统

    实战 Prometheus 搭建监控系统 Prometheus 是一款基于时序数据库的开源监控告警系统,说起 Prometheus 则不得不提 SoundCloud,这是一个在线音乐分享的平台,类似于 ...

随机推荐

  1. Week3 关于“微软必应词典客户端”的案例分析

    第一部分  调研,评测 一.iphone客户端的bug挖掘: 1.在例句中点击单词或短语,如果这个时候点得稍微快了一点,关联相应的翻译时会出现混乱. 经过调查发现,这个bug应该是必应得一个全平台错误 ...

  2. LINUX实践之模块

    模块实践 --关于模块代码部分 ---首先是.c代码: 一定会用到的函数有这几个:module_init().module_exit().MODULE_LICENSE() 会用到的头文件:module ...

  3. idea使用优化

    一.idea设置目录说明 1.bin目录包含我们的启动文件.虚拟机配置信息和idea属性信息等 2.help目录:帮助文档 3.jre64 : idea自带的jre环境 4.lib:idea所依赖的类 ...

  4. github 心得体会

     https://github.com/xu123/text 学习了很多知识感觉很有趣 git config :配置git git add:更新working directory中的文件至stagin ...

  5. 2017BUAA软工第0次作业

    第一部分:结缘计算机 1. 你为什么选择计算机专业?你认为你的条件如何?和这些博主比呢? 我在上大学之前,其实一直就没怎么考虑过自己以后想要选什么专业,只知道一个大致的方向一定是理工科.毕竟大学之前, ...

  6. PAT L2-012 关于堆的判断

    https://pintia.cn/problem-sets/994805046380707840/problems/994805064676261888 将一系列给定数字顺序插入一个初始为空的小顶堆 ...

  7. 一种快速统计SQL Server每个表行数的方法

    转载自:http://www.cnblogs.com/kenyang/archive/2013/04/09/3011447.html 我们都知道用聚合函数count()可以统计表的行数.如果需要统计数 ...

  8. MySql连接空闲8小时自动断开引起的问题

    一.问题描述 ​ 最近遇到了一个奇怪的MySql数据库问题,好几次前一天晚上历史数据还正常存储,第二天早上来了看实时数据存储还正常,历史数据不存储了.找了好久也没找到问题.后来仔细想了想,历史数据设置 ...

  9. Python文件os模块

    一.文件操作 1.打开一个文件 fo = open("foo.txt", "wb") fo.write( "www.runoob.com!\nVery ...

  10. Laravel Eloquent ORM 时如何查询表中指定的字段

    导读:在使用Laravel ORM的Model方法find, get, first方法获取数据对象时返回的数据对象的attributes属性数组里会包含数据表中所有的字段对应...原文地址:http: ...