今天偷懒,直接转一篇配置Mysql监控的文章:原文链接在这里。
我这里还做了一个偷懒,直接去Grafana的官网import了两个Dashboard,id 分别是:625和6239。
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
这是一篇快速入门文章,介绍了如何使用Prometheus和Grafana对Mysql服务器性能进行监控。内容基于这篇文章,结合了自己的实际实践并根据最新版本的应用进行了调整。下面是两张效果图:
概述
Prometheus是一个开源的服务监控系统,它通过HTTP协议从远程的机器收集数据并存储在本地的时序数据库上。它提供了一个简单的网页界面、一个功能强大的查询语言以及HTTP接口等等。Prometheus通过安装在远程机器上的exporter来收集监控数据,我们用到了以下两个exporter:
node_exporter – 用于收集系统数据
mysqld_exporter – 用于收集Mysql数据
Grafana是一个开源的功能丰富的数据可视化平台,通常用于时序数据的可视化。它内置了以下数据源的支持:
并可以通过插件扩展支持的数据源。
架构图
下面是我们安装时用到的架构图:
安装和运行Prometheus
安装Prometheus
首先我们安装Prometheus:
$ wget https://github.com/prometheus/prometheus/releases/download/v1.6.3/prometheus-1.6.3.linux-amd64.tar.gz -O prometheus-1.6.3.linux-amd64.tar.gz
$ mkdir /usr/local/services/prometheus
$ tar zxf prometheus-1.6.3.linux-amd64.tar.gz -C /usr/local/services/prometheus --strip-components=1
配置prometheus
然后在安装目下编辑配置文件 prometheus.yml:
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_configs:
- job_name: linux
static_configs:
- targets: ['host:9100']
labels:
instance: db1
- job_