Grafana+Prometheus系统监控之MySql
架构

grafana和prometheus之前安装配置过,见:Grafana+Prometheus打造全方位立体监控系统
MySql安装
MySql的地位和重要性就不言而喻了,作为开源产品深受广大中小企业以及互联网企业喜爱,所以这里我们也有必要对其进行相应的监控。
由于最近更换了CentOS7,这里对MySql重新安装一遍,顺便做个记录,CentOS7的yum源中默认好像是没有mysql的。为了解决这个问题,我们要先下载mysql的repo源。
列出所有版本信息:
lsb_release -a
下载mysql的repo源:
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
安装mysql-community-release-el7-5.noarch.rpm包:
rpm -ivh mysql-community-release-el7-5.noarch.rpm
安装mysql:
yum install mysql-server -y
修改权限,否则会报错:
chown -R root:root /var/lib/mysql
重启mysql服务:
service mysqld restart
登录并重置密码:
## 直接回车进入mysql控制台
mysql -u root
mysql > use mysql;
mysql > update user set password=password('123456') where user='root';
mysql > exit;
mysqld_exporter安装
下载并解压:
https://github.com/prometheus/mysqld_exporter/releases/download/v0.10.0/mysqld_exporter-0.10.0.linux-amd64.tar.gz
tar -xvf mysqld_exporter-0.10.0.linux-amd64.tar.gz
mysqld_exporter需要连接Mysql,首先为它创建用户并赋予所需的权限:
GRANT REPLICATION CLIENT, PROCESS ON *.* TO 'exporter'@'localhost' identified by '123456';
GRANT SELECT ON performance_schema.* TO 'exporter'@'localhost';
flush privileges;
创建.my.cnf文件 vi .my.cnf:
[client]
user=exporter
password=123456
运行mysqld_exporter:
./mysqld_exporter -config.my-cnf=".my.cnf" &
Prometheus配置
修改prometheus.yml加入MySql节点:
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_configs:
- job_name: prometheus
static_configs:
- targets: ['localhost:9090']
labels:
instance: prometheus
- job_name: linux1
static_configs:
- targets: ['192.168.1.120:9100']
labels:
instance: sys1
- job_name: linux2
static_configs:
- targets: ['192.168.1.130:9100']
labels:
instance: sys2
- job_name: redis1
static_configs:
- targets: ['192.168.1.120:9121']
labels:
instance: redis1
- job_name: mysql
static_configs:
- targets: ['192.168.1.120:9104']
labels:
instance: db1
保存以后重启Prometheus,查看targets:

最后登录grafana查看MySql监控信息:

参考文档:
https://github.com/prometheus/mysqld_exporter
Grafana+Prometheus系统监控之MySql的更多相关文章
- Grafana Prometheus系统监控Redis服务
Grafana Prometheus系统监控Redis服务 一.Grafana Prometheus系统监控Redis服务 1.1流程 1.2安装redis_exporter 1.3配置prometh ...
- Grafana+Prometheus系统监控之webhook
概述 Webhook是一个API概念,并且变得越来越流行.我们能用事件描述的事物越多,webhook的作用范围也就越大.Webhook作为一个轻量的事件处理应用,正变得越来越有用. 准确的说webho ...
- Grafana+Prometheus系统监控之Redis
REmote DIctionary Server(Redis) 是一个由Salvatore Sanfilippo写的key-value存储系统. Redis是一个开源的使用ANSI C语言编写.遵守B ...
- Grafana+Prometheus系统监控之SpringBoot
前言 前一段时间使用SpringBoot创建了一个webhook项目,由于近期项目中也使用了不少SpringBoot相关的项目,趁着周末,配置一下使用prometheus监控微服务Springboot ...
- 手动部署 Docker+Grafana+Prometheus系统监控之Redis
监控规划图 使用Docker 创建两台Redis docker run -d --name redis1 redis docker run -d --name redis2 redis 查看redis ...
- Grafana+Prometheus系统监控之钉钉报警功能
介绍 钉钉,阿里巴巴出品,专为中国企业打造的免费智能移动办公平台,含PC版,Web版和手机版.智能办公电话,消息已读未读,DING消息任务管理,让沟通更高效:移动办公考勤,签到,审批,企业邮箱,企业网 ...
- Prometheus 系统监控方案 一
最近一直在折腾时序类型的数据库,经过一段时间项目应用,觉得十分不错.而Prometheus又是刚刚推出不久的开源方案,中文资料较少,所以打算写一系列应用的实践过程分享一下. Prometheus 是什 ...
- prometheus简单监控Linux,mysql,nginx
prometheus安装 下载安装 #官网下载 解压即可使用 https://prometheus.io/download/ #docker 方式安装 sudo docker run -n prome ...
- Grafana+Prometheus+node_exporter监控,Grafana无法显示数据的问题
环境搭建: 被测linux机器上部署了Grafana,Prometheus,node_exporter,并成功启动了它们. Grafana中已经创建了Prometheus数据源,并测试通过,并且导入了 ...
随机推荐
- Python实战之SocketServer模块
文章出处:http://www.cnblogs.com/wupeiqi/articles/5040823.html SocketServer内部使用 IO多路复用 以及 "多线程" ...
- python concurrent.futures
python因为其全局解释器锁GIL而无法通过线程实现真正的平行计算.这个论断我们不展开,但是有个概念我们要说明,IO密集型 vs. 计算密集型. IO密集型:读取文件,读取网络套接字频繁. 计算密集 ...
- cocos2dx - 在MFC中使用cocos2dx
本节主要讲一下如何在MFC窗口中使用cocos2dx 在做比较复杂的游戏,有时需要通过一些工具来编辑生成关卡或者特效,技能等的配置文件.为了方便配置,需要可以通过修改参数直观得到显示的效果.这就需要将 ...
- 关于form表单上传图片的一些记录
jsp页面 <form class="form-horizontal" role="form" action="brandAction_addB ...
- Installation of the JDK-9 on ubuntu(linux上安装jdk-9)
Description:Java SE 9 is the latest update to the Java Platform(General Availability on 21 September ...
- Android 设备兼容性(1)
引用: Android官网 > 开发 > API 指南 > Introduction > Device Compatibility 1. 基本概念 Android被设计成能在各 ...
- 阿里巴巴Java规约插件试用
阿里Java开发规约Eclipse插件介绍 阿里巴巴集团配合<阿里巴巴Java开发手册>PDF终极版开发的IDE插件,目前包括IDEA插件.Eclipse插件. 安装 检查环境 插件要求: ...
- 使用WinDBG调试查看C#内存转储文件
有时候我们想查看一个正在运行的程序内存中的数据,可以在任务管理器将内存状态保存为转储文件,并使用WinDBG验证,这里我们来试试: 0.安装WinDBG 1.首先写个代码用来测试 一个class pu ...
- 转:用STL中的vector动态开辟二维数组
用STL中的vector动态开辟二维数组 源代码:#include <iostream>#include <vector>using namespace std;int mai ...
- [原创]InnoDB体系结构
参阅:<innodb存储引擎内幕> innodb整体的体系结构如下图所示: 整体结构分两大部分:内存和进程其中内存包括:buffer_pool\redo log buffer\addit ...