Rainbond插件扩展:基于Mysql-Exporter监控Mysql

MySQLD Exporter 插件基于标准的 MySQLD Exporter 实现。Rainbond 自带的 Prometheus 监控系统 rbd-monitor 会收集 Exporter 中的数据,并通过监控面板展示出来。用户可以自定义展示哪些关键性能数据的指标,这是监控 Mysql 数据库服务的不二之选。

安装 Mysql-Exporter 插件

在团队视图点击左侧的 「插件」 选项卡,进入我的插件页面。选择从应用商店安装/新建插件。

在开源应用商店中搜索 Mysql-exportor ,点击安装即可将插件安装到当前团队中。

在已有的 Mysql 服务组件的插件页面可以 「开通」 MySQLD Exporter 插件。

开通该插件后,「查看配置」 ,确认 DATA_SOURCE_NAME (MySQL 连接信息)是否正确。同时,也要确认时区的设置和被监控的 Mysql 服务组件是否一致。图中的配置代表使用 Asia/Shanghai 时区,Mysql 服务组件可以使用同样的环境变量配置来声明时区。

确认无误后,根据提示 「更新」 Mysql 服务组件,即可开始收集 MySQLD Exporter 提供的指标。

管理监控点

通过点击业务监控面板右上方的 「管理监控点」 ,可以定义监控点信息,这些信息定义了监控指标的来源。

MySQLD Exporter 插件已经定义好了一组监控点的配置,这组配置包含以下几个元素,这些元素都是必填项:

  • 配置名称:自定义这组配置的名字
  • 收集任务名称:自定义
  • 路径:指标的来源路径,根据 Exporter 设计的不同,需要填写合适的路径
  • 端口:Exporter 监听的端口,默认监听 9104,用户需要为 Mysql 主服务开启 9104 端口的对内服务。
  • 收集时间间隔: 多久收集一次指标

查看监控

这一插件已经默认配置好了常用的监控图表,点击一键导入,使用 mysqld-exportor 方案即可生成图表。

依次点击 「监控」 —— 「业务监控」 便可以看到相应的监控图表:

默认的监控图表展示的 MySQLD 业务监控数据项包括:

监控项
慢查询
OPS
磁盘读速率
磁盘写速率
字节接收速率
字节发送速率
InnoDB缓存池大小
连接线程峰值
运行线程峰值
平均运行线程
Table Lock lmmediate
Table Lock Waited

添加自定义监控图表

如果我们希望添加一个监控图表,来展示数据库当前连接数,那么请按照以下操作进行:

点击业务监控面板上方的 「添加图表」

输入新的标题,以及对应的查询条件 mysql_global_status_threads_connected 后,点击 「查询」。如果正常返回图表,则说明查询条件是正确的。标题的定义尽量清晰明了,并在有必要的情况下明确单位。

点击 「添加」 后,即可将新的监控图表加入业务监控面板。新添加的监控图表将会置于最后。

访问 Mysql 服务组件的 9104 端口,可以在 /metrics 路径下,查看所有可供成图的监控项。

K8S中文社区微信公众号

评论 3

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
  1. #3

    Hello Guys, I just completed my divorce with my cheating husband of 10 years with two beautiful kids when i got a solid evidence of his unfaithfulness on extra marital affairs and his infidelity lifestyle, And the various applications he used to hide chats and lot of secret on his cell phone. Then, i decided to hire (Henry clark) an hacker and a PI just to be 100% sure because i don’t want to confront him or take any kinda step without proof, fact and figures because that could leads to defamation… It was with this great, honest, professional and trustworthy Man i got to know my husband is a professional cheater and has been using this app to hide most of his chats. This great hacker helped me broke to into his cell phone activities and wired everything he does on his cell phone directly to my phone and i was able to monitor and track him directly from my phone remotely without him knowing,
    Contact the Ethical hacker via email, Henryclarkethicalhacker@gmail.com you can also reach him on Whatsapp 18134211326..

    Steve Jenna2个月前 (09-19)回复
  2. #2

    Contact him for any type of hacking, he is a professional hacker that specializes in exposing cheating spouses, and every other hacking related issues. he is a cyber guru, he helps catch cheating spouses by hacking their communications like call, Facebook, text, emails, Skype, whats-app and many more. I have used this service before and he did a very good job, he gave me every proof I needed to know that my fiancee was cheating. You can contact him on his email to help you catch your cheating spouse, or for any other hacking related problems, like hacking websites, bank statement, grades and many more. he will definitely help you, he has helped a lot of people, contact him on, Henryclarkethicalhacker@gmail.com, and you can Text/Call &WhatsApp: +1 (262)-236-7526, and figure out your relationship status. I wish you the best.

    Lucy Janet3周前 (11-13)回复
  3. #1

    Tracking cellphones and getting an accurate report has been a bit worrisome, thanks to Jeffrey whose service helped me locate certain cellphones without breaking a sweat. His service made me know that the internet has become the most common method of cheating nowadays, either emotionally or physically. Taking a few extra steps in getting what would serve as proof for leaving a toxic relationship, to see who your spouse texts or chats with on social media isn’t a bad idea, I’d recommend you reach out to Jeffreyethicalhacker@gmail.com
    Text,call or whatsapp on: +1 (747)345-9036
    YTU

    dda liey5541周前 (11-23)回复