Authored by qinchao

手机号码改为通过组加载

@@ -16,19 +16,6 @@ import javax.annotation.PostConstruct; @@ -16,19 +16,6 @@ import javax.annotation.PostConstruct;
16 public class SnsMobileConfig { 16 public class SnsMobileConfig {
17 public static final Logger logger = LoggerFactory.getLogger(SnsMobileConfig.class); 17 public static final Logger logger = LoggerFactory.getLogger(SnsMobileConfig.class);
18 18
19 -  
20 - @Autowired  
21 - private GetUsersInfoUtil getUsersInfoUtil;  
22 -  
23 - @Value("${base_mobile}")  
24 - private String baseMobile;  
25 -  
26 - @Value("${redis_exception_mobile}")  
27 - private String redisMobile;  
28 -  
29 - @Value("${java_service_alarm_mobile}")  
30 - private String javaServiceMobile;  
31 -  
32 @Value("${java_service_alarm_flag}") 19 @Value("${java_service_alarm_flag}")
33 private boolean javaServiceFlag; 20 private boolean javaServiceFlag;
34 21
@@ -38,11 +25,19 @@ public class SnsMobileConfig { @@ -38,11 +25,19 @@ public class SnsMobileConfig {
38 @Value("${java_service_alarm_count_threshold}") 25 @Value("${java_service_alarm_count_threshold}")
39 private Integer javaServiceCountThreshold; 26 private Integer javaServiceCountThreshold;
40 27
41 - @Value("${java_api_error}")  
42 - private String javaApiError; 28 + @Autowired
  29 + private GetUsersInfoUtil getUsersInfoUtil;
43 30
44 private String bigdataMobile; 31 private String bigdataMobile;
45 32
  33 + private String javaApiError;
  34 +
  35 + private String javaServiceMobile;
  36 +
  37 + private String redisMobile;
  38 +
  39 + private String baseMobile;
  40 +
46 @PostConstruct 41 @PostConstruct
47 public void init(){ 42 public void init(){
48 //大数据报警 43 //大数据报警
@@ -51,7 +46,7 @@ public class SnsMobileConfig { @@ -51,7 +46,7 @@ public class SnsMobileConfig {
51 bigdataMobile=""; 46 bigdataMobile="";
52 } 47 }
53 48
54 - /* //JAVAAPI错误报警 49 + //JAVAAPI错误报警
55 javaApiError =getUsersInfoUtil.getMobileByAlarmGroup("JAVAAPI错误报警"); 50 javaApiError =getUsersInfoUtil.getMobileByAlarmGroup("JAVAAPI错误报警");
56 if(javaApiError==null){ 51 if(javaApiError==null){
57 javaApiError=""; 52 javaApiError="";
@@ -64,6 +59,7 @@ public class SnsMobileConfig { @@ -64,6 +59,7 @@ public class SnsMobileConfig {
64 javaServiceMobile=""; 59 javaServiceMobile="";
65 } 60 }
66 61
  62 +
67 //REDIS异常报警 63 //REDIS异常报警
68 redisMobile=getUsersInfoUtil.getMobileByAlarmGroup("REDIS异常报警"); 64 redisMobile=getUsersInfoUtil.getMobileByAlarmGroup("REDIS异常报警");
69 if(redisMobile==null){ 65 if(redisMobile==null){
@@ -74,7 +70,7 @@ public class SnsMobileConfig { @@ -74,7 +70,7 @@ public class SnsMobileConfig {
74 baseMobile=getUsersInfoUtil.getMobileByAlarmGroup("基础组"); 70 baseMobile=getUsersInfoUtil.getMobileByAlarmGroup("基础组");
75 if(redisMobile==null){ 71 if(redisMobile==null){
76 baseMobile=""; 72 baseMobile="";
77 - }*/ 73 + }
78 74
79 logger.info("初始化手机号码"); 75 logger.info("初始化手机号码");
80 logger.info("JAVAAPI错误报警 javaApiError :"+javaApiError); 76 logger.info("JAVAAPI错误报警 javaApiError :"+javaApiError);
@@ -15,14 +15,15 @@ import com.monitor.other.dns.model.IPModel; @@ -15,14 +15,15 @@ import com.monitor.other.dns.model.IPModel;
15 import com.monitor.other.dns.service.IDNSMonitorService; 15 import com.monitor.other.dns.service.IDNSMonitorService;
16 import com.monitor.other.dns.service.IRestTemplateNoEncode; 16 import com.monitor.other.dns.service.IRestTemplateNoEncode;
17 import com.monitor.other.dns.util.AESUtil; 17 import com.monitor.other.dns.util.AESUtil;
  18 +import com.util.GetUsersInfoUtil;
18 import org.apache.commons.lang3.StringUtils; 19 import org.apache.commons.lang3.StringUtils;
19 -import org.apache.http.NoHttpResponseException;  
20 import org.slf4j.Logger; 20 import org.slf4j.Logger;
21 import org.slf4j.LoggerFactory; 21 import org.slf4j.LoggerFactory;
22 import org.springframework.beans.factory.annotation.Autowired; 22 import org.springframework.beans.factory.annotation.Autowired;
23 import org.springframework.beans.factory.annotation.Value; 23 import org.springframework.beans.factory.annotation.Value;
24 import org.springframework.stereotype.Service; 24 import org.springframework.stereotype.Service;
25 25
  26 +import javax.annotation.PostConstruct;
26 import java.text.SimpleDateFormat; 27 import java.text.SimpleDateFormat;
27 import java.util.*; 28 import java.util.*;
28 29
@@ -34,6 +35,9 @@ public class DNSMonitorServiceImpl implements IDNSMonitorService { @@ -34,6 +35,9 @@ public class DNSMonitorServiceImpl implements IDNSMonitorService {
34 public static final Logger DEBUG = LoggerFactory.getLogger(DNSMonitorServiceImpl.class); 35 public static final Logger DEBUG = LoggerFactory.getLogger(DNSMonitorServiceImpl.class);
35 36
36 @Autowired 37 @Autowired
  38 + private GetUsersInfoUtil getUsersInfoUtil;
  39 +
  40 + @Autowired
37 DNSConfig dnsConfig; 41 DNSConfig dnsConfig;
38 42
39 @Autowired 43 @Autowired
@@ -48,14 +52,23 @@ public class DNSMonitorServiceImpl implements IDNSMonitorService { @@ -48,14 +52,23 @@ public class DNSMonitorServiceImpl implements IDNSMonitorService {
48 @Autowired 52 @Autowired
49 IDNSMonitorMapper dnsMonitorMapper; 53 IDNSMonitorMapper dnsMonitorMapper;
50 54
51 - @Value("${dns_exception_mobile}")  
52 - String alarmMobile; 55 + private String alarmMobile;
53 56
54 // 时间格式 每次监控后,记录这次监控记录的时间点 57 // 时间格式 每次监控后,记录这次监控记录的时间点
55 private SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH:mm"); 58 private SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH:mm");
56 59
57 private static Logger logger = LoggerFactory.getLogger(DNSMonitorServiceImpl.class); 60 private static Logger logger = LoggerFactory.getLogger(DNSMonitorServiceImpl.class);
58 61
  62 + @PostConstruct
  63 + public void init() {
  64 + //大数据报警
  65 + alarmMobile = getUsersInfoUtil.getMobileByAlarmGroup("DNS异常报警");
  66 + if (alarmMobile == null) {
  67 + alarmMobile = "";
  68 + }
  69 + DEBUG.info("DNS异常报警 mobile is"+alarmMobile);
  70 + }
  71 +
59 /** 72 /**
60 * 监控DNS域名解析是否出现异常 73 * 监控DNS域名解析是否出现异常
61 * <p> 74 * <p>
@@ -8,17 +8,8 @@ qcloud_voice_url=https://yun.tim.qq.com/v3/tlsvoicesvr/sendvoiceprompt?sdkappid= @@ -8,17 +8,8 @@ qcloud_voice_url=https://yun.tim.qq.com/v3/tlsvoicesvr/sendvoiceprompt?sdkappid=
8 qcloud_sms_url=https://yun.tim.qq.com/v3/tlssmssvr/sendmultisms2?sdkappid=1400021400&random=124 8 qcloud_sms_url=https://yun.tim.qq.com/v3/tlssmssvr/sendmultisms2?sdkappid=1400021400&random=124
9 qcloud_sms_key=6e56f948f6f1c0a1bc359e23f7acc140 9 qcloud_sms_key=6e56f948f6f1c0a1bc359e23f7acc140
10 10
11 -base_mobile=18751986615,18652008443,18252034289,17361900581,18751886435,17314953523  
12 -  
13 -dns_exception_mobile=18751986615,18652008443,18252034289,17361900581  
14 -  
15 -redis_exception_mobile=18751986615,18652008443,17361900581,18252034289  
16 -  
17 -java_service_alarm_mobile=18751986615,18652008443,18252034289,17361900581,18602555621  
18 java_service_alarm_flag=true 11 java_service_alarm_flag=true
19 java_service_alarm_cost_threshold=300 12 java_service_alarm_cost_threshold=300
20 java_service_alarm_count_threshold=50 13 java_service_alarm_count_threshold=50
21 14
22 -java_api_error=18751986615,18652008443,18252034289,13951882433,17361900581,18602555621  
23 -  
24 SWITCH_DB_URL=http://172.31.56.59:8011/switchdb/switchMysql 15 SWITCH_DB_URL=http://172.31.56.59:8011/switchdb/switchMysql
1 # ******************** send sms common configs ******************** 1 # ******************** send sms common configs ********************
2 sendsms.url=http://221.179.180.158:9009/HttpQuickProcess_utf-8/submitMessageAll 2 sendsms.url=http://221.179.180.158:9009/HttpQuickProcess_utf-8/submitMessageAll
3 -#sendsms.username=yoho  
4 -#sendsms.pwd=E  
5 -  
6 -qcloud_voice_url=https://yun.tim.qq.com/v3/tlsvoicesvr/sendvoiceprompt?sdkappid=1400021400&random=123  
7 -qcloud_sms_url=https://yun.tim.qq.com/v3/tlssmssvr/sendmultisms2?sdkappid=1400021400&random=124  
8 -qcloud_sms_key=6e56f948f6f1  
9 -  
10 sendsms.username=yohoyw 3 sendsms.username=yohoyw
11 sendsms.pwd=NCftHmJ9 4 sendsms.pwd=NCftHmJ9
12 -  
13 sendsms.notice.productid=8 5 sendsms.notice.productid=8
14 6
15 -base_mobile=15905144483  
16 -  
17 -dns_exception_mobile=15905144483  
18 -  
19 -redis_exception_mobile=15905144483 7 +qcloud_voice_url=https://yun.tim.qq.com/v3/tlsvoicesvr/sendvoiceprompt?sdkappid=1400021400&random=123
  8 +qcloud_sms_url=https://yun.tim.qq.com/v3/tlssmssvr/sendmultisms2?sdkappid=1400021400&random=124
  9 +qcloud_sms_key=6e56f948f6f1
20 10
21 -java_service_alarm_mobile=18614066537  
22 java_service_alarm_flag=true 11 java_service_alarm_flag=true
23 java_service_alarm_cost_threshold=150 12 java_service_alarm_cost_threshold=150
24 java_service_alarm_count_threshold=50 13 java_service_alarm_count_threshold=50
25 14
26 -java_api_error=15905144483  
27 -  
28 -  
29 SWITCH_DB_URL=http://127.0.0.1:8011/switchdb/switchMysql 15 SWITCH_DB_URL=http://127.0.0.1:8011/switchdb/switchMysql