Zabbix monitoring MySQL Multi-instance and mariadb custom scripts and their deployment

Source: Internet
Author: User

Recently deployed Zabbix monitoring, found that many DB servers are MySQL multi-instance status, MPM default MySQL monitoring can not effectively monitor the running state and replication relationship of MySQL, so for the dual-instance MySQL production of the manual Zabbix script monitoring as follows

Start by creating a new Zabbix MySQL multi-instance monitoring template, as follows:


650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/71/77/wKioL1XRf9vhva2WAAHJ_mhsLvI251.jpg "title=" MySQL multi-instance template. png "alt=" wkiol1xrf9vhva2waahj_mhslvi251.jpg "/>

Name is template information name

Type changed to Zabbix trap because of the script used

The information returned by the key-value script can be a numeric value, or it can be a character, defined here as a character

Data type Word Element



You can also set the active capture as follows: Monitor multi-instance port status

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/71/7A/wKiom1XRffPhtZIlAAHSoKHadRo386.jpg "title=" MySQL multi-instance port template. png "alt=" wkiom1xrffphtzilaahsokhadro386.jpg "/>

Name is template information name

Type is set to Breakpoint agent (active) because it is the master to trigger

The information returned by the key-value script

of data type numbers



Then go to the corresponding template to set the alarm information is the trigger

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/71/77/wKioL1XRgB-QM5p7AADI6pXtlY8274.jpg "title=" MySQL multi-instance trigger template. png "alt=" wkiol1xrgb-qm5p7aadi6pxtly8274.jpg "/>


The trigger is defined according to the state value obtained in the script and the master active trigger, depending on the value of the change state, for example, the slave state is divided into

0 Normal

Null slave copy Stop

>1000 replication delay, showing delay time

Port status 0 is abnormal alarm up for normal.



The script content is as follows

################################### 3359 ##################################

# # # SLAVE STATUS # # #

status59= ' Mysql-uzabbix-pzabbix--sock ' path '-e ' show slave status \g ' | grep Behind | Awk-f ': ' {print $} '

if [${status59} = 0]

Then

Zabbix_sender--zabbix-server zabbix-master-ip--port 10051--host hostname--key mysql.3359slave-check--value ' 0 '

Else

if [${status59} = null]

Then

Zabbix_sender--zabbix-server zabbix-master-ip--port 10051--host hostname--key mysql.3359slave-check--value ' 9999999 9 '

Else

Zabbix_sender--zabbix-server zabbix-master-ip--port 10051--host hostname--key mysql.3359slave-check--value "$status 59 "

Fi

Fi

################################### 3360 ##################################

# # # SLAVE STATUS # # #

status60= ' Mysql-uzabbix-pzabbix--sock ' path '-e ' show slave status \g ' | grep Behind | Awk-f ': ' {print $} '

if [${STATUS60} = 0]

Then

Zabbix_sender--zabbix-server zabbix-master-ip--port 10051--host hostname--key mysql.3360slave-check--value ' 0 '

Else

if [${STATUS60} = null]

Then

Zabbix_sender--zabbix-server zabbix-master-ip--port 10051--host hostname--key mysql.3360slave-check--value ' 9999999 9 '

Else

Zabbix_sender--zabbix-server zabbix-master-ip--port 10051--host hostname--key mysql.3360slave-check--value "$status 60 "

Fi

Fi







You can also monitor MARIADB's multi-source replication status, specify set @ @default_master_connection = ' name ' in the script content, and then get the status information for a single slave, with MySQL.

This article from "Cloud Light Breeze Light" blog, declined reprint!

Zabbix monitoring MySQL Multi-instance and mariadb custom scripts and their deployment

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.