zabbix5.0监控mysql服务

2022-10-21 12:16:42

1、登录mysql数据库,增加mysql监控用户和密码:user\password

>grant all privileges on *.* to user@localhost identified by 'password';

>flush privileges;

2、配置mysql授权文件,授权数据库监听用户和密码

#vim /etc/my.cnf

在末行插入以下内容:

[client]

default-character-set=utf8

host=localhost

user='用户名'

password='password'

3、定义msql监控变量

#find / -name mysqladmin

#vim /etc/zabbix/zabbix_agentd.d/userparameter_mysql.conf

添加监控变量

4、测试能否正常获取监控变量值

#/usr/local/mysql/bin/mysqladmin ping |grep -c alive |wc -l

返回‘1’正常

返回‘0’异常

 5、重启zabbix-agent

#systemctl restart zabbix-agent

6、zabbix前端页面添加mysql监控项和触发器

  • 作者:Jolezheng
  • 原文链接:https://blog.csdn.net/Jolezheng/article/details/126308077
    更新时间:2022-10-21 12:16:42