新增前端vue
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.jeesite.modules.app.Job.biz;
|
||||
|
||||
import com.github.dockerjava.api.model.Container;
|
||||
import com.jcraft.jsch.Session;
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.modules.app.dao.info.CpuInfo;
|
||||
@@ -67,6 +68,9 @@ public class hostJob {
|
||||
if (isReachable) {
|
||||
syncServerInfo(monitorHost);
|
||||
monitorHost.setLastOnlineTime(new Date());
|
||||
} else {
|
||||
BizWarningAlert warningAlert = new BizWarningAlert("ZJ_" + KeyUtil.ObjKey(12, 2), "网络预警", 2, monitorHost.getHostname() + "网络预警", "当前主机网络连接超时,请及时处理,主机IP:" + monitorHost.getIpAddress(), "业务系统", "0");
|
||||
bizWarningAlertService.save(warningAlert);
|
||||
}
|
||||
monitorHostService.save(monitorHost);
|
||||
}, hostMonitorExecutor); // 指定使用配置的线程池
|
||||
@@ -84,6 +88,11 @@ public class hostJob {
|
||||
* 运行信息更新
|
||||
*/
|
||||
public void syncServerInfo(BizMonitorHost host) {
|
||||
if (host.getIsAuth().equals("1")) {
|
||||
DockerUtils dockerUtils = new DockerUtils(host.getIpAddress(), host.getCheckTargetPort());
|
||||
List<Container> containerList = dockerUtils.listContainers(true);
|
||||
host.setRunTargetNums(containerList.size());
|
||||
monitorHostService.save(host);
|
||||
BizMonitorAccount monitorAccount = new BizMonitorAccount();
|
||||
monitorAccount.setHostId(host.getHostId());
|
||||
monitorAccount.setUstatus("1");
|
||||
@@ -137,6 +146,11 @@ public class hostJob {
|
||||
logger.error(e.getMessage(), host);
|
||||
}
|
||||
}
|
||||
if (host.getCheckTargetNums() != containerList.size()) {
|
||||
BizWarningAlert warningAlert = new BizWarningAlert("ZJ_" + KeyUtil.ObjKey(12, 2), "容器预警", 2, host.getHostname() + "容器预警", "当前主机容器运行数量" + containerList.size() + "与配置数量不一致,请及时处理,主机IP:" + host.getIpAddress(), "业务系统", "0");
|
||||
bizWarningAlertService.save(warningAlert);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user