新增预警页面
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.jeesite.modules.app.Job;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.modules.app.dao.info.CpuInfo;
|
||||
import com.jeesite.modules.app.dao.info.DiskInfo;
|
||||
import com.jeesite.modules.app.dao.info.ServerInfo;
|
||||
@@ -34,8 +35,9 @@ public class hostJob {
|
||||
|
||||
@Resource(name = "hostMonitorExecutor")
|
||||
private ThreadPoolTaskExecutor hostMonitorExecutor;
|
||||
|
||||
|
||||
private static final double CPU_RATE = Double.parseDouble(Global.getConfig("biz.host.Cpu", "60"));
|
||||
private static final double MEM_RATE = Double.parseDouble(Global.getConfig("biz.host.Memory", "60"));
|
||||
private static final double DISK_RATE = Double.parseDouble(Global.getConfig("biz.host.Disk", "60"));
|
||||
private static final LoggerUtils logger = LoggerUtils.getInstance();
|
||||
|
||||
/**
|
||||
@@ -96,12 +98,12 @@ public class hostJob {
|
||||
serverInfo.setLastOnlineTime(new Date());
|
||||
serverInfo.setHostId(host.getHostId());
|
||||
serverInfoService.save(serverInfo);
|
||||
if (serverInfo.getCpuUsage() >= 60) {
|
||||
BizWarningAlert warningAlert = new BizWarningAlert("ZJ_" + KeyUtil.ObjKey(12, 2), "CPU预警", 2, serverInfo.getHostname() + "CPU预警", "当前主机CPU已超过60%,请及时处理,主机IP:" + serverInfo.getIpAddress(), "业务系统", "0");
|
||||
if (serverInfo.getCpuUsage() >= CPU_RATE) {
|
||||
BizWarningAlert warningAlert = new BizWarningAlert("ZJ_" + KeyUtil.ObjKey(12, 2), "CPU预警", 2, serverInfo.getHostname() + "CPU预警", "当前主机CPU已超过" + CPU_RATE + "%,请及时处理,主机IP:" + serverInfo.getIpAddress(), "业务系统", "0");
|
||||
bizWarningAlertService.save(warningAlert);
|
||||
}
|
||||
if (serverInfo.getMemoryUsage() >= 60) {
|
||||
BizWarningAlert warningAlert = new BizWarningAlert("ZJ_" + KeyUtil.ObjKey(12, 2), "内存预警", 2, serverInfo.getHostname() + "内存预警", "当前主机内存已超过60%,请及时处理,主机IP:" + serverInfo.getIpAddress(), "业务系统", "0");
|
||||
if (serverInfo.getMemoryUsage() >= MEM_RATE) {
|
||||
BizWarningAlert warningAlert = new BizWarningAlert("ZJ_" + KeyUtil.ObjKey(12, 2), "内存预警", 2, serverInfo.getHostname() + "内存预警", "当前主机内存已超过" + MEM_RATE + "%,请及时处理,主机IP:" + serverInfo.getIpAddress(), "业务系统", "0");
|
||||
bizWarningAlertService.save(warningAlert);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@@ -130,8 +132,8 @@ public class hostJob {
|
||||
deviceInfo.setUsageRate(diskInfo.getUsageRate());
|
||||
deviceInfo.setLastOnlineTime(new Date());
|
||||
deviceInfoService.save(deviceInfo);
|
||||
if (deviceInfo.getUsageRate() >= 60) {
|
||||
BizWarningAlert warningAlert = new BizWarningAlert("ZJ_" + KeyUtil.ObjKey(12, 2), "磁盘预警", 2, host.getHostname() + "磁盘预警", "当前主机磁盘已超过60%,请及时处理,主机IP:" + host.getIpAddress() + ",设备名称:" + deviceInfo.getDevice() + ",挂载点:" + deviceInfo.getMountPoint() + ",总容量:" + deviceInfo.getTotalSize() + ",已使用容量:" + deviceInfo.getUsedSize() + ",当前使用率:" + deviceInfo.getUsageRate() + "%", "业务系统", "0");
|
||||
if (deviceInfo.getUsageRate() >= DISK_RATE) {
|
||||
BizWarningAlert warningAlert = new BizWarningAlert("ZJ_" + KeyUtil.ObjKey(12, 2), "磁盘预警", 2, host.getHostname() + "磁盘预警", "当前主机磁盘已超过" + DISK_RATE + "%,请及时处理,主机IP:" + host.getIpAddress() + ",设备名称:" + deviceInfo.getDevice() + ",挂载点:" + deviceInfo.getMountPoint() + ",总容量:" + deviceInfo.getTotalSize() + ",已使用容量:" + deviceInfo.getUsedSize() + ",当前使用率:" + deviceInfo.getUsageRate() + "%", "业务系统", "0");
|
||||
bizWarningAlertService.save(warningAlert);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
Reference in New Issue
Block a user