Nagios realizes MySQL master-slave synchronization State Monitoring

Source: Internet
Author: User

First, the system environment

Host Name

Ip

Nagios

192.168.15.111

mysql_s

192.168.15.21

Second, the Operation procedure

2.1 Configuration of the mysql_s end

2.1.1 Writing Check_mysql_slave monitoring scripts

Cd/usr/local/nagios/libexec # switch to the directory where the Nagios monitor plugin is located

Vim Check_mysql_slave # start writing mysql_slave monitoring Scripts

Note: In the monitoring script MySQL You must create a new account and set limited permissions.

2.1.2 Add executable permissions to the script

chmod 755 Check_mysql_slave

-rwxr-xr-x 1 root root 471 Oct 12:59 Check_mysql_slave

2.1.3 Editing the Nrpe configuration file

Vim/usr/local/nagios/libexec/etc/nrpe.cfg +204

Commands #添加监控mysql Master-Slave synchronization state

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

2.1.4 Restarting the Nrpe service

2.1.5 Executing script test output

[Email protected]_s libexec]#./check_mysql_slave

OK mysql_s is running

Configuration of the 2.2 Nagios side:

2.2.1 Modifying an existing/usr/local/nagios/etc/objects/service.cfg configuration file

Define Service {

Use Generic-service

HOST_NAME Mysql_slave

Service_description Check_21_mysql_replication_status

Check_command Check_nrpe!check_mysql_slave

Max_check_attempts 3

Normal_check_interval 2

Retry_check_interval 2

Check_period 24x7

Notification_interval 10

Notification_period 24x7

Notification_options W,u,c,r

Contact_groups Admins

Process_perf_data 1

}

2.2.2 Restart Nagios

[Email protected] Objects]#/etc/init.d/nagios checkconfig #检查配置文件是否有误

[Email protected] Objects]#/etc/init.d/nagios Reload #重新加载配置文件

Running configuration Check...done.

Stopping Nagios:done.

Starting Nagios:done.

Note: If Nagios reload is complete, the monitoring page has not yet been detected and can be manually tested

/usr/local/nagios/libexec/check_nrpe-h192.168.15.21-c Check_mysql_slave

2.2.3 Final



Nagios realizes MySQL master-slave synchronization State Monitoring

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.