Index: pom.xml =================================================================== diff -u -rbdca99938000d6138d38a3de85fdc03b6d81b476 -r7bfac2dedf4ff4a333187f06154b3cb15686f715 --- pom.xml (.../pom.xml) (revision bdca99938000d6138d38a3de85fdc03b6d81b476) +++ pom.xml (.../pom.xml) (revision 7bfac2dedf4ff4a333187f06154b3cb15686f715) @@ -10,7 +10,7 @@ 4.0.0 313devgrp standard-project - 21.01.05 + 21.01.06 pom standard-project Index: web-module/pom.xml =================================================================== diff -u -rbdca99938000d6138d38a3de85fdc03b6d81b476 -r7bfac2dedf4ff4a333187f06154b3cb15686f715 --- web-module/pom.xml (.../pom.xml) (revision bdca99938000d6138d38a3de85fdc03b6d81b476) +++ web-module/pom.xml (.../pom.xml) (revision 7bfac2dedf4ff4a333187f06154b3cb15686f715) @@ -7,7 +7,7 @@ 313devgrp standard-project - 21.01.05 + 21.01.06 ../pom.xml Index: web-module/src/main/java/egovframework/api/arms/devicelist/service/DeviceListService.java =================================================================== diff -u -r9fadf60d728e3c03ff2588003f7f93296f04862f -r7bfac2dedf4ff4a333187f06154b3cb15686f715 --- web-module/src/main/java/egovframework/api/arms/devicelist/service/DeviceListService.java (.../DeviceListService.java) (revision 9fadf60d728e3c03ff2588003f7f93296f04862f) +++ web-module/src/main/java/egovframework/api/arms/devicelist/service/DeviceListService.java (.../DeviceListService.java) (revision 7bfac2dedf4ff4a333187f06154b3cb15686f715) @@ -15,7 +15,7 @@ //차집합을 통해 디비에 등록할 리스트를 추린다. //추려진 데이터를 jstree method api를 통해 업데이트 한다. - public List getDeviceListsFromJstree () throws Exception; + public List getAllDeviceListsFromJstree () throws Exception; public List getDeviceListsFromELK () throws Exception; public List getDeviceListDifference (List jstreeDeviceList, List elkDeviceLists) throws Exception; public Integer updateDeviceListToJstree () throws Exception; Index: web-module/src/main/java/egovframework/api/arms/devicelist/service/DeviceListServiceImpl.java =================================================================== diff -u -r5a042afd5c244df961489cf64d5c3009059131bd -r7bfac2dedf4ff4a333187f06154b3cb15686f715 --- web-module/src/main/java/egovframework/api/arms/devicelist/service/DeviceListServiceImpl.java (.../DeviceListServiceImpl.java) (revision 5a042afd5c244df961489cf64d5c3009059131bd) +++ web-module/src/main/java/egovframework/api/arms/devicelist/service/DeviceListServiceImpl.java (.../DeviceListServiceImpl.java) (revision 7bfac2dedf4ff4a333187f06154b3cb15686f715) @@ -3,6 +3,7 @@ import egovframework.api.arms.devicelist.vo.DeviceListDTO; import egovframework.com.cmm.service.EgovProperties; import egovframework.com.ext.jstree.springHibernate.core.service.JsTreeHibernateServiceImpl; +import egovframework.com.ext.jstree.support.util.StringUtils; import org.apache.http.client.HttpClient; import org.apache.http.impl.client.HttpClientBuilder; import org.hibernate.criterion.Order; @@ -38,7 +39,7 @@ @Override - public List getDeviceListsFromJstree() throws Exception { + public List getAllDeviceListsFromJstree() throws Exception { DeviceListDTO jsTreeHibernateDTO = new DeviceListDTO(); jsTreeHibernateDTO.setOrder(Order.asc("c_id")); @@ -76,8 +77,7 @@ logger.info(bucketJson); DeviceListDTO deviceListDTO = new DeviceListDTO(); - deviceListDTO.setC_title(bucketJson); - deviceListDTO.setC_monitor_device_hostname(bucketJson); + deviceListDTO.setC_monitor_url_scouter(bucketJson); //포지션 잡아야 함 deviceListDTOs.add(deviceListDTO); } @@ -114,6 +114,12 @@ DeviceListDTO deviceListDTO = new DeviceListDTO(); deviceListDTO.setC_title(insertTargetDeviceHost); deviceListDTO.setC_monitor_device_hostname(insertTargetDeviceHost); + deviceListDTO.setC_monitor_url_apm(insertTargetDeviceHost); + deviceListDTO.setC_monitor_url_filebeat(insertTargetDeviceHost); + deviceListDTO.setC_monitor_url_heartbeat(insertTargetDeviceHost); + deviceListDTO.setC_monitor_url_metricbeat(insertTargetDeviceHost); + deviceListDTO.setC_monitor_url_packetbeat(insertTargetDeviceHost); + deviceListDTO.setC_monitor_url_topbeat(insertTargetDeviceHost); deviceListDTO.setC_parentid(new Long(2)); deviceListDTO.setRef(new Long(2)); deviceListDTO.setC_type("default"); @@ -128,30 +134,46 @@ @Transactional(rollbackFor = { Exception.class }, propagation = Propagation.REQUIRED) public Integer updateDeviceListToJstree() throws Exception { + //1. 기존의 디비에서 getDeviceListsFromInfluxDB 를 대입해 업데이트 한다. //database jstree method 를 활용하여 full list를 얻어온다. -> 디비에 등록된 host full list - List deviceListsFromJstree = getDeviceListsFromJstree(); + List deviceListsFromJstree = getAllDeviceListsFromJstree(); //elasticsearch api 를 활용해서 full list 를 얻어온다. -> ELK에 등록된 host full list List deviceListsFromELK = getDeviceListsFromELK(); - //influxdb api 를 활용해서 full list 를 얻어온다 -> InfluxDB에 등록된 host full list - List deviceListsFromInfluxDB = getDeviceListsFromInfluxDB(); - //차집합을 통해 디비에 등록할 리스트를 추린다. List differenceUpdateSet = getDeviceListDifference(deviceListsFromJstree, deviceListsFromELK); for (DeviceListDTO deviceListDTO: differenceUpdateSet) { this.addNode(deviceListDTO); } - //차집합을 통해 디비에 등록할 리스트를 추린다. - List diffUpdateSet = getDeviceListDifference(deviceListsFromJstree, deviceListsFromInfluxDB); - for (DeviceListDTO deviceListDTO: diffUpdateSet) { - this.addNode(deviceListDTO); + //influxdb api 를 활용해서 full list 를 얻어온다 -> InfluxDB에 등록된 host full list + List deviceListsFromInfluxDB = getDeviceListsFromInfluxDB(); + + for ( DeviceListDTO jstreeDeviceDTO : deviceListsFromJstree ) { + + String deviceHostStr = jstreeDeviceDTO.getC_monitor_device_hostname(); + + for ( DeviceListDTO influxdbDeviceDTO : deviceListsFromInfluxDB ){ + String deviceScouterStr = influxdbDeviceDTO.getC_monitor_url_scouter(); + + if(StringUtils.contains(deviceScouterStr, deviceHostStr)){ + jstreeDeviceDTO.setC_monitor_url_scouter(deviceScouterStr); + jstreeDeviceDTO.setC_monitor_url_apm(deviceHostStr); + jstreeDeviceDTO.setC_monitor_url_filebeat(deviceHostStr); + jstreeDeviceDTO.setC_monitor_url_heartbeat(deviceHostStr); + jstreeDeviceDTO.setC_monitor_url_metricbeat(deviceHostStr); + jstreeDeviceDTO.setC_monitor_url_packetbeat(deviceHostStr); + jstreeDeviceDTO.setC_monitor_url_topbeat(deviceHostStr); + this.alterNode(jstreeDeviceDTO); + } + } + } - return differenceUpdateSet.size() + diffUpdateSet.size(); + return differenceUpdateSet.size(); } public JSONArray getInfoFromELK() throws Exception {