博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
prometheus mysqld_exporter监控mysql-5.7
阅读量:6758 次
发布时间:2019-06-26

本文共 2976 字,大约阅读时间需要 9 分钟。

1、下载及解压安装包

tar -xvf mysqld_exporter-0.11.0.linux-amd64.tar.gz -C /app/prometheus

2、创建密码填写内容.my.cnf文件

vim .my.cnf[client]host=127.0.0.1user=rootpassword=root

3、创建mysqld_exporter.service 的 systemd unit 文件

vim /usr/lib/systemd/system/mysqld_exporter.service[Unit]Description=node_exporterDocumentation=https://prometheus.io/After=network.target[Service]Type=simpleUser=prometheusExecStart=/app/prometheus/mysqld_exporter/mysqld_exporter --config.my-cnf=/app/prometheus/mysqld_exporter/.my.cnfRestart=on-failure[Install]WantedBy=multi-user.target

4、启动服务

systemctl daemon-reloadsystemctl enable mysqld_exporter.servicesystemctl start mysqld_exporter.service

5、运行状态

#systemctl status mysqld_exporter.service● mysqld_exporter.service - node_exporter   Loaded: loaded (/usr/lib/systemd/system/mysqld_exporter.service; enabled; vendor preset: disabled)   Active: active (running) since 一 2019-06-17 00:11:52 CST; 4s ago     Docs: https://prometheus.io/ Main PID: 27193 (mysqld_exporter)   CGroup: /system.slice/mysqld_exporter.service           └─27193 /app/prometheus/mysqld_exporter/mysqld_exporter --config.my-cnf=/app/prometheus/mysqld_exporter/.my.cnf6月 17 00:11:52 qas-zabbix4 systemd[1]: Started node_exporter.6月 17 00:11:52 qas-zabbix4 mysqld_exporter[27193]: time="2019-06-17T00:11:52+08:00" level=info msg="Starting mysqld_exporter (version=0.11.0, branch=HEAD, revision=5d7179615...ter.go:206"6月 17 00:11:52 qas-zabbix4 mysqld_exporter[27193]: time="2019-06-17T00:11:52+08:00" level=info msg="Build context (go=go1.10.3, user=root@3d3ff666b0e4, date=20180629-15:00:3...ter.go:207"6月 17 00:11:52 qas-zabbix4 mysqld_exporter[27193]: time="2019-06-17T00:11:52+08:00" level=info msg="Enabled scrapers:" source="mysqld_exporter.go:218"6月 17 00:11:52 qas-zabbix4 mysqld_exporter[27193]: time="2019-06-17T00:11:52+08:00" level=info msg=" --collect.global_status" source="mysqld_exporter.go:222"6月 17 00:11:52 qas-zabbix4 mysqld_exporter[27193]: time="2019-06-17T00:11:52+08:00" level=info msg=" --collect.global_variables" source="mysqld_exporter.go:222"6月 17 00:11:52 qas-zabbix4 mysqld_exporter[27193]: time="2019-06-17T00:11:52+08:00" level=info msg=" --collect.slave_status" source="mysqld_exporter.go:222"6月 17 00:11:52 qas-zabbix4 mysqld_exporter[27193]: time="2019-06-17T00:11:52+08:00" level=info msg=" --collect.info_schema.tables" source="mysqld_exporter.go:222"6月 17 00:11:52 qas-zabbix4 mysqld_exporter[27193]: time="2019-06-17T00:11:52+08:00" level=info msg="Listening on :9104" source="mysqld_exporter.go:232"Hint: Some lines were ellipsized, use -l to show in full.

prometheus mysqld_exporter监控mysql-5.7

6、prometheus.service添加配置

vim /app/prometheus/cfg/prometheus.yml   - job_name: 'mysqld'         file_sd_configs:      - files: ['/app/prometheus/sd_cfg/mysqld.yml']        refresh_interval: 5s

7、基于文件发现添加配置文件

vim /app/prometheus/sd_cfg/mysqld.yml- targets: ['172.16.8.59:9104']  labels:   name: mysql

8、重启服务

systemctl restart prometheus.service

prometheus mysqld_exporter监控mysql-5.7

9、grafana图像展示

prometheus mysqld_exporter监控mysql-5.7

转载于:https://blog.51cto.com/10880347/2409787

你可能感兴趣的文章
ubuntu gitlab服务器搭建
查看>>
文本文件里如何快速在每行头尾都加上指定的内容
查看>>
WebGL绘制有端头的线
查看>>
仿照 ButterKnife 的 Android 注解实例
查看>>
为少欠技术债,开发经理应该做的事
查看>>
C#中获得汉字的首拼音(加强版)
查看>>
structure needs cleaning
查看>>
CentOS 7安装WordPress
查看>>
mybatis的jdbcType和javaType、oracle,MySQL的对应类型
查看>>
openxml in sql server
查看>>
Relational Algebra 关系代数
查看>>
node的http请求
查看>>
蓝牙Profile的概念和常见种类(转)
查看>>
Kafka 配置
查看>>
Ddr2,ddr3,ddr4内存条的读写速率
查看>>
MySQL 索引与查询优化
查看>>
static final常量变量的正确书写规范
查看>>
vue项目关闭eslint检查
查看>>
微服务技术栈
查看>>
NPOI workbook.RemoveSheetAt(0); 删除sheet页 次序 sheettmpRequire.CopySheet("Require", true);...
查看>>