失败告警策略扩展:默认提供邮件失败告警,可扩展短信等,扩展代码位置为 "JobFailMonitorHelper.failAlarm";

pull/4/head
xuxueli 7 years ago
parent ed31b1b66a
commit b7a2724f11

@ -1021,6 +1021,7 @@ Tips: 历史版本(V1.3.x)目前已经Release至稳定版本, 进入维护阶段
### 6.20 版本 V1.9.0 特性[迭代中]
- 1、新增任务运行模式 "GLUE模式(NodeJS) "支持NodeJS脚本任务
- 2、修复任务监控线程被耗时任务阻塞的问题
- 3、失败告警策略扩展默认提供邮件失败告警可扩展短信等扩展代码位置为 "JobFailMonitorHelper.failAlarm"
### TODO LIST
- 1、任务权限管理执行器为粒度分配权限核心操作校验权限

@ -61,7 +61,7 @@ public class JobFailMonitorHelper {
}
if (ReturnT.FAIL_CODE == log.getTriggerCode() || ReturnT.FAIL_CODE == log.getHandleCode()) {
// job fail,
sendMonitorEmail(log);
failAlarm(log);
logger.info(">>>>>>>>>>> job monitor, job fail, JobLogId:{}", jobLogId);
}
}
@ -81,7 +81,7 @@ public class JobFailMonitorHelper {
XxlJobLog log = XxlJobDynamicScheduler.xxlJobLogDao.load(jobLogId);
if (ReturnT.FAIL_CODE == log.getTriggerCode()|| ReturnT.FAIL_CODE==log.getHandleCode()) {
// job fail,
sendMonitorEmail(log);
failAlarm(log);
logger.info(">>>>>>>>>>> job monitor last, job fail, JobLogId:{}", jobLogId);
}
}
@ -94,10 +94,13 @@ public class JobFailMonitorHelper {
}
/**
* send monitor email
* fail alarm
*
* @param jobLog
*/
private void sendMonitorEmail(XxlJobLog jobLog){
private void failAlarm(XxlJobLog jobLog){
// send monitor email
XxlJobInfo info = XxlJobDynamicScheduler.xxlJobInfoDao.loadById(jobLog.getJobId());
if (info!=null && info.getAlarmEmail()!=null && info.getAlarmEmail().trim().length()>0) {
@ -109,6 +112,9 @@ public class JobFailMonitorHelper {
MailUtil.sendMail(email, title, content, false, null);
}
}
// TODO, custom alarm strategy, such as sms
}
public void toStop(){

Loading…
Cancel
Save