Monitoring MySQL using Zabbix built-in MySQL template
Monitoring MySQL with Zabbix's own MySQL template
1. Install zabbix agent
[root@szlinux02 ~]# rpm -ivh http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-agent-3.2.0-1.el7.x86_64.rpm[root@szlinux02 ~]# yum install zabbix-agent
2. modify the configuration
[root@szlinux02 ~]# vim /etc/zabbix/zabbix_agentd.confServer=192.168.137.5ServerActive=192.168.137.5Hostname=szlinux02
3. start the agent
[root@szlinux02 ~]# systemctl enable zabbix-agent[root@szlinux02 ~]# systemctl start zabbix-agent[root@szlinux02 ~]# netstat -tunpl | grep 10050
4. Testing data acquisition on the server side
[root@szzabbix ~]# zabbix_get -s 192.168.137.4 -p 10050 -k system.uptime
5. Add Linux hosting on zabbix page
Configuration-> Host-> Create Host
6. Connect templates for hosts
Click Select, check Template App MySQL and Template OS Linux, click Add.
7. Configuring Template App MySQL on Client
First, add permissions to mysql on the client side, that is, this machine uses zabbix account to connect to local mysql.
mysql> grant usage, process, replication client on *.* to 'zabbix'@'localhost' identified by 'ABCabc!@# 123';mysql> flush privileges;
Add. my.cnf
[root@szlinux02 ~]# vi .my.cnf
# Zabbix Agent
[mysql]
host=localhost
user=zabbix
password='ABCabc!@# 123'
socket=/usr/local/mysql/mysql.sock
[mysqladmin]
host=localhost
user=zabbix
password='ABCabc!@# 123'
socket=/usr/local/mysql/mysql.sock
8. Change the HOME of userparameter_mysql.conf to the directory where the new. my.cnf file is located
[root@szlinux02 ~]# sed -i 's@/var/lib/zabbix@/etc/zabbix@g' /etc/zabbix /zabbix_agentd.d/userparameter_mysql.conf
9. Restart zabbix-agent
[root@szlinux02 ~]# systemctl restart zabbix-agent
10. Get mysql monitoring indicator data in zabbix server test
[root@szzabbix ~]# zabbix_get -s 192.168.137.4 -p 10050 -k mysql.ping
Note:
If the test error: sh: mysql: command not found, sh: mysqladmin: command not found, modify the mysql, mysqladmin command path in userparameter_mysql.conf, use the absolute path, and then restart zabbix-agent, and then test.
Password must be quoted to read.
11. View the latest data and graphics on Web pages
Testing-> Latest data or graphics