Authored by jimi

add

... ... @@ -8,6 +8,8 @@ import com.monitor.model.response.BaseResponse;
import com.monitor.switchs.SwitchCmdUtil;
import com.monitor.switchs.projectRestart.common.IpStatus;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.stereotype.Component;
... ... @@ -30,6 +32,8 @@ import java.util.concurrent.ConcurrentHashMap;
public class JavaProjectStatusLoaderTask {
@Autowired
private HttpRestClientService httpRestClient;
private Logger log = LoggerFactory.getLogger(JavaProjectStatusLoaderTask.class);
private static final ConcurrentHashMap<String, List<JavaProjectStatus>> map = new ConcurrentHashMap();
private SimpleDateFormat sDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
... ... @@ -101,6 +105,7 @@ public class JavaProjectStatusLoaderTask {
public List<JavaProjectStatus> getStatusInfosByHttp(String projectName) {
List<JavaProjectStatus> javaProjectStatusList = new ArrayList<>();
List<String> projectIps = getProjectIps("qcloud", projectName);
log.info("JavaProjectStatusLoaderTask getStatusInfosByHttp project is {} and ips is {}",projectName,projectIps);
for (String stringIp : projectIps) {
JavaProjectStatus javaProjectStatus = new JavaProjectStatus();
javaProjectStatus.setName(projectName);
... ... @@ -121,7 +126,10 @@ public class JavaProjectStatusLoaderTask {
}
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"))
if (Objects.isNull(myResponse)){
return "2";
}
if (myResponse.contains("Resources ok"))
return "1";
else
return "2";
... ... @@ -129,7 +137,8 @@ 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,users");
// context_port_map.put("yoho-users", "8081,9001,users");
context_port_map.put("yoho-users", "8080,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");
... ... @@ -161,12 +170,12 @@ public class JavaProjectStatusLoaderTask {
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-erp-gateway", "8089,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("cms_push", "8086,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-message-controller", "8087,9627,yoho-message-controller");
context_port_map.put("yoho-message-sender", "8085,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");
... ... @@ -207,7 +216,7 @@ public class JavaProjectStatusLoaderTask {
}
public String getStartTime(String serviceName, String ip) {
String beginTime = "0000-00-00 00:00:00";
String beginTime = "jmx port is not open";
String jmxPort = getServicePort(serviceName, "jmx");
if (StringUtils.isNotBlank(jmxPort)) {
try {
... ...