Nagios monitors MySQL synchronization status

Source: Internet
Author: User

In each step, create a user name and password on the MySQL slave server database, and only grant the replication Client permission.

Step 2: Create the script check-mysql-slave on the monitored MySQL slave server

#! /Bin/sh

Declare-A slave_is

Slave_is = ($ (/usr/local/MySQL/bin/MySQL-unagios-P ******-e "show slave status \ G" | grep running | awk' {print $2 }'))

If ["$ {slave_is [0]}" = "yes"-a "$ {slave_is [1]}" = "yes"]

Then

Echo "OK slave is running"

Exit 0

Else

Echo "Critical slave be stoped"

Exit 2

Fi

Step 3: nrpe on the MySQL slave server. Add the following command to CFG.

Command [check_mysql_slave] =/usr/local/Nagios/libexec/check_mysql_slave

Other settings are the same as those for Linux monitoring.


In the Nagios configuration file VI/usr/local/Nagios/services/Nagios. confdefine Service {

Use Service

The IP address of the host_name monitored segment must have nrpe

Service_description check_mysql_slave Nagios display name

Check_command check_nrpe! Check_mysql_slave plugin

Icationication_options W, U, C, r status

Contact_groups Contact Group

} Vi/usr/local/Nagios/hosts/Nagios. confdefine host {

Use host

Host_name IP alias check_alive

Address IP contact_groups group}

 

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.