zabbix监控mariadb数据库
1.创建监控用户及授权
[root@chang ~]# mysql -uroot -p123qqq.A
MariaDB [(none)]> CREATE USER 'monitor'@'%' IDENTIFIED BY '123qqq.A';
MariaDB [(none)]> GRANT REPLICATION CLIENT,PROCESS,SHOW DATABASES,SHOW VIEW ON *.* TO 'monitor'@'%';
MariaDB [(none)]> CREATE USER 'monitor'@'localhost' IDENTIFIED BY '123qqq.A';
MariaDB [(none)]> GRANT REPLICATION CLIENT,PROCESS,SHOW DATABASES,SHOW VIEW ON *.* TO 'monitor'@'localhost';
MariaDB [(none)]> flush privileges;
2.创建数据库免密登录文件(.my.cnf)
[root@chang ~]# mkdir -m u=rwx,g=rwx,o= -p /var/lib/zabbix
[root@chang ~]# chown zabbix:zabbix /var/lib/zabbix
[root@chang ~]# touch /var/lib/zabbix/.my.cnf
[root@chang ~]# vim /var/lib/zabbix/.my.cnf
[client]
user='monitor'
password='123qqq.A'
[root@chang ~]# cp /usr/share/doc/zabbix-agent-5.0.41/userparameter_mysql.conf /etc/zabbix/zabbix_agentd.d/userparameter_mysql.conf
3.重启zabbix-agent服务
[root@chang ~]# systemctl restart zabbix-agent
4.web界面配置
等待一会,数据已经传入过来了。