Precautions:
Experimental environment
CentOS Linux release 7.0.1406 (Core)
[Email protected] scripts]# mysql-v
Welcome to the MariaDB Monitor. Commands End With; or \g.
Your MariaDB Connection ID is 10683
Server VERSION:5.5.52-MARIADB MariaDB Server
Because I do it on a server, I need the following:
Zabbix_agentd httpd mysqld Zabbix_server
1. Monitor MySQL using the Percona monitor plugin
[email protected] alertscripts]# Yum install http://www.percona.com/downloads/percona-release/redhat/0.1-4/ percona-release-0.1-4.noarch.rpm
2.Percona Components
3. Install Percona-zabbix template PHP php-mysql
[email protected] alertscripts]# yum install percona-zabbix-templates php php-mysql
4. See what software is installed
[[email protected] alertscripts]# Rpm-qa PHP
[Email protected] scripts]# RPM-QL percona-zabbix-templates
/var/lib/zabbix/percona
/var/lib/zabbix/percona/scripts
/var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh
/var/lib/zabbix/percona/scripts/ss_get_mysql_stats.php
/var/lib/zabbix/percona/templates
/var/lib/zabbix/percona/templates/userparameter_percona_mysql.conf
/var/lib/zabbix/percona/templates/zabbix_agent_template_percona_mysql_server_ht_2.0.9-sver1.1.7.xml
[Email protected] scripts]#
5. Import templates
/var/lib/zabbix/percona/templates/zabbix_agent_template_percona_mysql_server_ht_2.0.9-sver1.1.7.xml
650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M00/99/30/wKioL1lFGWLijmcBAADE9i5lqsk501.png-wh_500x0-wm_ 3-wmp_4-s_3335679567.png "title=" Zabbix01.png "alt=" Wkiol1lfgwlijmcbaade9i5lqsk501.png-wh_50 "/>
6. Copy the configuration file
[Email protected] alertscripts]# Cp/var/lib/zabbix/percona/templates/userparameter_percona_mysql.conf/etc/zabbix /zabbix_agentd.d/
7. Where the script is stored
[Email protected] scripts]# pwd
/var/lib/zabbix/percona/scripts
8. Restart Service
[Email protected] scripts]# systemctl restart Zabbix-agent
9, create a profile, content, user name, password.
< note: In a production environment, you need to create a monitoring user >
[Email protected] scripts]# vim ss_get_mysql_stats.php.cnf
[email protected] scripts]# cat SS_GET_MYSQL_STATS.PHP.CNF
<?php
$mysql _user = ' root ';
$mysql _pass = ' S3cret '; (my root password is empty here, because there is no setting)
9, open the configuration file to view the contents of monitoring, as required to obtain the appropriate parameters
650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M00/99/30/wKiom1lFGauzEbICAAGItZI4pyA883.png-wh_500x0-wm_ 3-wmp_4-s_3268697960.png "title=" Zabbix-02.png "alt=" Wkiom1lfgauzebicaagitzi4pya883.png-wh_50 "/>
10. Execute the next script
[Email protected] scripts]#./get_mysql_stats_wrapper.sh
The indicators obtained
[Email protected] scripts]#./get_mysql_stats_wrapper.sh
7
4
4
4
2746
273953
1
20
0
0
8191
6663
1507
26
0
1507
11, the script is a bit small bug
650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M02/99/31/wKiom1lFGkLgeDIuAADAEg8zzRs320.png "title=" Zabbix03.png "alt=" Wkiom1lfgklgediuaadaeg8zzrs320.png "/>
11, configure the host to add templates, used to change English interface in English
650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M01/99/30/wKioL1lFGmjzX9q1AACX4uDT1ao646.png-wh_500x0-wm_ 3-wmp_4-s_1327815239.png "title=" Zabbix-04.png "alt=" Wkiol1lfgmjzx9q1aacx4udt1ao646.png-wh_50 "/>
Then view the number of graphics connections
650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M01/99/30/wKioL1lFGsyzwXXZAANLKvNcmuE684.png-wh_500x0-wm_ 3-wmp_4-s_3929347931.png "title=" Zabbix-mysql5.png "alt=" Wkiol1lfgsyzwxxzaanlkvncmue684.png-wh_50 "/>
This article is from a "glass of water" blog, please be sure to keep this source http://6528161.blog.51cto.com/6518161/1939390
Zabbix monitoring MySQL Detailed