...
|
...
|
@@ -56,6 +56,8 @@ public class AlarmMsgServiceImpl implements AlarmMsgService { |
|
|
private String ZK_PATH = "/yh/config/";
|
|
|
private String smsSendSwitch="ops.sendsms.open";
|
|
|
|
|
|
private final String SYSTEM_IDC="yohops_aws";
|
|
|
|
|
|
/**
|
|
|
* 发送短信
|
|
|
*
|
...
|
...
|
@@ -63,7 +65,17 @@ public class AlarmMsgServiceImpl implements AlarmMsgService { |
|
|
*/
|
|
|
@Override
|
|
|
public boolean sendSms(String type, String content, String mobile) {
|
|
|
return sendSmsPrivate(type, content, "", mobile,true);
|
|
|
return sendSmsPrivate(type, content, "", mobile,true,SYSTEM_IDC);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 发送短信,指定发送源
|
|
|
*
|
|
|
* @throws UnsupportedEncodingException
|
|
|
*/
|
|
|
@Override
|
|
|
public boolean sendSmsWithIdc(String type, String content, String mobile,String idc) {
|
|
|
return sendSmsPrivate(type, content, "", mobile,true,idc);
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -71,7 +83,7 @@ public class AlarmMsgServiceImpl implements AlarmMsgService { |
|
|
*/
|
|
|
@Override
|
|
|
public boolean sendSmsAlways(String type, String content, String mobile){
|
|
|
return sendSmsPrivate(type, content, "", mobile,false);
|
|
|
return sendSmsPrivate(type, content, "", mobile,false,SYSTEM_IDC);
|
|
|
}
|
|
|
|
|
|
|
...
|
...
|
@@ -79,7 +91,7 @@ public class AlarmMsgServiceImpl implements AlarmMsgService { |
|
|
* 默认开启短信抑制功能
|
|
|
* @return
|
|
|
*/
|
|
|
private boolean sendSmsPrivate(String type, String content, String alarmInfo, String mobile,boolean checkSendBeforeMinus) {
|
|
|
private boolean sendSmsPrivate(String type, String content, String alarmInfo, String mobile,boolean checkSendBeforeMinus,String idc) {
|
|
|
//根据zk的开关判断是否需要发送数据
|
|
|
String open="";
|
|
|
try{
|
...
|
...
|
@@ -101,7 +113,7 @@ public class AlarmMsgServiceImpl implements AlarmMsgService { |
|
|
}
|
|
|
|
|
|
|
|
|
logger.info("Send msg type {} content {} alarmInfo {} moniole {}...", type, content, alarmInfo, mobile);
|
|
|
logger.info("Send msg type {} content {} alarmInfo {} mobiles {} idc {}...", type, content, alarmInfo, mobile,idc);
|
|
|
if (StringUtils.isBlank(content)) {
|
|
|
return false;
|
|
|
}
|
...
|
...
|
@@ -121,7 +133,7 @@ public class AlarmMsgServiceImpl implements AlarmMsgService { |
|
|
}
|
|
|
|
|
|
try {
|
|
|
monitorAlarmMapper.insertAlarmMsg(InfluxDBContants.AWS, type, content, alarmInfo, sendStatus ? "successed" : "faild", resultJsonString,mobile);
|
|
|
monitorAlarmMapper.insertAlarmMsg(InfluxDBContants.AWS, type, content, alarmInfo, sendStatus ? "successed" : "faild", resultJsonString,mobile,idc);
|
|
|
} catch (Exception e) {
|
|
|
logger.error("insert sms into influxdb failed", e);
|
|
|
}
|
...
|
...
|
|