zabbix5.0监控mysql服务器

zabbix5.0监控mysql服务器

hostnameip
zabbix-server10.130.16.10
mysql10.130.16.11

mysql:

#zabbix-agent安装
rpm -Uvh https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm  	#使用阿里云的
yum clean all
yum install -y zabbix-agent
#创建账户并赋权
[root@mysql ~]# mysql
MariaDB [(none)]> CREATE USER 'zbx_monitor'@'localhost' IDENTIFIED BY '<password>';
MariaDB [(none)]> GRANT USAGE,REPLICATION CLIENT,PROCESS,SHOW DATABASES,SHOW VIEW ON *.* TO  'zbx_monitor'@'localhost';
MariaDB [(none)]> flush privileges;


###测试
[root@mysql ~]# mysql -uzbx_monitor -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 11879
Server version: 5.5.68-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| zabbix             |
+--------------------+
4 rows in set (0.00 sec)
#这个路径通过rpm -ql找到相应的路径
cp /usr/share/doc/zabbix-agent-5.0.7/userparameter_mysql.conf /etc/zabbix/zabbix_agentd.d/template_db_mysql.conf

###   /etc/zabbix/zabbix_agentd.d/template_db_mysql.conf 按实际设置修改 
#[client]
#user=zbx_monitor
#password=<password>

###配置账户
mkdir -p /var/lib/zabbix
cat>/var/lib/zabbix/.my.cnf<<EOF
[client]
user='zbx_monitor'
password='<password>'
EOF

在这里插入图片描述


版权声明:本文为a371933136原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。