Monitor MySQL with a MySQL template from Zabbix
1. Installing the Zabbix Agent
[Email protected] ~]# RPM-IVH http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-agent-3.2.0-1.el7.x86_64.rpm [[Email protected] ~]# rpm--import/etc/pki/rpm-gpg/rpm-gpg-key-epel-7[[email protected] ~]# Yum install zabbix-agent
2. Modify the configuration
[Email protected] ~]# vim/etc/zabbix/zabbix_agentd.confserver=192.168.137.5serveractive=192.168.137.5hostname= szlinux02
3. Start the agent
[[email protected] ~]# Systemctl enable Zabbix-agent[[email protected] ~]# systemctl start Zabbix-agent[[email protected] ~]# NETSTAT-TUNPL | grep 10050
4. Test data acquisition on the server side
[Email protected] ~]# zabbix_get-s 192.168.137.4-p 10050-k system.uptime
5. Add a Linux host on the Zabbix page
Create hosts, configuration---host
650) this.width=650; "title=" clip_image002 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "Alt=" Clip_ image002 "src=" http://s3.51cto.com/wyfs02/M02/95/FA/wKiom1kbyZ_wTiBoAACGgqEdKkc062.jpg "border=" 0 "height=" 558 "/ >
6. Connect the template to the host
Click on select, tick the template App MySQL and template OS Linux, click Add.
650) this.width=650; "title=" clip_image004 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "Alt=" Clip_ image004 "src=" http://s3.51cto.com/wyfs02/M02/95/FA/wKioL1kbyaDgMdAxAABUHKdd198981.jpg "border=" 0 "height=" 234 "/ >
7. For template App MySQL in the client configuration
First, add the permissions in the client's MySQL, that is, the local MySQL is connected using the Zabbix account.
Mysql> grant usage, process, replication client on *. * to ' Zabbix ' @ ' localhost ' identified by ' [email protected] #123 '; my sql> flush Privileges;
Add. my.cnf
VI. MY.CNF
# Zabbix Agent
[MySQL]
Host=localhost
User=zabbix
password= ' [email protected] #123 '
Socket=/usr/local/mysql/mysql.sock
[Mysqladmin]
Host=localhost
User=zabbix
password= ' [email protected] #123 '
Socket=/usr/local/mysql/mysql.sock
8. Modify the home of the userparameter_mysql.conf to the directory where the new. my.cnf file is located
Sed-i ' [email protected]/var/lib/[email protected]/etc/[email protected] '/etc/zabbix/zabbix_agentd.d/userparameter _mysql.conf
9. Restart Zabbix-agent
Systemctl Restart Zabbix-agent
10. Get MySQL monitoring metrics data on Zabbix server test
Zabbix_get-s 192.168.137.4-p 10050-k mysql.ping
Attention:
If the test error: Sh:mysql:command not Found,sh:mysqladmin:command not found, modify Userparameter_ Mysql.conf the path to the Mysql,mysqladmin command, use the absolute path, then restart Zabbix-agent, and then test.
Password should be quoted in order to read.
11. View the latest data and graphics on a Web page
Detect the latest data or graphics in
650) this.width=650; "title=" clip_image006 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "Alt=" Clip_ image006 "src=" http://s3.51cto.com/wyfs02/M00/95/FA/wKiom1kbyaHwiPdWAACj-bO47fo485.jpg "border=" 0 "height=" 315 "/ >
650) this.width=650; "title=" clip_image008 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px, "alt=" clip_image008 "src=" Http://s3.51cto.com/wyfs02/M00/95/FA/wKioL1kbyaGgMzUJAABFog2ie20614.jpg "border=" 0 "height=" 194 "/>
This article is from the SQL Server deep Dive blog, so be sure to keep this source http://ultrasql.blog.51cto.com/9591438/1926571
Monitor MySQL with a MySQL template from Zabbix