diff --git a/monitor-service-switch/src/main/java/com/monitor/switchs/projectRestart/service/impl/JavaProjectStatusLoaderTask.java b/monitor-service-switch/src/main/java/com/monitor/switchs/projectRestart/service/impl/JavaProjectStatusLoaderTask.java index f797ec0..e1e409f 100644 --- a/monitor-service-switch/src/main/java/com/monitor/switchs/projectRestart/service/impl/JavaProjectStatusLoaderTask.java +++ b/monitor-service-switch/src/main/java/com/monitor/switchs/projectRestart/service/impl/JavaProjectStatusLoaderTask.java @@ -115,10 +115,11 @@ public class JavaProjectStatusLoaderTask { public String checkService(String ip, String projectName) { String servicePort = getServicePort(projectName, "service"); - if (StringUtils.isBlank(servicePort) || StringUtils.isBlank(ip)) { + String projectHttpName = getServicePort(projectName, "http"); + if (StringUtils.isBlank(servicePort) || StringUtils.isBlank(ip)||StringUtils.isBlank(projectHttpName)) { return "2"; } - String url = "http://" + ip + ":" + servicePort + "/" + projectName + "/common/ok.jsp"; + String url = "http://" + ip + ":" + servicePort + "/" + projectHttpName + "/common/ok.jsp"; String myResponse = httpRestClient.get(url, null, String.class); if (Objects.nonNull(myResponse) || myResponse.contains("Resources ok")) return "1"; @@ -128,59 +129,62 @@ public class JavaProjectStatusLoaderTask { public String getServicePort(String serviceName, String type) { Map<String, String> context_port_map = new HashMap<>(); - context_port_map.put("yoho-users", "8081,9001"); - context_port_map.put("yoho-sns", "8082,9602"); - context_port_map.put("yohobuy-product", "8083,9603"); - context_port_map.put("yohobuy-order", "8084,9604"); - context_port_map.put("yohobuy-promotion", "8085,9605"); - context_port_map.put("yoho-message", "8086,9606"); - context_port_map.put("yohobuy-resources", "8087,9607"); - context_port_map.put("yohobuy-platform", "8088,9608"); - context_port_map.put("yohobuy-union", "8088,0000"); - context_port_map.put("yohobuy-activity", "8090,0000"); - context_port_map.put("yohobuy-bigdata", "8091,0000"); - context_port_map.put("yohobuy-brower", "8092,9612"); - context_port_map.put("yohobuy-crm", "8093,9623"); - context_port_map.put("yohobuy-wechat", "8094,9614"); - context_port_map.put("yoho-social", "8095,9615"); - context_port_map.put("uic", "8096,9616"); - context_port_map.put("yohobuy-risk", "8097,0000"); + context_port_map.put("yoho-users", "8081,9001,users"); + context_port_map.put("yoho-sns", "8082,9602,sns"); + context_port_map.put("yohobuy-product", "8083,9603,product"); + context_port_map.put("yohobuy-order", "8084,9604,order"); + context_port_map.put("yohobuy-promotion", "8085,9605,promotion"); + context_port_map.put("yoho-message", "8086,9606,message"); + context_port_map.put("yohobuy-resources", "8087,9607,resources"); + context_port_map.put("yohobuy-platform", "8088,9608,platform"); + context_port_map.put("yohobuy-union", "8088,0000,union"); + context_port_map.put("yohobuy-activity", "8090,0000,activity"); + context_port_map.put("yohobuy-bigdata", "8091,0000,bigdata"); + context_port_map.put("yohobuy-brower", "8092,9612,brower"); + context_port_map.put("yohobuy-crm", "8093,9623,crm"); + context_port_map.put("yohobuy-wechat", "8094,9614,wechat"); + context_port_map.put("yoho-social", "8095,9615,social"); + context_port_map.put("uic", "8096,9616,uic"); + context_port_map.put("yohobuy-risk", "8097,0000,risk"); context_port_map.put("pfpromotion", "8098,0000"); - context_port_map.put("platform-cms", "8099,9609"); + context_port_map.put("platform-cms", "8099,9609,pfcms"); context_port_map.put("pfproduct", "8100,0000"); context_port_map.put("pfmaketing", "8101,0000"); context_port_map.put("pfseller", "8102,0000"); - context_port_map.put("ufoPlatform", "8088,9608"); - context_port_map.put("ufo-gateway", "8080,9600"); - - context_port_map.put("yoho-push", "8089,9629"); - context_port_map.put("yoho-inbox", "8062,9622"); - context_port_map.put("yoho-msgcenter-wechat", "8061,8161"); - - context_port_map.put("yoho-reviewed", "8063,9623"); - context_port_map.put("yoho-erp-gateway", "8080,9609"); - context_port_map.put("yoho-gateway", "8080,9600"); - context_port_map.put("cms_push", "8089,0000"); - context_port_map.put("yohobuy-task", "8084,9604"); - context_port_map.put("yoho-message-controller", "8086,9627"); - context_port_map.put("yoho-message-sender", "8086,9625"); - context_port_map.put("yoho-search-consumer", "8088,9608"); - context_port_map.put("yoho-search-producer", "8089,9609"); - context_port_map.put("yoho-search-adaptor", "8085,0000"); - context_port_map.put("yohomars-search-service", "8080,9900"); + context_port_map.put("ufoPlatform", "8088,9608,ufoPlatform"); + context_port_map.put("ufo-gateway", "8080,9600,ufo-gateway"); + + context_port_map.put("yoho-push", "8089,9629,push"); + context_port_map.put("yoho-inbox", "8062,9622,inbox"); + context_port_map.put("yoho-msgcenter-wechat", "8061,8161,msgcenter-wechat"); + + context_port_map.put("yoho-reviewed", "8063,9623,reviewed"); + context_port_map.put("yoho-erp-gateway", "8080,9609,erp-gateway"); + context_port_map.put("yoho-gateway", "8080,9600,gateway"); + context_port_map.put("cms_push", "8089,0000,cms_push"); + context_port_map.put("yohobuy-task", "8084,9604,task"); + context_port_map.put("yoho-message-controller", "8086,9627,yoho-message-controller"); + context_port_map.put("yoho-message-sender", "8086,9625,yoho-message-sender"); + context_port_map.put("yoho-search-consumer", "8088,9608,search-consumer"); + context_port_map.put("yoho-search-producer", "8089,9609,search-producer"); + context_port_map.put("yoho-search-adaptor", "8085,0000,yoho-search-adaptor"); + context_port_map.put("yohomars-search-service", "8080,9900,yohosearch"); String port = ""; if (context_port_map.containsKey(serviceName)) { String ports = context_port_map.get(serviceName); - if ("service".equals(type) && ports.split(",").length > 1) { + if ("service".equals(type) && ports.split(",").length > 2) { port = ports.split(",")[0]; } - if ("jmx".equals(type) && ports.split(",").length > 1) { + if ("jmx".equals(type) && ports.split(",").length > 2) { if (!"0000".equals(ports.split(",")[1])) port = ports.split(",")[1]; } + if ("http".equals(type) && ports.split(",").length > 2) { + port = ports.split(",")[2]; + } } return port; }