-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
yaojia.lou
authored and
yaojia.lou
committed
Mar 14, 2021
1 parent
af55036
commit 554fa91
Showing
12 changed files
with
104 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
/.idea/ | ||
/dbsync.iml | ||
/src/main/resources/app.yaml | ||
/src/main/resources/logback.yaml | ||
/src/main/resources/logback.xml |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,64 +108,54 @@ monitor: | |
|
||
系统提供`同步状态`和`工作线程状态`的监控. 详情参看`Endpoints端点` | ||
|
||
监控配置可配置1-N个监控策略, 目前支持的动作有: `发送告警`和`自动重启` | ||
监控配置可配置1-N个监控规则, 目前支持的动作有: `发送邮件通知`、`通过Webhook发送通知`、`自动重启` | ||
|
||
监控配置参数说明: | ||
|
||
- matches.heartbeatLostOver 当工作线程心跳丢失超过N次时执行 | ||
- matches.syncBlockedOver 当阻塞的数据量超过N个时执行 | ||
- matches.syncErrorOver 当同步失败的数据量超过N个时执行 | ||
- matches.syncPendingOver 当同步等待的数据量超过N个时执行 | ||
- action 动作类型, 目前支持`restart`和`webhook`方式. 可扩展 | ||
- action 动作类型, 目前支持`email`、`restart`、`webhook`方式 | ||
- params 动作参数. 针对每种动作类型有不同参数 | ||
|
||
### 动作`webhook`, 配置如下 | ||
发送通知时包括以下几个信息: | ||
|
||
- matchedRule 匹配到的监控规则 | ||
- reason 告警的原因 | ||
- syncStatus 当前同步状态 | ||
- components 当前工作线程状态 | ||
|
||
### `webhook`动作, | ||
|
||
配置如下 | ||
|
||
``` | ||
action: webhook | ||
params: | ||
url: http://x.x.x.x:xxxx/path | ||
url: http://x.x.x.x:xxxx/path #接收告警的地址 | ||
``` | ||
|
||
其中`url`为接收告警的地址 | ||
### `email`动作 | ||
|
||
告警数据格式如下: | ||
配置如下 | ||
|
||
``` | ||
> POST /path HTTP/1.1 | ||
> Content-Type: application/json | ||
> Content-Length: 1056 | ||
{ | ||
"reason": "告警原因", | ||
"syncStatus": { | ||
"pending": 0, | ||
"blocked": 0, | ||
"error": 0, | ||
"success": 0, | ||
"others": 0 | ||
}, | ||
"components": { | ||
"blocked-handler": { | ||
"statistics": {}, | ||
"total": 0, | ||
"heartbeatLost": 0, | ||
"heartbeatInterval": 120000, | ||
"lastHeartbeat": "2021-03-13 15:04:59", | ||
"status": "GREEN" | ||
}, | ||
"cleanWorker": { | ||
"heartbeatLost": 206, | ||
"heartbeatInterval": 5, | ||
"lastHeartbeat": "2021-03-13 15:04:59", | ||
"status": "RED" | ||
} | ||
} | ||
} | ||
action: email | ||
params: | ||
host: x.x.x.x #邮件服务器地址 | ||
port: xxxx #邮件服务器端口 | ||
user: xxx #邮件服务器用户名 | ||
password: xxxx #邮件服务器密码 | ||
from: [email protected] #发件人 | ||
subject: xxx #邮件标题 | ||
to: #收件人列表 | ||
- [email protected] | ||
- [email protected] | ||
``` | ||
|
||
其中: | ||
### `restart` 动作 | ||
|
||
- reason 为原因 | ||
- syncStatus 为当前同步状态 | ||
- components 为当前工作线程状态 | ||
``` | ||
action: restart | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
BASEDIR=$(dirname "$0") | ||
cd ${BASEDIR}/.. | ||
nohup java -Dapp=dbsync -cp lib/* com.louyj.dbsync.DbSyncLauncher config/app.yaml > logs/dbsync.out 2>&1 |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters