Monitor MySQL master and slave with Zabbix

Source: Internet
Author: User

MySQL Master-slave monitoring


#脚本如下, intercept master and slave keywords

The cat check_mysql_slave.sh #!/bin/bash# declare-a defines an array, and slave_is is treated as an array declare-a slave_isslave_is= ($ (/data/mysql/bin/ Mysql-e "show slave Status\g" |grep-e "slave_io_running| Slave_sql_running: "|awk ' {print $} ')) if [" ${slave_is[0]} "=" yes "-a" ${slave_is[1]} "=" yes "];then echo" Ok-slave Is running "Exit 0else echo" Down-slave are not running "exit 2fi


Cat Zabbix_agentd.conf | Grep-v "^#" | Grep-v "^$" logfile=/tmp/zabbix_agentd.logenableremotecommands=1server=10.74.246.70listenport=10050serveractive= 10.74.246.70hostname=10.74.244.33allowroot=1include=/usr/local/zabbix/etc/zabbix_agentd.conf.d/*. confunsafeuserparameters=1userparameter=tomcat_port,/usr/local/zabbix/share/zabbix/alertscripts/tomcat_port.sh $1userparameter=tcp[*],/usr/local/zabbix/share/zabbix/alertscripts/tcp_connection.sh $1UserParameter=nginx_port ,/usr/local/zabbix/share/zabbix/alertscripts/nginx_port.sh $1userparameter=erro_log[*],/usr/local/zabbix/share/ zabbix/alertscripts/error_log.sh $1#mysql Master-Slave monitoring script, grep-c "OK", the number of OK occurrences userparameter=mysql.slave,/usr/local/zabbix/ share/zabbix/alertscripts/check_mysql_slave.sh | Grep-c ' OK '


#创建自定义模板:

650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M02/8D/C5/wKioL1iqlzuwt5IAAAB1cMKGs0M728.png-wh_500x0-wm_ 3-wmp_4-s_3373413785.png "title=" Zabbix1.png "alt=" Wkiol1iqlzuwt5iaaab1cmkgs0m728.png-wh_50 "/>

#创建应用集:

650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M00/8D/C7/wKiom1iql0qziLLoAAA-Z5gK6yo795.png-wh_500x0-wm_ 3-wmp_4-s_320333487.png "title=" Zabbix2.png "alt=" Wkiom1iql0qzilloaaa-z5gk6yo795.png-wh_50 "/>

#创建监控项:

650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M00/8D/C5/wKioL1iql1nRqEVSAACBBxQ-w-4399.png-wh_500x0-wm_ 3-wmp_4-s_2334766626.png "title=" Zabbix3.png "alt=" Wkiol1iql1nrqevsaacbbxq-w-4399.png-wh_50 "/>

#创建触发器:

650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M02/8D/C5/wKioL1iql2qQ4r1yAABWusrBR98896.png-wh_500x0-wm_ 3-wmp_4-s_3378958502.png "title=" Zabbix4.png "alt=" Wkiol1iql2qq4r1yaabwusrbr98896.png-wh_50 "/>


#添加mysql-slave Monitoring graphics:

650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M00/8D/C7/wKiom1iql3exr7dfAAByRawHVEs909.png-wh_500x0-wm_ 3-wmp_4-s_661076081.png "title=" Zabbix5.png "alt=" Wkiom1iql3exr7dfaabyrawhves909.png-wh_50 "/>


#查看图形监控效果:

650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M01/8D/C5/wKioL1iql8fT8n63AACjkApsH4k989.png-wh_500x0-wm_ 3-wmp_4-s_1272964032.png "title=" Zabbix6.png "alt=" Wkiol1iql8ft8n63aacjkapsh4k989.png-wh_50 "/>

This article is from the "LINUX Super Dream" blog, make sure to keep this source http://215687833.blog.51cto.com/6724358/1899478

Monitor MySQL master and slave with Zabbix

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.