Authored by simba

Merge branch 'master' of http://git.yoho.cn/ops/monitor-ui

  1 +package com.ui.model.req;
  2 +
  3 +import lombok.Data;
  4 +
  5 +/**
  6 + * Created by yoho on 2016/7/1.
  7 + */
  8 +@Data
  9 +public class RabbitInfoReq extends PageRequest {
  10 +
  11 + String moId;
  12 +
  13 +}
@@ -2,8 +2,8 @@ package com.ui.ctrl; @@ -2,8 +2,8 @@ package com.ui.ctrl;
2 2
3 import com.ui.http.HttpRestClient; 3 import com.ui.http.HttpRestClient;
4 import com.ui.model.BaseResponse; 4 import com.ui.model.BaseResponse;
5 -import com.ui.model.req.MObjectInfoReq;  
6 import com.ui.model.req.RabbitAlertReq; 5 import com.ui.model.req.RabbitAlertReq;
  6 +import com.ui.model.req.RabbitInfoReq;
7 import org.springframework.beans.factory.annotation.Autowired; 7 import org.springframework.beans.factory.annotation.Autowired;
8 import org.springframework.web.bind.annotation.RequestMapping; 8 import org.springframework.web.bind.annotation.RequestMapping;
9 import org.springframework.web.bind.annotation.RestController; 9 import org.springframework.web.bind.annotation.RestController;
@@ -19,7 +19,7 @@ public class RabbitMonitorCtrl { @@ -19,7 +19,7 @@ public class RabbitMonitorCtrl {
19 HttpRestClient httpRestClient; 19 HttpRestClient httpRestClient;
20 20
21 @RequestMapping(value = "/overview") 21 @RequestMapping(value = "/overview")
22 - public BaseResponse queryOverView(MObjectInfoReq request) { 22 + public BaseResponse queryOverView(RabbitInfoReq request) {
23 23
24 BaseResponse response = httpRestClient.defaultPost("/middleware/rabbitmq/overview", request, BaseResponse.class); 24 BaseResponse response = httpRestClient.defaultPost("/middleware/rabbitmq/overview", request, BaseResponse.class);
25 25
@@ -28,7 +28,7 @@ public class RabbitMonitorCtrl { @@ -28,7 +28,7 @@ public class RabbitMonitorCtrl {
28 28
29 29
30 @RequestMapping(value = "/clusterView") 30 @RequestMapping(value = "/clusterView")
31 - public BaseResponse queryClusterView(MObjectInfoReq request) { 31 + public BaseResponse queryClusterView(RabbitInfoReq request) {
32 32
33 BaseResponse response = httpRestClient.defaultPost("/middleware/rabbitmq/cluster", request, BaseResponse.class); 33 BaseResponse response = httpRestClient.defaultPost("/middleware/rabbitmq/cluster", request, BaseResponse.class);
34 34
@@ -37,7 +37,7 @@ public class RabbitMonitorCtrl { @@ -37,7 +37,7 @@ public class RabbitMonitorCtrl {
37 37
38 38
39 @RequestMapping(value = "/queueView") 39 @RequestMapping(value = "/queueView")
40 - public BaseResponse queryQueueView(MObjectInfoReq request) { 40 + public BaseResponse queryQueueView(RabbitInfoReq request) {
41 41
42 BaseResponse response = httpRestClient.defaultPost("/middleware/rabbitmq/queue", request, BaseResponse.class); 42 BaseResponse response = httpRestClient.defaultPost("/middleware/rabbitmq/queue", request, BaseResponse.class);
43 43
@@ -46,7 +46,7 @@ public class RabbitMonitorCtrl { @@ -46,7 +46,7 @@ public class RabbitMonitorCtrl {
46 46
47 47
48 @RequestMapping(value = "/allRabbitMq") 48 @RequestMapping(value = "/allRabbitMq")
49 - public BaseResponse queryQueueAll(MObjectInfoReq request) { 49 + public BaseResponse queryQueueAll(RabbitInfoReq request) {
50 BaseResponse response = httpRestClient.defaultPost("/middleware/rabbitmq/allRabbitMq", request, BaseResponse.class); 50 BaseResponse response = httpRestClient.defaultPost("/middleware/rabbitmq/allRabbitMq", request, BaseResponse.class);
51 return response; 51 return response;
52 } 52 }
1 -monitor.service.url=http://127.0.0.1:8080/monitor  
  1 +monitor.service.url=http://127.0.0.1:8880/monitor
@@ -21,39 +21,46 @@ @@ -21,39 +21,46 @@
21 </encoder> 21 </encoder>
22 </appender> 22 </appender>
23 23
24 - <!-- WARN级别日志 appender -->  
25 <appender name="WARN" class="ch.qos.logback.core.rolling.RollingFileAppender"> 24 <appender name="WARN" class="ch.qos.logback.core.rolling.RollingFileAppender">
26 - <file>/Data/tomcat_logs/monitor/warn-log</file>  
27 - <!-- 过滤器,过滤掉 TRACE 和 DEBUG 和 INFO 级别的日志 --> 25 + <file>${catalina.home}/logs/warn.log</file>
28 <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> 26 <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
29 - <level>WARN</level> 27 + <level>ERROR</level>
30 </filter> 28 </filter>
31 <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> 29 <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
32 - <!-- 按天回滚 daily -->  
33 - <fileNamePattern>${catalina.home}/logs/%d{yyyy-MM-dd}/warn-log.log</fileNamePattern>  
34 - <!-- 日志最大的保存天数 --> 30 + <!-- daily rollover -->
  31 + <fileNamePattern>
  32 + ${catalina.home}/logs/warn.%d{yyyy-MM-dd}.%i.log.gz
  33 + </fileNamePattern>
  34 + <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
  35 + <!-- or whenever the file size reaches 100MB -->
  36 + <maxFileSize>${maxFileSize}</maxFileSize>
  37 + </timeBasedFileNamingAndTriggeringPolicy>
  38 + <!-- keep 30 days' worth of history -->
35 <maxHistory>${maxHistory}</maxHistory> 39 <maxHistory>${maxHistory}</maxHistory>
36 </rollingPolicy> 40 </rollingPolicy>
37 - <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">  
38 - <maxFileSize>${maxFileSize}</maxFileSize>  
39 - </triggeringPolicy>  
40 <encoder> 41 <encoder>
41 - <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern> 42 + <pattern>%-1relative - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{0}:%line -- %msg%n</pattern>
42 </encoder> 43 </encoder>
43 </appender> 44 </appender>
44 45
45 <!-- DEBUG级别日志 appender --> 46 <!-- DEBUG级别日志 appender -->
46 <appender name="DEBUG" class="ch.qos.logback.core.rolling.RollingFileAppender"> 47 <appender name="DEBUG" class="ch.qos.logback.core.rolling.RollingFileAppender">
47 - <file>/Data/tomcat_logs/monitor/debug-log</file> 48 + <file>${catalina.home}/logs/debug.log</file>
  49 + <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
  50 + <level>INFO</level>
  51 + </filter>
48 <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> 52 <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
49 <!-- 按天回滚 daily --> 53 <!-- 按天回滚 daily -->
50 - <fileNamePattern>${catalina.home}/logs/%d{yyyy-MM-dd}/debug-log.log</fileNamePattern> 54 + <fileNamePattern>
  55 + ${catalina.home}/logs/debug.%d{yyyy-MM-dd}.%i.log.gz
  56 + </fileNamePattern>
  57 + <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
  58 + <!-- or whenever the file size reaches 100MB -->
  59 + <maxFileSize>${maxFileSize}</maxFileSize>
  60 + </timeBasedFileNamingAndTriggeringPolicy>
51 <!-- 日志最大的历史 60天 --> 61 <!-- 日志最大的历史 60天 -->
52 <maxHistory>${maxHistory}</maxHistory> 62 <maxHistory>${maxHistory}</maxHistory>
53 </rollingPolicy> 63 </rollingPolicy>
54 - <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">  
55 - <maxFileSize>${maxFileSize}</maxFileSize>  
56 - </triggeringPolicy>  
57 <encoder> 64 <encoder>
58 <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern> 65 <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern>
59 </encoder> 66 </encoder>
1 $( 1 $(
2 - initRabbitSelect(),  
3 - updateOverView(),  
4 - updateClusterView(),  
5 - updateQueuesView() 2 + initRabbitSelect()
6 ); 3 );
7 4
8 function updateOverView(moId) { 5 function updateOverView(moId) {
9 -  
10 $.ajax({ 6 $.ajax({
11 url: contextPath + "rabbitmq/overview", 7 url: contextPath + "rabbitmq/overview",
12 type: "post", 8 type: "post",
@@ -18,16 +14,16 @@ function updateOverView(moId) { @@ -18,16 +14,16 @@ function updateOverView(moId) {
18 updateOverview(response); 14 updateOverview(response);
19 }, 15 },
20 error: function (e) { 16 error: function (e) {
21 -  
22 } 17 }
23 }); 18 });
24 } 19 }
25 20
26 function updateOverview(response) { 21 function updateOverview(response) {
27 22
  23 +
28 var div = document.getElementById("overviewDiv"); 24 var div = document.getElementById("overviewDiv");
29 25
30 - div.innerHTML=""; 26 + div.innerHTML = "";
31 27
32 var connections = $("<div>").addClass("micro-highlight").html("Connections:").appendTo(div); 28 var connections = $("<div>").addClass("micro-highlight").html("Connections:").appendTo(div);
33 29
@@ -63,13 +59,14 @@ function updateOverview(response) { @@ -63,13 +59,14 @@ function updateOverview(response) {
63 } 59 }
64 60
65 function updateClusterView(moId) { 61 function updateClusterView(moId) {
  62 +
66 $("#clusterViewTable").table( 63 $("#clusterViewTable").table(
67 { 64 {
68 url: contextPath + "rabbitmq/clusterView", 65 url: contextPath + "rabbitmq/clusterView",
69 - queryParams : { 66 + queryParams: {
70 moId: moId 67 moId: moId
71 }, //调用url传递的参数 68 }, //调用url传递的参数
72 - method : "POST", 69 + method: "POST",
73 striped: true, 70 striped: true,
74 panelClass: "panel-success", 71 panelClass: "panel-success",
75 pagination: true, 72 pagination: true,
@@ -159,10 +156,10 @@ function updateQueuesView(moId) { @@ -159,10 +156,10 @@ function updateQueuesView(moId) {
159 $("#queueViewTable").table( 156 $("#queueViewTable").table(
160 { 157 {
161 url: contextPath + "rabbitmq/queueView", 158 url: contextPath + "rabbitmq/queueView",
162 - queryParams : { 159 + method: "POST",
  160 + queryParams: {
163 moId: moId 161 moId: moId
164 }, //调用url传递的参数 162 }, //调用url传递的参数
165 - method : "POST",  
166 striped: true, 163 striped: true,
167 panelClass: "panel-success", 164 panelClass: "panel-success",
168 pagination: true, 165 pagination: true,
@@ -240,14 +237,14 @@ function updateQueuesView(moId) { @@ -240,14 +237,14 @@ function updateQueuesView(moId) {
240 237
241 function fixAlertHigh(rowData, rowIndex) { 238 function fixAlertHigh(rowData, rowIndex) {
242 239
243 -/* alert(rowIndex); 240 + /* alert(rowIndex);
244 alert(rowData.name); 241 alert(rowData.name);
245 alert($("#msg_alert_high_" + rowIndex + "").val());*/ 242 alert($("#msg_alert_high_" + rowIndex + "").val());*/
246 $.ajax({ 243 $.ajax({
247 url: contextPath + "rabbitmq/fixAlertHigh", 244 url: contextPath + "rabbitmq/fixAlertHigh",
248 type: "post", 245 type: "post",
249 dataType: "json", 246 dataType: "json",
250 - data:{ 247 + data: {
251 moId: $('#rabbitMqSelected option:selected').val(), 248 moId: $('#rabbitMqSelected option:selected').val(),
252 queueName: rowData.name, 249 queueName: rowData.name,
253 alertHigh: $("#msg_alert_high_" + rowIndex + "").val() 250 alertHigh: $("#msg_alert_high_" + rowIndex + "").val()
@@ -264,6 +261,10 @@ function initRabbitSelect() { @@ -264,6 +261,10 @@ function initRabbitSelect() {
264 success: function (response) { 261 success: function (response) {
265 //将查询到的数据,update到选择框中 262 //将查询到的数据,update到选择框中
266 genarateRabbitSelectOption(response.data); 263 genarateRabbitSelectOption(response.data);
  264 + updateOverView((response.data)[0].moId);
  265 + updateClusterView((response.data)[0].moId);
  266 + updateQueuesView((response.data)[0].moId);
  267 +
267 }, 268 },
268 error: function (e) { 269 error: function (e) {
269 } 270 }
@@ -285,17 +286,15 @@ function genarateRabbitSelectOption(optionList) { @@ -285,17 +286,15 @@ function genarateRabbitSelectOption(optionList) {
285 */ 286 */
286 function rabbitUpdateSelectOnChange() { 287 function rabbitUpdateSelectOnChange() {
287 var rabbitId = $('#rabbitMqSelected option:selected').val().replace(/\'/g, '\"'); 288 var rabbitId = $('#rabbitMqSelected option:selected').val().replace(/\'/g, '\"');
288 - updateOverView(rabbitId);  
289 - updateClusterView(rabbitId);  
290 - updateQueuesView(rabbitId);  
291 -}  
292 -  
293 289
294 -/*function updateTable() {  
295 - $("#queueViewTable").table("load", {moId: 135});  
296 -  
297 - $("#clusterViewTable").table("load", {moId: 135});  
298 - }*/ 290 + updateOverView(rabbitId);
299 291
  292 + $("#clusterViewTable").table("load", {
  293 + 'moId': rabbitId
  294 + });
  295 + $("#queueViewTable").table("load", {
  296 + 'moId': rabbitId
  297 + });
  298 +}
300 299
301 300
@@ -154,81 +154,6 @@ @@ -154,81 +154,6 @@
154 </div> 154 </div>
155 155
156 <script> 156 <script>
157 -  
158 - $(function () {  
159 - $.ajax({  
160 - url: "",  
161 - type: "post",  
162 - dataType: "json",  
163 - data: {  
164 - moId: paramObj.moId  
165 - },  
166 - success: function (data) {  
167 - updateViewTable(data);  
168 - }  
169 - });  
170 -  
171 - function updateViewTable(data) {  
172 -  
173 - var innerHTML = "";  
174 - for (var i = 0; i < orderMsgList.length; i++) {  
175 - innerHTML += "<tr><td>" + orderMsgList[i].influxTime + "</td>";  
176 - innerHTML += "<td>" + orderMsgList[i].isSend + "</td>";  
177 - innerHTML += "<td>" + orderMsgList[i].orderCode + "</td>";  
178 - innerHTML += "<td>" + orderMsgList[i].event + "</td></tr>";  
179 - }  
180 - document.getElementById('viewTable').getElementsByTagName("tbody")[0].innerHTML = innerHTML;  
181 - };  
182 -  
183 - $.ajax({  
184 - url: "",  
185 - type: "post",  
186 - dataType: "json",  
187 - data: {  
188 - moId: paramObj.moId  
189 - },  
190 - success: function (data) {  
191 - updateModelTable(data);  
192 - }  
193 - });  
194 -  
195 - function updateModelTable(data) {  
196 - var innerHTML = "";  
197 - for (var i = 0; i < orderMsgList.length; i++) {  
198 - innerHTML += "<tr><td>" + orderMsgList[i].influxTime + "</td>";  
199 - innerHTML += "<td>" + orderMsgList[i].isSend + "</td>";  
200 - innerHTML += "<td>" + orderMsgList[i].orderCode + "</td>";  
201 - innerHTML += "<td>" + orderMsgList[i].event + "</td></tr>";  
202 - }  
203 - document.getElementById('modelTable').getElementsByTagName("tbody")[0].innerHTML = innerHTML;  
204 - }  
205 - });  
206 -  
207 - $.ajax({  
208 - url: "",  
209 - type: "post",  
210 - dataType: "json",  
211 - data: {  
212 - moId: paramObj.moId  
213 - },  
214 - success: function (data) {  
215 - updateQueueTable(data);  
216 - }  
217 - });  
218 -  
219 - function updateQueueTable(data) {  
220 - var innerHTML = "";  
221 - for (var i = 0; i < orderMsgList.length; i++) {  
222 - innerHTML += "<tr><td>" + orderMsgList[i].influxTime + "</td>";  
223 - innerHTML += "<td>" + orderMsgList[i].isSend + "</td>";  
224 - innerHTML += "<td>" + orderMsgList[i].orderCode + "</td>";  
225 - innerHTML += "<td>" + orderMsgList[i].event + "</td></tr>";  
226 - }  
227 - document.getElementById('queueTable').getElementsByTagName("tbody")[0].innerHTML = innerHTML;  
228 - }  
229 - ;  
230 -  
231 -  
232 </script> 157 </script>
233 158
234 <script src="<%=basePath %>js/rabbit.js" type="text/javascript"></script> 159 <script src="<%=basePath %>js/rabbit.js" type="text/javascript"></script>