介绍
zabbix监控mysql性能,使用zabbix自带的mysql监控模板,可以监控以下内容OPS(增删改查)、mysql慢查询数量、mysql请求\响应流量带宽
配置
新建mysql监控用户
GRANT SUPER, REPLICATION CLIENT ON *.* TO 'zabbix_check'@'localhost' IDENTIFIED BY ''
新建.my.cnf文件
vim zabbix-agent/etc/.my.cnf
[mysql]
host=localhost
user=zabbix_check
password=
socket=/tmp/mysql.sock
定义zabbix监控item key
vim zabbix-agent/etc/zabbix_agentd.conf.d/userparameter_mysql.conf
UserParameter=mysql.status[*],echo "show global status where Variable_name='$1';" | HOME=/storage/server/zabbix-agent/etc /storage/server/mysql/bin/mysql -N | awk '{print $$2}'
UserParameter=mysql.version,/m2odata/server/mysql/bin/mysql -V
测试
重启zabbix_agentd使监控key生效
客户端测试
服务器端
Link MySQL模板
zabbix后台 Configuration->Hosts->被监控的数据库主机name->Template
查看graph operations
zabbix后台 Monitoring->Graphs->对应的graph