当前位置: 首页 > news >正文

prometheus grafana mysql监控配置使用

文章目录

  • 前传
  • bitnami/mysqld-exporter:0.15.1镜像
  • 出现了问题
  • .my.cnf
  • 可以用这个"prom/mysqld-exporter:v0.15.0"镜像
  • 重要的事情
  • mysql监控效果
  • 外传

前传

prometheus grafana的安装使用:https://nanxiang.blog.csdn.net/article/details/135384541

本文说下监控nginx,prometheus grafana nginx 安装配置和使用

Docker 镜像下载地址: https://hub.docker.com
比较好的hub.docker.com///-- https://hub.docker.com/u/bitnami
grafana监控面板:https://grafana.com/grafana/dashboards

bitnami/mysqld-exporter:0.15.1镜像

下载地址:https://hub.docker.com/r/bitnami/mysqld-exporter

docker pull bitnami/mysqld-exporter:0.15.1

docker run -itd --name mysqld-exporter --restart=always -p 9104:9104  -v /etc/localtime:/etc/localtime  bitnami/mysqld-exporter:0.15.1

docker run -itd --name mysqld-exporter --restart=always -p 9104:9104  -v /etc/localtime:/etc/localtime:ro -v /home/docker_data/monitor/mysqld-exporter/conf/.my.cnf:/opt/bitnami/mysqld-exporter/.my.cnf  bitnami/mysqld-exporter:0.15.1

出现了问题

bitnami/mysqld-exporter:0.15.1 caller=mysqld_exporter.go:225 level=info msg=

ts=2023-12-29T09:30:55.551Z caller=mysqld_exporter.go:220 level=info msg="Starting mysqld_exporter" version="(version=0.15.0, branch=HEAD, revision=6ca2a42f97f3403c7788ff4f374430aa267a6b6b)"

ts=2023-12-29T09:30:55.551Z caller=mysqld_exporter.go:221 level=info msg="Build context" build_context="(go=go1.20.5, platform=linux/amd64, user=root@c4fca471a5b1, date=20230624-04:09:04, tags=netgo)"

ts=2023-12-29T09:30:55.551Z caller=config.go:150 level=error msg="failed to validate config" section=client err="no user specified in section or parent"

ts=2023-12-291T09:30:55.551Z caller=mysqld_exporter.go:225 level=info msg="Error parsing host config" file=.my.cnf err="no configuration found"

是真不知道配置的路径在哪,找了好久,最后路径在容器中的/opt/bitnami/mysqld-exporter/
因为容器中没有配置的,需要自己配置.my.cnf文件,然后挂载到容器中

.my.cnf

[client]
host=10.xxx.xx.xxx
port=3306
user=exporter_xxx
password=xxx_432DERF

ID: 7362/15641
我用的是上面的。

可以用这个"prom/mysqld-exporter:v0.15.0"镜像

https://hub.docker.com/r/prom/mysqld-exporter/tags
docker pull prom/mysqld-exporter:v0.15.0

docker run -itd --name mysqld-exporter --restart=always -p 9104:9104 -v /etc/localtime:/etc/localtime:ro -v /home/docker_data/monitor/mysqld-exporter/promconf/.my.cnf:/.my.cnf prom/mysqld-exporter:v0.15.0

CREATE USER ‘exporter’@‘localhost’ IDENTIFIED BY ‘expoter12Ssdc3’ WITH MAX_USER_CONNECTIONS 3;
GRANT PROCESS, REPLICATION CLIENT, SELECTON . TO ‘exporter’@‘localhost’;
FLUSH PRIVILEGES;

.my.cnf配置,同样要有
网上有很多在docker启动时,指定mysql数据源的,结果是报错。
还有一种情况是DB连接拒绝,具体情况具体分析,和服务器和网络配置有关系

[client]
host=10.xxx.xx.xxx
port=3306
user=exporter_xxx
password=xxx_432DERF

重要的事情

在这里插入图片描述

mysql监控效果

在这里插入图片描述

外传

😜 原创不易,如若本文能够帮助到您的同学
🎉 支持我:关注我+点赞👍+收藏⭐️
📝 留言:探讨问题,看到立马回复
💬 格言:己所不欲勿施于人 扬帆起航、游历人生、永不言弃!🔥

相关文章:

  • 【JAVA】泛型和Object的区别
  • 深入了解Swagger注解:@ApiModel和@ApiModelProperty实用指南
  • 外包干了3个月,技术退步明显.......
  • 使用 dbgate 在 sealos 上完美管理 mysql pgsql 等数据库
  • 14:00面试,14:08就出来了,问的问题过于变态了。。。
  • Mybatis行为配置之Ⅰ—缓存
  • Linux系统安装MySQL
  • 泛型擦除到底是怎么一回事
  • 福建科立讯通信 指挥调度管理平台 多处文件上传漏洞复现
  • Huffman树实现文件压缩
  • 【Bootstrap学习 day2】
  • CAAC无人机操作证考证报名流程及白底证件照片制作方法
  • redis服务迁移数据工具--RDM
  • 电商快递运费对账教程
  • Leetcode 第 375 场周赛题解
  • java读写txt
  • 【ROS2】MOMO的鱼香ROS2(四)ROS2入门篇——ROS2节点通信之话题与服务
  • 为什么深度学习神经网络可以学习任何东西
  • Debezium发布历史47
  • 华为OD机试 - 火星文计算2(Java JS Python C)
  • 上海公办小学验证今起开始,下周一和周二分区进行民办摇号
  • 网警打谣:传播涉刘国梁不实信息,2人被处罚
  • 孟夏韵评《无序的学科》丨误读与重构的文化漂流
  • 讲座|消逝之钟:《红楼梦》与《布登勃洛克一家》中的时间观
  • 泽连斯基已离开土耳其安卡拉
  • 龚正会见哥伦比亚总统佩特罗