Reference http://www.linuxidc.com/Linux/2016-04/130436.htm
Environment:
Zabbix sever:192.168.234.131
mysql:192.168.234.130
MySQL Client operation:
1 Add monitoring users, log in to the data and then:
GRANT USAGE on *. Zabbix ' @ ' localhost ' identified by ' Zabbix ' with GRANT OPTION; MariaDB [(None)]> flush privileges; # #刷新系统授权 MariaDB [(none)]> grant all on zabbix.* to ' Zabbix ' @ ' 127.0.0.1 ' identified by ' Zabbix ' with GRANT option;
2 Scripting vi/usr/local/zabbix/scripts/mysql_status.sh
User= ' Zabbix ' password= ' Zabbix ' mysql= '/usr/bin/mysql ' mysqladmin= '/usr/bin/mysqladmin ' command () { $ mysql -u $User -p$Password -e "Show global status" | awk "$ ~ /' "$" ' $/ {print $2} '}case $1 in com_select) command $1 ;; com_insert) command $1 ;; com_update) command $1 ;; com_delete) command $1 ;; com_begin) command $1 ;; com_commit) command $1 ;; com_rollback) command $1 ;; questions) command $1 ;; slow_queries) command $1 ;; bytes_received) command $1 ;; Bytes_sent) command $1 ;; uptime) command $1 ;; version) $Mysql -V | awk -F ' [ ,] ' ' { print $6} ' ;; ping) $Mysqladmin  -U$USER -P$PASSWORD PING | WC -l ;; *) echo "usage: $0 { com_select| Com_insert| com_update| com_delete| com_begin| Com_commit| com_rollback| questions| slow_queries| bytes_received| Bytes_sent| Ping| uptime| version } " ;; Esac
3. Add a custom key configuration file
Vi/usr/local/zabbix/etc/zabbix_agentd.confuserparameter=mysql.status[*],/usr/local/zabbix/scripts/mysql_ status.sh $1userparameter=mysql.ping,/usr/local/zabbix/scripts/mysql_status.sh PingUserParameter=mysql.version,/ Usr/local/zabbix/scripts/mysql_status.sh Version
4 Restart ZABBIX_AGENTD Service
/etc/init.d/zabbix_agentd restart
5 finally can be verified on the server side
Zabbix_get-s 192.168.234.130-k mysql.ping
If return 1 is normal
6 Add the MySQL template that Zabbix comes with, confirm the diagram
1) in the Zabbix front end you can see in real time the number of bytes that MySQL sends received. Where bytes received represents the number of bytes received from all clients, Bytes sent represents the number of bytes sent to all clients.
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/80/F2/wKiom1dFNbKzT5a9AAFazRrIKOI814.png "title=" 1.png " alt= "Wkiom1dfnbkzt5a9aafazrrikoi814.png"/>
2) Real-time view of the number of operations per second of SQL statements
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/80/F0/wKioL1dFNsqjLuH_AAJwBtlK810504.png "title=" 2.png " alt= "Wkiol1dfnsqjluh_aajwbtlk810504.png"/>
This article is from the "Drifting Away" blog, make sure to keep this source http://825536458.blog.51cto.com/4417836/1782982
Zabbix monitoring MySQL Performance