...
|
...
|
@@ -4,13 +4,12 @@ import com.model.MObjectInfo; |
|
|
import com.model.RabbitAlertInfo;
|
|
|
import com.monitor.middleware.rabbitmq.component.InfluxComp;
|
|
|
import com.monitor.middleware.rabbitmq.constant.InterVar;
|
|
|
import com.monitor.middleware.rabbitmq.model.ClusterView;
|
|
|
import com.monitor.middleware.rabbitmq.model.OverView;
|
|
|
import com.monitor.middleware.rabbitmq.model.QueueInfo;
|
|
|
import com.monitor.middleware.rabbitmq.model.QueueView;
|
|
|
import com.monitor.middleware.rabbitmq.model.*;
|
|
|
import com.monitor.middleware.rabbitmq.model.http.FixRequest;
|
|
|
import com.monitor.middleware.rabbitmq.model.http.QueryRequest;
|
|
|
import com.monitor.middleware.rabbitmq.model.http.RabbitModel;
|
|
|
import com.monitor.model.domain.MObjectModel;
|
|
|
import com.monitor.model.page.PageResponse;
|
|
|
import com.monitor.model.response.BaseResponse;
|
|
|
import com.monitor.mysql.mapper.MObjectInfoMapper;
|
|
|
import com.monitor.mysql.mapper.RabbitAlertMapper;
|
...
|
...
|
@@ -57,29 +56,85 @@ public class RabbitmqService { |
|
|
@RequestMapping(value = "/cluster", method = RequestMethod.POST)
|
|
|
public BaseResponse queryCluster(@RequestBody QueryRequest request) {
|
|
|
|
|
|
BaseResponse response = new BaseResponse();
|
|
|
BaseResponse<PageResponse<NodeInfo>> baseResponse = new BaseResponse();
|
|
|
|
|
|
ClusterView oneView = InterVar.clusterViewMaps.get(Integer.parseInt(request.getMoId()));
|
|
|
|
|
|
if (null != oneView) {
|
|
|
response.setData(oneView.getClusterView());
|
|
|
|
|
|
List<NodeInfo> nodesList=oneView.getClusterView();
|
|
|
|
|
|
List<NodeInfo> selectedList = new ArrayList<>();
|
|
|
|
|
|
int start = (request.getCurrentPage() - 1) * request.getPageSize();
|
|
|
|
|
|
int end = (request.getCurrentPage() * request.getPageSize()) - 1;
|
|
|
|
|
|
int realCount = end < nodesList.size() ? request.getPageSize() : nodesList.size() - start;
|
|
|
|
|
|
for (int i = 0; i < realCount; i++) {
|
|
|
|
|
|
selectedList.add(nodesList.get(start + i));
|
|
|
}
|
|
|
|
|
|
PageResponse<NodeInfo> response = new PageResponse<>();
|
|
|
|
|
|
response.setCurrentPage(request.getCurrentPage());
|
|
|
|
|
|
response.setTotal(nodesList.size());
|
|
|
|
|
|
response.setPageSize(request.getPageSize());
|
|
|
|
|
|
response.setTotalPage(nodesList.size() / request.getPageSize() + 1);
|
|
|
|
|
|
response.setRows(selectedList);
|
|
|
|
|
|
baseResponse.setData(response);
|
|
|
}
|
|
|
return response;
|
|
|
return baseResponse;
|
|
|
}
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/queue", method = RequestMethod.POST)
|
|
|
public BaseResponse queryQueue(@RequestBody QueryRequest request) {
|
|
|
|
|
|
BaseResponse response = new BaseResponse();
|
|
|
BaseResponse<PageResponse<QueueInfo>> baseResponse = new BaseResponse();
|
|
|
|
|
|
QueueView queueView = InterVar.queueViewMaps.get(Integer.parseInt(request.getMoId()));
|
|
|
QueueView oneView = InterVar.queueViewMaps.get(Integer.parseInt(request.getMoId()));
|
|
|
|
|
|
if (null != queueView) {
|
|
|
response.setData(queueView.getQueueView());
|
|
|
if (null != oneView) {
|
|
|
|
|
|
List<QueueInfo> queuesList=oneView.getQueueView();
|
|
|
|
|
|
List<QueueInfo> selectedList = new ArrayList<>();
|
|
|
|
|
|
int start = (request.getCurrentPage() - 1) * request.getPageSize();
|
|
|
|
|
|
int end = (request.getCurrentPage() * request.getPageSize()) - 1;
|
|
|
|
|
|
int realCount = end < queuesList.size() ? request.getPageSize() : queuesList.size() - start;
|
|
|
|
|
|
for (int i = 0; i < realCount; i++) {
|
|
|
|
|
|
selectedList.add(queuesList.get(start + i));
|
|
|
}
|
|
|
|
|
|
PageResponse<QueueInfo> response = new PageResponse<>();
|
|
|
|
|
|
response.setCurrentPage(request.getCurrentPage());
|
|
|
|
|
|
response.setTotal(queuesList.size());
|
|
|
|
|
|
response.setPageSize(request.getPageSize());
|
|
|
|
|
|
response.setTotalPage(queuesList.size() / request.getPageSize() + 1);
|
|
|
|
|
|
response.setRows(selectedList);
|
|
|
|
|
|
baseResponse.setData(response);
|
|
|
}
|
|
|
|
|
|
return response;
|
|
|
return baseResponse;
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/allRabbitMq")
|
...
|
...
|
@@ -124,10 +179,13 @@ public class RabbitmqService { |
|
|
if (null != rabbitAlertMapper.queryAlertInfo(alertInfo)) {
|
|
|
|
|
|
rabbitAlertMapper.updateAlertInfo(alertInfo);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
rabbitAlertMapper.insertAlertInfo(alertInfo);
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
|