|
Nagios监控MySQL从库状态
写了一个插件,MySQL slave status monitor plugin for Nagios,用来监控MySQL的主从复制和从库状态。
使用方法:
01 | #1.登上运行有mysql从库的服务器上,下载脚本放到nagios的libexec目录下,例如: |
02 | cd /usr/local/nagios/libexec/ |
06 | chown nagios:nagios check_mysql_slave_status |
07 | chmod 755 check_mysql_slave_status |
09 | #3.在nrpe.cfg文件中增加下边一行,参数根据你的需要修改 |
10 | #----------------------------增加文字-开始---------------------------- |
11 | command[check_mysql_slave_status]=/usr/local/nagios/libexec/check_mysql_slave_status -S /var/lib/mysql/mysql.sock -u user -p password |
12 | #----------------------------增加文字-结束---------------------------- |
18 | #----------------------------增加文字-开始---------------------------- |
21 | service_description check_mysql_slave_status |
22 | check_command check_nrpe!check_mysql_slave_status |
27 | notification_interval 30 |
28 | notification_period 24x7 |
29 | notification_options w,u,c |
31 | contact_groups sa_groups |
33 | #----------------------------增加文字-结束---------------------------- |
38 | #7.在MySQL中对你这个监控脚本要使用的用户进行授权 |
40 | grant replication client,super on *.* to chengyongxu.com@'localhost' identified by 'the password' |
脚本内容请见:http://down.chengyongxu.com/check_mysql_slave_status
转载请标明出处
http://www.chengyongxu.com/blog/ ... %E7%8A%B6%E6%80%81/
Nagios监控MySQL从库状态
|
|