Authored by linlong

Merge branch 'dev_memcache' of git.yoho.cn:ops/monitor-service into dev_memcache

# By jack.xue
# Via jack.xue
* 'dev_memcache' of git.yoho.cn:ops/monitor-service:
  增加异常捕获范围
  增加logger
  延迟
  rabbit 数据暂不写入influxdb
@@ -57,7 +57,7 @@ public interface InterVar { @@ -57,7 +57,7 @@ public interface InterVar {
57 57
58 String DBTAG = "moId"; 58 String DBTAG = "moId";
59 59
60 - int MONIT_TIMEOUT = 30; 60 + int MONIT_TIMEOUT = 60;
61 61
62 String RETENTION_POLICY = "default"; 62 String RETENTION_POLICY = "default";
63 63
@@ -34,6 +34,8 @@ public class ClusterViewJob implements Callable { @@ -34,6 +34,8 @@ public class ClusterViewJob implements Callable {
34 } 34 }
35 35
36 public void doTask() { 36 public void doTask() {
  37 + DEBUG.info("Start to execute cluster view job in moid {}", this.moId);
  38 +
37 MObjectInfo moInfo = InterVar.moMaps.get(moId); 39 MObjectInfo moInfo = InterVar.moMaps.get(moId);
38 40
39 String url = MessageFormat.format(InterVar.URLFORMAT, moInfo.getMoHostIp(), InterVar.port) + InterVar.NODES_URL; 41 String url = MessageFormat.format(InterVar.URLFORMAT, moInfo.getMoHostIp(), InterVar.port) + InterVar.NODES_URL;
@@ -67,10 +69,12 @@ public class ClusterViewJob implements Callable { @@ -67,10 +69,12 @@ public class ClusterViewJob implements Callable {
67 69
68 if (null != oneView) { 70 if (null != oneView) {
69 71
70 - influxComp.doWriteView(oneView,InterVar.DBNAME); 72 + /* influxComp.doWriteView(oneView,InterVar.DBNAME);*/
71 73
72 InterVar.clusterViewMaps.put(moId, oneView); 74 InterVar.clusterViewMaps.put(moId, oneView);
73 } 75 }
  76 +
  77 + DEBUG.info("End to execute cluster view job in moid {}", this.moId);
74 } 78 }
75 79
76 @Override 80 @Override
@@ -41,6 +41,9 @@ public class OverViewJob implements Callable { @@ -41,6 +41,9 @@ public class OverViewJob implements Callable {
41 } 41 }
42 42
43 public void doTask() { 43 public void doTask() {
  44 +
  45 + DEBUG.info("Start to execute over view job in moid {}", this.moId);
  46 +
44 MObjectInfo moInfo = InterVar.moMaps.get(moId); 47 MObjectInfo moInfo = InterVar.moMaps.get(moId);
45 48
46 String url = MessageFormat.format(InterVar.URLFORMAT, moInfo.getMoHostIp(), InterVar.port) + InterVar.OVERVIEW_URL; 49 String url = MessageFormat.format(InterVar.URLFORMAT, moInfo.getMoHostIp(), InterVar.port) + InterVar.OVERVIEW_URL;
@@ -96,10 +99,12 @@ public class OverViewJob implements Callable { @@ -96,10 +99,12 @@ public class OverViewJob implements Callable {
96 99
97 if (null != oneView) { 100 if (null != oneView) {
98 101
99 - influxComp.doWriteView(oneView,InterVar.DBNAME); 102 + /*influxComp.doWriteView(oneView,InterVar.DBNAME);*/
100 103
101 InterVar.overViewMaps.put(moId, overViewModel); 104 InterVar.overViewMaps.put(moId, overViewModel);
102 } 105 }
  106 +
  107 + DEBUG.info("End to execute over view job in moid {}", this.moId);
103 } 108 }
104 109
105 @Override 110 @Override
@@ -58,6 +58,8 @@ public class QueueViewJob implements Callable { @@ -58,6 +58,8 @@ public class QueueViewJob implements Callable {
58 } 58 }
59 59
60 public void doTask() { 60 public void doTask() {
  61 + DEBUG.info("Start to execute queue view job in moid {}", this.moId);
  62 +
61 MObjectInfo moInfo = InterVar.moMaps.get(moId); 63 MObjectInfo moInfo = InterVar.moMaps.get(moId);
62 64
63 String url = MessageFormat.format(InterVar.URLFORMAT, moInfo.getMoHostIp(), InterVar.port) + InterVar.QUEUE_URL; 65 String url = MessageFormat.format(InterVar.URLFORMAT, moInfo.getMoHostIp(), InterVar.port) + InterVar.QUEUE_URL;
@@ -102,10 +104,12 @@ public class QueueViewJob implements Callable { @@ -102,10 +104,12 @@ public class QueueViewJob implements Callable {
102 104
103 if (null != oneView) { 105 if (null != oneView) {
104 106
105 - influxComp.doWriteView(oneView, InterVar.DBNAME); 107 + /*influxComp.doWriteView(oneView, InterVar.DBNAME);*/
106 108
107 InterVar.queueViewMaps.put(moId, oneView); 109 InterVar.queueViewMaps.put(moId, oneView);
108 } 110 }
  111 +
  112 + DEBUG.info("End to execute queue view job in moid {}", this.moId);
109 } 113 }
110 114
111 115
@@ -153,9 +157,8 @@ public class QueueViewJob implements Callable { @@ -153,9 +157,8 @@ public class QueueViewJob implements Callable {
153 } 157 }
154 158
155 //初始化 159 //初始化
156 - private void initQueueAlert(String moId, QueueInfo queueInfo)  
157 - {  
158 - RabbitAlertInfo alertInfo=new RabbitAlertInfo(); 160 + private void initQueueAlert(String moId, QueueInfo queueInfo) {
  161 + RabbitAlertInfo alertInfo = new RabbitAlertInfo();
159 162
160 alertInfo.setAlertHigh(200); 163 alertInfo.setAlertHigh(200);
161 164
@@ -62,10 +62,12 @@ public class TwemproxyTask extends Task { @@ -62,10 +62,12 @@ public class TwemproxyTask extends Task {
62 62
63 twemproxyInfo = new TwemproxyInfo(this.getIp(), this.getPort(), info); 63 twemproxyInfo = new TwemproxyInfo(this.getIp(), this.getPort(), info);
64 64
65 - } catch (IOException e) { 65 + } catch (Exception e) {
66 66
67 this.getAlarmMsgService().sendSms("Twemproxy", "Failed to query Twemproxy " + this.getUrl() + " monitor info.", this.getSnsMobileConfig().getBaseMobile()); 67 this.getAlarmMsgService().sendSms("Twemproxy", "Failed to query Twemproxy " + this.getUrl() + " monitor info.", this.getSnsMobileConfig().getBaseMobile());
68 68
  69 + DEBUG.error("Failed to query twemproxy {} monitor info...error {} ", this.getUrl(), e);
  70 +
69 return; 71 return;
70 } 72 }
71 73
@@ -138,7 +140,7 @@ public class TwemproxyTask extends Task { @@ -138,7 +140,7 @@ public class TwemproxyTask extends Task {
138 140
139 for (Map.Entry<String, Long> entry : twemproxyInfo.getRequestMap().entrySet()) { 141 for (Map.Entry<String, Long> entry : twemproxyInfo.getRequestMap().entrySet()) {
140 142
141 - taskService.submit(new RedisTask(entry.getKey(), entry.getValue(),this.getUrl(), this.getAlarmMsgService(), this.getSnsMobileConfig())); 143 + taskService.submit(new RedisTask(entry.getKey(), entry.getValue(), this.getUrl(), this.getAlarmMsgService(), this.getSnsMobileConfig()));
142 } 144 }
143 145
144 taskService.shutdown(); 146 taskService.shutdown();