提交 ff5fdc99 authored 作者: 杨凯's avatar 杨凯

feat:新增告警接收接口

上级 9337b307
...@@ -24,4 +24,6 @@ public class ProjProperties { ...@@ -24,4 +24,6 @@ public class ProjProperties {
private String notNotifyUrl; private String notNotifyUrl;
private String notNotifyService;
} }
...@@ -29,6 +29,8 @@ public class AlarmServiceImpl implements AlarmService { ...@@ -29,6 +29,8 @@ public class AlarmServiceImpl implements AlarmService {
private static final String ENDPOINT_RELATION = "ENDPOINT_RELATION"; private static final String ENDPOINT_RELATION = "ENDPOINT_RELATION";
private static final String SERVICE = "SERVICE";
@Value("${webHookUrl}") @Value("${webHookUrl}")
private String webHookUrl; private String webHookUrl;
...@@ -45,12 +47,18 @@ public class AlarmServiceImpl implements AlarmService { ...@@ -45,12 +47,18 @@ public class AlarmServiceImpl implements AlarmService {
String message = alarmMessage.getAlarmMessage(); String message = alarmMessage.getAlarmMessage();
String scope = alarmMessage.getScope(); String scope = alarmMessage.getScope();
// 过滤一下不发送通知逻辑 // 过滤一下不发送服务通知逻辑
if (SERVICE.equals(scope)) {
if (Objects.nonNull(projProperties.getNotNotifyService()) && projProperties.getNotNotifyService().contains(name)) {
return "success";
}
}
// 过滤一下不发送服务通知接口逻辑
if (ENDPOINT_RELATION.equalsIgnoreCase(scope)) { if (ENDPOINT_RELATION.equalsIgnoreCase(scope)) {
// 获取路径地址 // 获取路径地址
String tempName = name.substring(name.indexOf("/"), name.length()); String tempName = name.substring(name.indexOf("/"), name.length());
String pathUrl = tempName.substring(0, tempName.indexOf(" ")); String pathUrl = tempName.substring(0, tempName.indexOf(" "));
if (projProperties.getNotNotifyUrl().contains(pathUrl)) { if (Objects.nonNull(projProperties.getNotNotifyService()) && projProperties.getNotNotifyUrl().contains(pathUrl)) {
return "success"; return "success";
} }
} }
......
...@@ -81,6 +81,7 @@ secret: OV5mmyDxX5Nx0caMYQp3Kg ...@@ -81,6 +81,7 @@ secret: OV5mmyDxX5Nx0caMYQp3Kg
# ou_534ec59ce6a625046da2b51896ec2764 赵凯 # ou_534ec59ce6a625046da2b51896ec2764 赵凯
projprops: projprops:
notNotifyService:
notNotifyUrl: /oss/api/file/store/v1/saveFile notNotifyUrl: /oss/api/file/store/v1/saveFile
serviceInfo[0]: serviceInfo[0]:
service_names: byh-doctor-service-basedata01_cloud-pro,byh-doctor-service-basedata02_cloud-pro,byh-doctoruser-service-core01_cloud-pro,byh-doctoruser-service-core02_cloud-pro,byh-sysinfocloud-service_cloud-pro,byh-ehospital-im01_cloud-pro,byh-ehospital-im02_cloud-pro service_names: byh-doctor-service-basedata01_cloud-pro,byh-doctor-service-basedata02_cloud-pro,byh-doctoruser-service-core01_cloud-pro,byh-doctoruser-service-core02_cloud-pro,byh-sysinfocloud-service_cloud-pro,byh-ehospital-im01_cloud-pro,byh-ehospital-im02_cloud-pro
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论