Merge remote-tracking branch 'z-eactive/feature/modern-dashboard' into devs/dashboard
This commit is contained in:
@@ -13,6 +13,8 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import com.eactive.eai.data.entity.onl.server.EAIServer;
|
||||
import com.eactive.eai.rms.common.context.MonitoringContext;
|
||||
import com.eactive.eai.rms.common.datasource.DataSourceContextHolder;
|
||||
import com.eactive.eai.rms.common.datasource.DataSourceTypeManager;
|
||||
import com.eactive.eai.rms.data.entity.onl.server.EAIServerService;
|
||||
import com.eactive.eai.rms.onl.common.dao.ServerInfoDAO;
|
||||
|
||||
@@ -62,6 +64,12 @@ public class EaiServerInfoServiceImpl implements EaiServerInfoService {
|
||||
}
|
||||
|
||||
public List<Map<String, String>> getEaiServerIpListDB() {
|
||||
// BAP인 경우 TSEAIBP03 테이블을 사용
|
||||
if (DataSourceContextHolder.getDataSourceType() != null
|
||||
&& DataSourceTypeManager.BAP.equals(DataSourceContextHolder.getDataSourceType().getName())) {
|
||||
return getBapServerIpList();
|
||||
}
|
||||
|
||||
List<EAIServer> serverList = eaiServerService.selectEaiServerIpList();
|
||||
|
||||
if (logger.isDebugEnabled()) {
|
||||
|
||||
@@ -77,53 +77,39 @@ public class OnlAgentUtilServiceImpl implements AgentUtilService {
|
||||
**/
|
||||
private List<Map<String, String>> getAllSvrUrl() throws Exception {
|
||||
|
||||
String agentMode = propertyService.getPrpty2valById("RMIInfo", "agent.mode");
|
||||
// K8S 로직 비활성화 - propertyService.getPrpty2valById 호출로 인한 오류 방지
|
||||
List<EAIServer> list = eaiServerService.selectEaiServerIpList();
|
||||
List<Map<String, String>> urlLists = new ArrayList<>();
|
||||
|
||||
if (agentMode != null && "K8S".equalsIgnoreCase(agentMode)) {
|
||||
String namespace = propertyService.getPrpty2valById("RMIInfo", "kubernetes_namespace");
|
||||
String serviceName = propertyService.getPrpty2valById("RMIInfo", "kubernetes_servicename");
|
||||
String sPort = propertyService.getPrpty2valById("RMIInfo", "kubernetes_serviceport");
|
||||
int port = 8080;
|
||||
try {
|
||||
port = Integer.parseInt(sPort);
|
||||
}catch(Exception e) {
|
||||
|
||||
}
|
||||
return K8sUtil.getServerInfoByK8sUrl(namespace, serviceName, port, SERVLET_URL);
|
||||
}else {
|
||||
List<EAIServer> list = eaiServerService.selectEaiServerIpList();
|
||||
List<Map<String, String>> urlLists = new ArrayList<>();
|
||||
String svrName = "";
|
||||
String svrIp = "";
|
||||
String svrPort = "";
|
||||
String cloudrouterurl = "";
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
Map<String,String> infoMap = new HashMap<>();
|
||||
EAIServer map = list.get(i);
|
||||
svrName = map.getEaisevrinstncname();
|
||||
svrIp = map.getEaisevrip();
|
||||
svrPort = map.getSevrlsnportname();
|
||||
cloudrouterurl = map.getCloudrouterurl();
|
||||
if (!("ALL".equalsIgnoreCase(svrName))) {
|
||||
StringBuffer urlBuf = new StringBuffer();
|
||||
urlBuf.append("http://");
|
||||
if(StringUtils.isNotBlank(cloudrouterurl)) {
|
||||
urlBuf.append(cloudrouterurl);
|
||||
infoMap.put(FIELD_IS_CLOUD_PROXY, "true");
|
||||
infoMap.put(FIELD_INTERNAL_URL, "http://" + svrIp + ":" + svrPort + SERVLET_URL);
|
||||
}else {
|
||||
urlBuf.append(svrIp + ":" + svrPort);
|
||||
}
|
||||
urlBuf.append(SERVLET_URL);
|
||||
|
||||
String svrName = "";
|
||||
String svrIp = "";
|
||||
String svrPort = "";
|
||||
String cloudrouterurl = "";
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
Map<String,String> infoMap = new HashMap<>();
|
||||
EAIServer map = list.get(i);
|
||||
svrName = map.getEaisevrinstncname();
|
||||
svrIp = map.getEaisevrip();
|
||||
svrPort = map.getSevrlsnportname();
|
||||
cloudrouterurl = map.getCloudrouterurl();
|
||||
if (!("ALL".equalsIgnoreCase(svrName))) {
|
||||
StringBuffer urlBuf = new StringBuffer();
|
||||
urlBuf.append("http://");
|
||||
if(StringUtils.isNotBlank(cloudrouterurl)) {
|
||||
urlBuf.append(cloudrouterurl);
|
||||
infoMap.put(FIELD_IS_CLOUD_PROXY, "true");
|
||||
infoMap.put(FIELD_INTERNAL_URL, "http://" + svrIp + ":" + svrPort + SERVLET_URL);
|
||||
}else {
|
||||
urlBuf.append(svrIp + ":" + svrPort);
|
||||
}
|
||||
urlBuf.append(SERVLET_URL);
|
||||
|
||||
infoMap.put(FIELD_URL, urlBuf.toString());
|
||||
infoMap.put(FIELD_INST_NAME, svrName);
|
||||
urlLists.add(infoMap);
|
||||
}
|
||||
}
|
||||
return urlLists;
|
||||
}
|
||||
infoMap.put(FIELD_URL, urlBuf.toString());
|
||||
infoMap.put(FIELD_INST_NAME, svrName);
|
||||
urlLists.add(infoMap);
|
||||
}
|
||||
}
|
||||
return urlLists;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+5
-19
@@ -124,29 +124,15 @@ public class ModernDashboardController {
|
||||
// 서버 컨텍스트 설정
|
||||
DataSourceContextHolder.setDataSourceType(serverType);
|
||||
|
||||
String agentMode = propertyService.getPrpty2valById("RMIInfo", "agent.mode");
|
||||
if( agentMode == null || agentMode.isEmpty() ){
|
||||
agentMode = "";
|
||||
}
|
||||
|
||||
// 호스트명으로 인스턴스 그룹화
|
||||
Map<String, List<Map<String, String>>> instancesByHost = new HashMap<String, List<Map<String, String>>>();
|
||||
|
||||
if( "K8S".equals(agentMode) ){
|
||||
List<Map<String, String>> hostList = dashboard2Repository.getDatasourceByHost(serverType.getName());
|
||||
// 서버에 대한 인스턴스 목록 조회
|
||||
List<Map<String, String>> ipList = eaiServerInfoService.getEaiServerIpListDB();
|
||||
|
||||
for (Map<String, String> instance : hostList) {
|
||||
String hostname = instance.get("HOSTNAME");
|
||||
instancesByHost.computeIfAbsent(hostname, k -> new ArrayList<>()).add(instance);
|
||||
}
|
||||
} else {
|
||||
// 서버에 대한 인스턴스 목록 조회
|
||||
List<Map<String, String>> ipList = eaiServerInfoService.getEaiServerIpListDB();
|
||||
|
||||
for (Map<String, String> instance : ipList) {
|
||||
String hostname = instance.get("HOSTNAME");
|
||||
instancesByHost.computeIfAbsent(hostname, k -> new ArrayList<>()).add(instance);
|
||||
}
|
||||
for (Map<String, String> instance : ipList) {
|
||||
String hostname = instance.get("HOSTNAME");
|
||||
instancesByHost.computeIfAbsent(hostname, k -> new ArrayList<>()).add(instance);
|
||||
}
|
||||
|
||||
// 각 호스트별로 서버 상태 DTO 생성
|
||||
|
||||
+2
-14
@@ -64,20 +64,8 @@ public class Dashboard2RepositoryService {
|
||||
|
||||
@PostConstruct
|
||||
public void init(){
|
||||
// K8S 사용 여부에 따라 값을 분기 처리
|
||||
// 온라인 데이터 소스의 첫번째 값으로 SET
|
||||
for(DataSourceType dataSourceType : DataSourceTypeManager.getOnlineDataSourceTypes()){
|
||||
DataSourceContextHolder.setDataSourceType(DataSourceTypeManager.getDataSourceType(dataSourceType.getName()));
|
||||
this.agentMode = propertyService.getPrpty2valById("RMIInfo", "agent.mode");
|
||||
if( this.agentMode == null || this.agentMode.isEmpty() ){
|
||||
this.agentMode = "";
|
||||
}
|
||||
|
||||
if( "K8S".equals(this.agentMode) ){
|
||||
this.initDashboardHostInstNames(false, null);
|
||||
}
|
||||
break;
|
||||
}
|
||||
// K8S 관련 로직 비활성화. DB 조회로 인한 오류를 막기 위해 agentMode를 항상 ""로 설정
|
||||
this.agentMode = "";
|
||||
}
|
||||
|
||||
public void initTargetService() {
|
||||
|
||||
Reference in New Issue
Block a user