Authored by qinchao

Merge branch 'dev_gml'

@@ -6,6 +6,7 @@ import com.monitor.common.service.HttpRestClientService; @@ -6,6 +6,7 @@ import com.monitor.common.service.HttpRestClientService;
6 import org.slf4j.Logger; 6 import org.slf4j.Logger;
7 import org.slf4j.LoggerFactory; 7 import org.slf4j.LoggerFactory;
8 import org.springframework.beans.factory.annotation.Autowired; 8 import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.beans.factory.annotation.Value;
9 import org.springframework.stereotype.Service; 10 import org.springframework.stereotype.Service;
10 11
11 import java.util.HashMap; 12 import java.util.HashMap;
@@ -16,8 +17,10 @@ import java.util.Map; @@ -16,8 +17,10 @@ import java.util.Map;
16 */ 17 */
17 @Service 18 @Service
18 public class DingDingServiceImpl implements DingDingService { 19 public class DingDingServiceImpl implements DingDingService {
  20 + @Value("${ddRobotUrl}")
  21 + private String ddRobotUrl;
19 22
20 - final String ddRobotUrl="https://oapi.dingtalk.com/robot/send?access_token=31cf1a526c98862b7945e561c5a0d857a069350dbee0e807074b83b39fa1e1af"; 23 +// final String ddRobotUrl="https://oapi.dingtalk.com/robot/send?access_token=31cf1a526c98862b7945e561c5a0d857a069350dbee0e807074b83b39fa1e1af";
21 24
22 @Autowired 25 @Autowired
23 private HttpRestClientService httpRestClientService; 26 private HttpRestClientService httpRestClientService;
1 package com.monitor.other.sms.service.impl; 1 package com.monitor.other.sms.service.impl;
2 2
3 import com.model.SMSLogs; 3 import com.model.SMSLogs;
  4 +import com.monitor.common.service.AlarmMsgService;
  5 +import com.monitor.common.util.ApplicationUtil;
4 import com.monitor.common.util.ZkClientUtil; 6 import com.monitor.common.util.ZkClientUtil;
5 import com.monitor.model.domain.PageBean; 7 import com.monitor.model.domain.PageBean;
6 import com.monitor.model.page.PageRequest; 8 import com.monitor.model.page.PageRequest;
@@ -8,6 +10,7 @@ import com.monitor.model.response.BaseResponse; @@ -8,6 +10,7 @@ import com.monitor.model.response.BaseResponse;
8 import com.monitor.model.response.PageResponse; 10 import com.monitor.model.response.PageResponse;
9 import com.monitor.mysql.mapper.SMSLogsMapper; 11 import com.monitor.mysql.mapper.SMSLogsMapper;
10 import com.monitor.other.sms.service.SmsLogService; 12 import com.monitor.other.sms.service.SmsLogService;
  13 +import com.util.GetUsersInfoUtil;
11 import org.apache.zookeeper.data.Stat; 14 import org.apache.zookeeper.data.Stat;
12 import org.slf4j.Logger; 15 import org.slf4j.Logger;
13 import org.slf4j.LoggerFactory; 16 import org.slf4j.LoggerFactory;
@@ -30,6 +33,9 @@ public class SmsLogServiceImpl implements SmsLogService { @@ -30,6 +33,9 @@ public class SmsLogServiceImpl implements SmsLogService {
30 @Autowired 33 @Autowired
31 private ZkClientUtil zkClient; 34 private ZkClientUtil zkClient;
32 35
  36 + @Autowired
  37 + private AlarmMsgService alarmMsgService;
  38 +
33 private String ZK_PATH = "/yh/config/"; 39 private String ZK_PATH = "/yh/config/";
34 private String smsSendSwitch="ops.sendsms.open"; 40 private String smsSendSwitch="ops.sendsms.open";
35 private String smsSendVoiceSwitch="ops.sendvoicesms.open"; 41 private String smsSendVoiceSwitch="ops.sendvoicesms.open";
@@ -69,6 +75,21 @@ public class SmsLogServiceImpl implements SmsLogService { @@ -69,6 +75,21 @@ public class SmsLogServiceImpl implements SmsLogService {
69 String value="true"; 75 String value="true";
70 if("off".equals(key)){ 76 if("off".equals(key)){
71 value="false"; 77 value="false";
  78 + GetUsersInfoUtil getUsersInfoUtil = (GetUsersInfoUtil) ApplicationUtil.getBean(GetUsersInfoUtil.class);
  79 + String mobiles = getUsersInfoUtil.getMobileByAlarmGroup("告警开关切换组");
  80 + String content = "";
  81 + switch (pathCode){
  82 + case "ops.sendsms.open":
  83 + content = "运维ops短信告警开关is off";
  84 + break;
  85 + case "ops.sendvoicesms.open":
  86 + content = "运维ops语音告警开关is off";
  87 + break;
  88 + case "devops.sendsms.open":
  89 + content = "监控dev短信告警开关is off";
  90 + break;
  91 + }
  92 + alarmMsgService.sendSms("msgSwitch", content, "", mobiles);
72 } 93 }
73 Stat stat=zkClient.getCuratorFramework().checkExists().forPath(ZK_PATH + pathCode); 94 Stat stat=zkClient.getCuratorFramework().checkExists().forPath(ZK_PATH + pathCode);
74 // Stat 就是对zonde所有属性的一个映射, stat=null表示节点不存在! 95 // Stat 就是对zonde所有属性的一个映射, stat=null表示节点不存在!
@@ -50,4 +50,6 @@ check_bigdata=true @@ -50,4 +50,6 @@ check_bigdata=true
50 auto.task.test.url=http://qmc.yohops.com:9999/autoTask/executeFromGongDan 50 auto.task.test.url=http://qmc.yohops.com:9999/autoTask/executeFromGongDan
51 51
52 #获取伸缩组数据--访问aws、qcloud服务接口 52 #获取伸缩组数据--访问aws、qcloud服务接口
53 -auto.fetchScaling.open=true  
  53 +auto.fetchScaling.open=true
  54 +#钉钉访问地址
  55 +ddRobotUrl=https://oapi.dingtalk.com/robot/send?access_token=31cf1a526c98862b7945e561c5a0d857a069350dbee0e807074b83b39fa1e1af
@@ -46,4 +46,6 @@ spark.read.data.url=http://172.31.50.139:8082/malicious/ @@ -46,4 +46,6 @@ spark.read.data.url=http://172.31.50.139:8082/malicious/
46 check_bigdata=true 46 check_bigdata=true
47 47
48 #获取伸缩组数据--访问aws、qcloud服务接口 48 #获取伸缩组数据--访问aws、qcloud服务接口
49 -auto.fetchScaling.open=true  
  49 +auto.fetchScaling.open=true
  50 +#钉钉访问地址
  51 +ddRobotUrl=https://oapi.dingtalk.com/robot/send?access_token=31cf1a526c98862b7945e561c5a0d857a069350dbee0e807074b83b39fa1e1af
@@ -49,4 +49,6 @@ check_bigdata=false @@ -49,4 +49,6 @@ check_bigdata=false
49 auto.task.test.url=http://192.168.103.71:8075/autoTask/executeFromGongDan 49 auto.task.test.url=http://192.168.103.71:8075/autoTask/executeFromGongDan
50 50
51 #获取伸缩组数据--访问aws、qcloud服务接口 51 #获取伸缩组数据--访问aws、qcloud服务接口
52 -auto.fetchScaling.open=false  
  52 +auto.fetchScaling.open=false
  53 +#钉钉访问地址
  54 +ddRobotUrl=test