- 论坛徽章:
- 0
|
回复 1# cenalulu
刚测试了下,脚本写好了,mmm_mon_log.conf配置也写好了(和你的一样),利用短信报警!
当我把原来的主停掉之后,切换到另外一个主上,没收到报警。利用tail -f /var/log/mysql-mmm/mmm_mond.log查看到了FATAL级别的日志如下:- 2010/11/10 07:25:36 WARN Check 'rep_backlog' on 'db1' is in unknown state! Message: UNKNOWN: Connect error (host = 192.168.1.161:3306, user = mmm_monitor)! Lost connection to MySQL server at 'reading initial communication packet', system error: 111
- 2010/11/10 07:25:36 WARN Check 'rep_threads' on 'db1' is in unknown state! Message: UNKNOWN: Connect error (host = 192.168.1.161:3306, user = mmm_monitor)! Lost connection to MySQL server at 'reading initial communication packet', system error: 111
- 2010/11/10 07:25:46 ERROR Check 'rep_threads' on 'db4' has failed for 10 seconds! Message: ERROR: Replication is broken
- 2010/11/10 07:25:46 ERROR Check 'rep_threads' on 'db2' has failed for 10 seconds! Message: ERROR: Replication is broken
- 2010/11/10 07:25:46 ERROR Check 'rep_threads' on 'db3' has failed for 10 seconds! Message: ERROR: Replication is broken
- 2010/11/10 07:25:49 FATAL State of host 'db4' changed from ONLINE to REPLICATION_FAIL
- 2010/11/10 07:25:49 INFO Removing all roles from host 'db4':
- 2010/11/10 07:25:49 INFO Removed role 'reader(192.168.1.112)' from host 'db4'
- 2010/11/10 07:25:49 FATAL State of host 'db2' changed from ONLINE to REPLICATION_FAIL
- 2010/11/10 07:25:49 INFO Removing all roles from host 'db2':
- 2010/11/10 07:25:49 INFO Removed role 'reader(192.168.1.111)' from host 'db2'
- 2010/11/10 07:25:49 FATAL State of host 'db3' changed from ONLINE to REPLICATION_FAIL
- 2010/11/10 07:25:49 INFO Removing all roles from host 'db3':
- 2010/11/10 07:25:49 INFO Removed role 'reader(192.168.1.114)' from host 'db3'
- 2010/11/10 07:25:49 INFO Orphaned role 'reader(192.168.1.111)' has been assigned to 'db1'
- 2010/11/10 07:25:49 INFO Orphaned role 'reader(192.168.1.112)' has been assigned to 'db1'
- 2010/11/10 07:25:49 INFO Orphaned role 'reader(192.168.1.114)' has been assigned to 'db1'
- 2010/11/10 07:25:50 ERROR Check 'mysql' on 'db1' has failed for 10 seconds! Message: ERROR: Connect error (host = 192.168.1.161:3306, user = mmm_monitor)! Lost connection to MySQL server at 'reading initial communication packet', system error: 111
- 2010/11/10 07:25:52 FATAL State of host 'db1' changed from ONLINE to HARD_OFFLINE (ping: OK, mysql: not OK)
- 2010/11/10 07:25:52 INFO Removing all roles from host 'db1':
- 2010/11/10 07:25:52 INFO Removed role 'reader(192.168.1.111)' from host 'db1'
- 2010/11/10 07:25:52 INFO Removed role 'reader(192.168.1.112)' from host 'db1'
- 2010/11/10 07:25:52 INFO Removed role 'reader(192.168.1.114)' from host 'db1'
- 2010/11/10 07:25:52 INFO Removed role 'reader(192.168.1.115)' from host 'db1'
- 2010/11/10 07:25:52 INFO Removed role 'writer(192.168.1.113)' from host 'db1'
- 2010/11/10 07:25:55 FATAL State of host 'db4' changed from REPLICATION_FAIL to ONLINE
- 2010/11/10 07:25:55 FATAL State of host 'db2' changed from REPLICATION_FAIL to ONLINE
- 2010/11/10 07:25:55 FATAL State of host 'db3' changed from REPLICATION_FAIL to ONLINE
- 2010/11/10 07:25:55 INFO Orphaned role 'writer(192.168.1.113)' has been assigned to 'db2'
- 2010/11/10 07:25:55 INFO Orphaned role 'reader(192.168.1.111)' has been assigned to 'db3'
- 2010/11/10 07:25:55 INFO Orphaned role 'reader(192.168.1.112)' has been assigned to 'db4'
- 2010/11/10 07:25:55 INFO Orphaned role 'reader(192.168.1.114)' has been assigned to 'db2'
- 2010/11/10 07:25:55 INFO Orphaned role 'reader(192.168.1.115)' has been assigned to 'db3'
- 2010/11/10 07:25:57 INFO Check 'rep_threads' on 'db4' is ok!
- 2010/11/10 07:25:57 INFO Check 'rep_threads' on 'db3' is ok!
复制代码 帮我看下错在什么地方了,谢谢,我的脚本如下:
#! /bin/sh
while read Message
do
LD_LIBRARY_PATH=fx/. fx/fetion --mobile=159200××××× --pwd=zilanxing@123 --to=15920××××× --msg-utf8="mysql-master-is-changed" >/dev/null 2>&1
done
直接执行 LD_LIBRARY_PATH=fx/. fx/fetion --mobile=159200××××× --pwd=zilanxing@123 --to=15920××××× --msg-utf8="mysql-master-is-changed" >/dev/null 2>&1能收到短信报警。 |
|