MetricBeat监控MySQL

2023-12-13 03:29:38

目录

一、安装部署

二、开启mysql监控模块

三、编辑mysql配置文件

四、启动Metricbeat

五、查看监控图表


一、安装部署

? ?metriceat的安装部署参考章节: Metricbeat安装使用,这里不再赘述。

二、开启mysql监控模块

?进入metricbeat安装目录

./metricbeat modules enable mysql

三、编辑mysql配置文件

vim modules.d/mysql.yml
# Module: mysql
# Docs: https://www.elastic.co/guide/en/beats/metricbeat/main/metricbeat-module-mysql.html
 
- module: mysql
  metricsets:
    - status
    - galera_status
    - performance
   # - query
  period: 10s
 
# Host DSN should be defined as "user:pass@tcp(127.0.0.1:3306)/"
# or "unix(/var/lib/mysql/mysql.sock)/",
# or another DSN format supported by <https://github.com/Go-SQL-Driver/MySQL/>.
# The username and password can either be set in the DSN or using the username
# and password config options. Those specified in the DSN take precedence.
  hosts: ["root:admin@123456@tcp(127.0.0.1:3306)/"]
 
   # Username of hosts. Empty by default.
   #username: root
 
   # Password of hosts. Empty by default.
   #password: secret

四、启动Metricbeat

nohup ./metricbeat -e  > ./metricbeat.log 2>&1 &

五、查看监控图表

登入kibana,进入dashboard,搜索 mysql,即可看到相关图表。

文章来源:https://blog.csdn.net/lmj3732018/article/details/134870357
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。