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. Linux内核读书笔记第四周

    进程管理 1.进程描述符及任务结构 进程存放在叫做任务队列(task list)的双向循环链表中.链表中的每一项包含一个具体进程的所有信息,类型为task_struct,称为进程描述符(process ...

  2. 20135327郭皓--Linux内核分析第七周 可执行程序的装载

    第七周 可执行程序的装载 郭皓 原创作品转载请注明出处 <Linux内核分析>MOOC课程 http://mooc.study.163.com/course/USTC-1000029000 ...

  3. 使用代理创建连接池 proxyPool

    配置文件properties url=jdbc:mysql://127.0.0.1:3306/mine?characterEncoding=UTF-8 user=root password=1234 ...

  4. Integer Sequence Dividing CodeForces - 1102A (规律)

    You are given an integer sequence 1,2,…,n1,2,…,n. You have to divide it into two sets AAand BB in su ...

  5. 10-Python3从入门到实战—基础之函数

    Python从入门到实战系列--目录 函数的定义 函数是组织好的,可重复使用的,用来实现单一,或相关联功能的代码段. 函数的语法 def 函数名(参数列表): 函数体 函数代码块以 def 关键词开头 ...

  6. HTML 引入Css样式

  7. Java代码安全

    https://www.owasp.org/index.php/Category:Java

  8. 防止xss攻击。

    function htmlEscape(text){ return text.replace(/[<>&\"=]/g,function(match,pos,origina ...

  9. Linux下OSG的编译和安装以及遇到的问题

    (第一段日常扯蛋,大家不要看)由于我们教研室所做的RTMapper要用到GDAL,所以就打算看osgearth的源码来熟悉下GDAL库的使用,同时也了解下osgearth中关于带有高程的图像拼接.然而 ...

  10. React 表单控件onSubmit

    <!DOCTYPE html><html><head lang="en"> <meta charset="UTF-8" ...