#: Configure the main MySQL from
#: Installation Percona Monitoring Plugins (address: https: //www.percona.com/downloads/) #: I am safe in the library, which will monitor the security of which the above
root@ubuntu:~# wget https://www.percona.com/downloads/percona-monitoring-plugins/percona-monitoring-plugins-1.1.8/binary/debian/artful/x86_64/percona-zabbix-templates_1.1.8-1.artful_all.deb
root@ubuntu:~# dpkg -i percona-zabbix-templates_1.1.8-1.artful_all.deb
#: According to the installation instructions for installation (address: https: //www.percona.com/doc/percona-monitoring-plugins/LATEST/zabbix/index.html#installation-instructions)
#: Installing PHP5.6 and php-mysql version Note:
root@ubuntu:~# sudo apt-get install -y software-properties-common
root@ubuntu:~# sudo add-apt-repository ppa:ondrej/php
root@ubuntu:~# sudo apt-get update
root@ubuntu:~# sudo apt-get install -y php5.6 php5.6-mysql
root@ubuntu:~# apt install zabbix-agent
#: Modify the agent configuration file, and restart
root@ubuntu:~# systemctl restart zabbix-agent.service
#: Restart web page and then add this host
#: The perconna generated userparameter copied to the directory agent generated below the root @ Ubuntu: / etc / ZABBIX # CP /var/lib/zabbix/percona/templates/userparameter_percona_mysql.conf /etc/zabbix/zabbix_agentd.conf.d/ # : setting with which users monitor MySQL root @ Ubuntu: ~ # vim / var / lib / zabbix / Percona / scripts / ss_get_mysql_stats.php.cnf <? PHP $ mysql_user = ' root ' ; $ mysql_pass = '' ; #: my no password #: now the machine to test the root @ Ubuntu: / var / lib / ZABBIX / Percona / scripts # / var / lib / ZABBIX / Percona / scripts / get_mysql_stats_wrapper. SH GG 40 # server-side testing, the display is blank, should as zabbix enough authority, you need to set up sudolers root @ ubuntu: ~ # / Apps / zabbix_server / bin / -s zabbix_get 192.168 . 7.112 -p 10050 -k " MySQL.Key-Read-Requests " (here is empty) #: Set started as root root @ ubuntu: Vim /etc/zabbix/zabbix_agentd.conf.d# / etc / ZABBIX / zabbix_agentd.conf AllowRoot = . 1 the User = the root the root @ Ubuntu: /etc/zabbix/zabbix_agentd.conf.d# Vim / lib / systemd / System / zabbix- Agent .service the User = root Group = root #: so that you can get to the value of #: export templates (some do not have this support, which import courseware templates) root @ Ubuntu: /etc/zabbix/zabbix_agentd.conf.d# cd / var / lib / zabbix / percona / templates / the xml file ending turned out
--- web end into the template by the template courseware passive mode, the active mode change, time interval
#: Configure monitoring MySQL master-slave synchronization is not yes, and the delay time of the script root @ Ubuntu: . /Etc/zabbix/zabbix_agentd.conf.d# vim mysql_monitor SH # / bin /! Bash #Date: 2016 / 11 / 11 # author: Zhangshijie the Seconds_Behind_Master () { NUM = `MySQL -uroot--hlocalhost -e " Show Slave Status \ G; " | grep " the Seconds_Behind_Master: " | awk -F: ' {2} Print $ ' ` echo $ NUM } master_slave_check () { NUM1=`mysql -uroot -hlocalhost -e "show slave status\G;" | grep "Slave_IO_Running" | awk -F: '{print $2}' | sed 's/^[ \t]*//g'` #echo $NUM1 NUM2=`mysql -uroot -hlocalhost -e "show slave status\G;" | grep "Slave_SQL_Running:" | awk -F: '{print $2}' | sed 's/^[ \t]*//g'` #echo $NUM2 if test $NUM1 == "Yes" && test $NUM2 == "Yes";then echo 50 else echo 100 fi } main(){ case $1 in Seconds_Behind_Master) Seconds_Behind_Master; ;; master_slave_check) master_slave_check ;; esac } main $1 #:修改属主属组,权限 root@ubuntu:/etc/zabbix/zabbix_agentd.conf.d# chown zabbix.zabbix mysql_monitor. SH root @ Ubuntu: /etc/zabbix/zabbix_agentd.conf.d# chmod A + the X-mysql_monitor. SH #: Write in an active configuration file, configuration UserParameter root @ Ubuntu: / etc / zabbix / zabbix_agentd. # vim linux37.conf conf.d UserParameter . = mysql_monitor [*], / etc / zabbix / zabbix_agentd.conf.d / mysql_monitor SH " $ 1 " #; restart the service OOT @ Ubuntu: /etc/zabbix/zabbix_agentd.conf.d# systemctl zabbix- restart agent.service #: server-side test root @ Ubuntu: ~ # / Apps / zabbix_server / bin / zabbix_get -s 192.168 . 7.112 -p 10050-k " mysql_monitor [master_slave_check] " 50 #: After the test is passed, began to create templates, create monitored item, create a trigger, create graphics