目录
一、安装部署
二、开启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: mysqlmetricsets:- status- galera_status- performance# - queryperiod: 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,即可看到相关图表。