유량제어 현황 모니터링 기능 추가
This commit is contained in:
+8
@@ -85,4 +85,12 @@ public class InflowAdapterControlManController extends OnlBaseAnnotationControll
|
||||
return new ModelAndView("jsonView", resultMap);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/onl/admin/inflow/inflowAdapterControlMan.json", params = "cmd=LIST_BUCKET_STATUS")
|
||||
public ModelAndView getBucketStatus(HttpServletRequest request, HttpServletResponse response) {
|
||||
List<Map<String, Object>> statusList = service.getAdapterBucketStatus();
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
resultMap.put("servers", statusList);
|
||||
return new ModelAndView("jsonView", resultMap);
|
||||
}
|
||||
|
||||
}
|
||||
+8
@@ -83,4 +83,12 @@ public class InflowClientControlManController extends OnlBaseAnnotationControlle
|
||||
return new ModelAndView("jsonView", resultMap);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/onl/admin/inflow/inflowClientControlMan.json", params = "cmd=LIST_BUCKET_STATUS")
|
||||
public ModelAndView getBucketStatus(HttpServletRequest request, HttpServletResponse response) {
|
||||
List<Map<String, Object>> statusList = service.getClientBucketStatus();
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
resultMap.put("servers", statusList);
|
||||
return new ModelAndView("jsonView", resultMap);
|
||||
}
|
||||
|
||||
}
|
||||
+75
@@ -1,12 +1,21 @@
|
||||
package com.eactive.eai.rms.onl.manage.inflow.inflow;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import com.eactive.eai.data.entity.onl.inflow.InflowControl;
|
||||
import com.eactive.eai.data.entity.onl.inflow.InflowControlId;
|
||||
@@ -14,10 +23,13 @@ import com.eactive.eai.rms.common.base.BaseService;
|
||||
import com.eactive.eai.rms.common.combo.ComboService;
|
||||
import com.eactive.eai.rms.data.entity.onl.inflow.InflowControlService;
|
||||
import com.eactive.eai.rms.data.entity.onl.inflow.InflowControlServiceDto;
|
||||
import com.eactive.eai.rms.onl.common.service.EaiServerInfoService;
|
||||
|
||||
@Service
|
||||
public class InflowControlManService extends BaseService {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(InflowControlManService.class);
|
||||
|
||||
private static final String ADAPTER_TYPE_INFLOW = "01";
|
||||
private static final String INTERFACE_TYPE_INFLOW = "02";
|
||||
private static final String CLIENT_TYPE_INFLOW = "03";
|
||||
@@ -32,6 +44,11 @@ public class InflowControlManService extends BaseService {
|
||||
@Autowired
|
||||
private InflowControlManMapper mapper;
|
||||
|
||||
@Autowired
|
||||
private EaiServerInfoService eaiServerInfoService;
|
||||
|
||||
private RestTemplate restTemplate = new RestTemplate();
|
||||
|
||||
// 어댑터 유량제어
|
||||
public Page<InflowControlManUI> selectAdapterList(Pageable pageable, String searchName) {
|
||||
Page<InflowControlServiceDto> dtoList = service.findAllForAdapter(pageable, searchName);
|
||||
@@ -123,6 +140,64 @@ public class InflowControlManService extends BaseService {
|
||||
InflowControlId id = toId(CLIENT_TYPE_INFLOW, name);
|
||||
service.findById(id).ifPresent(service::delete);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<Map<String, Object>> getClientBucketStatus() {
|
||||
return getBucketStatus("client", "클라이언트가 로드되지 않음", "클라이언트 버킷 상태 조회 실패");
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<Map<String, Object>> getAdapterBucketStatus() {
|
||||
return getBucketStatus("adapter", "어댑터가 로드되지 않음", "어댑터 버킷 상태 조회 실패");
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<Map<String, Object>> getInterfaceBucketStatus() {
|
||||
return getBucketStatus("interface", "인터페이스가 로드되지 않음", "인터페이스 버킷 상태 조회 실패");
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private List<Map<String, Object>> getBucketStatus(String type, String noDataMessage, String logPrefix) {
|
||||
List<Map<String, Object>> result = new ArrayList<>();
|
||||
List<Map<String, String>> serverList = eaiServerInfoService.getEaiServerIpList();
|
||||
|
||||
for (Map<String, String> server : serverList) {
|
||||
String serverName = server.get("EAISVRINSTNM");
|
||||
String serverIp = server.get("EAISVRIP");
|
||||
String serverPort = server.get("WEBSERVERPORT");
|
||||
|
||||
if (StringUtils.isEmpty(serverPort)) {
|
||||
serverPort = server.get("EAISVRLSNPORT");
|
||||
}
|
||||
|
||||
Map<String, Object> serverStatus = new HashMap<>();
|
||||
serverStatus.put("serverName", serverName);
|
||||
serverStatus.put("serverIp", serverIp);
|
||||
serverStatus.put("serverPort", serverPort);
|
||||
|
||||
try {
|
||||
String url = String.format("http://%s:%s/manage/inflow/%s/bucket-status",
|
||||
serverIp, serverPort, type);
|
||||
ResponseEntity<Map> response = restTemplate.getForEntity(url, Map.class);
|
||||
|
||||
if (response.getBody() != null && Boolean.TRUE.equals(response.getBody().get("success"))) {
|
||||
serverStatus.put("status", "online");
|
||||
serverStatus.put("data", response.getBody().get("data"));
|
||||
} else {
|
||||
serverStatus.put("status", "no_data");
|
||||
serverStatus.put("message", noDataMessage);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.warn("{} - server: {}, error: {}", logPrefix, serverName, e.getMessage());
|
||||
serverStatus.put("status", "offline");
|
||||
serverStatus.put("message", "서버 연결 실패");
|
||||
}
|
||||
|
||||
result.add(serverStatus);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
private InflowControlId toId(InflowControlManUI ui) {
|
||||
|
||||
+8
@@ -83,4 +83,12 @@ public class InflowInterfaceControlManController extends OnlBaseAnnotationContro
|
||||
return new ModelAndView("jsonView", resultMap);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/onl/admin/inflow/inflowInterfaceControlMan.json", params = "cmd=LIST_BUCKET_STATUS")
|
||||
public ModelAndView getBucketStatus(HttpServletRequest request, HttpServletResponse response) {
|
||||
List<Map<String, Object>> statusList = service.getInterfaceBucketStatus();
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
resultMap.put("servers", statusList);
|
||||
return new ModelAndView("jsonView", resultMap);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user