Authored by jack

使用cpu_user,防止cpu被耗尽,idle_cpu误报为0

... ... @@ -255,9 +255,7 @@ public class ZabbixAlarm {
return;
}
Double idleCpu = PointBuilder.findValueByKey(SystemCpuEnum.CPU_UTIL_IDLE.key(), itemInfos, historyList);
idleCpu = (0 == idleCpu) ? 100 : idleCpu;
Double userCpu = PointBuilder.findValueByKey(SystemCpuEnum.CPU_UTIL_USER.key(), itemInfos, historyList);
Double avMem = PointBuilder.findValueByKey(VmMemoryEnum.MEMORY_SIZE_AVAILABLE.key(), itemInfos, historyList);
... ... @@ -271,11 +269,11 @@ public class ZabbixAlarm {
//|| zabbixMemAlarm > memPer
if ((zabbixCpuAlarm > idleCpu || zabbixNetAlarm < inNet || zabbixNetAlarm < outNet) && queryErrorMap(ip)) {
if ((zabbixCpuAlarm < userCpu || zabbixNetAlarm < inNet || zabbixNetAlarm < outNet) && queryErrorMap(ip)) {
String nowTime = DateTime.now().toString("yyyy-MM-dd HH:mm:ss");
String alarmInfo = String.format(ALARMTEMPLATE, nowTime, ip, tags, 100 - idleCpu, String.valueOf(avMem) + " / " + String.valueOf(toMem), inNet, outNet);
String alarmInfo = String.format(ALARMTEMPLATE, nowTime, ip, tags, userCpu, String.valueOf(avMem) + " / " + String.valueOf(toMem), inNet, outNet);
DEBUG.info("3m 3times ,send alarm vm info {}", alarmInfo);
... ...