...
|
...
|
@@ -218,12 +218,16 @@ public class ZabbixAlarm { |
|
|
//system.cpu在另外一个库中,调用另一个接口
|
|
|
if (StringUtils.startsWith(itemInfo.getKeyName(), "system.cpu")) {
|
|
|
|
|
|
DEBUG.info("Start to query dhistoryinfo by item {}",itemInfo);
|
|
|
|
|
|
ZabbixDHistoryInfo dHistoryInfo = historyMapper.queryDHistoryInfo(itemInfo.getItemId());
|
|
|
|
|
|
if (null != dHistoryInfo) {
|
|
|
historyList.add(dHistoryInfo);
|
|
|
}
|
|
|
} else {
|
|
|
DEBUG.info("Start to query historyinfo by item {}",itemInfo);
|
|
|
|
|
|
ZabbixUHistoryInfo uHistoryInfo = historyMapper.queryUHistoryInfo(itemInfo.getItemId());
|
|
|
|
|
|
if (null != uHistoryInfo) {
|
...
|
...
|
@@ -267,15 +271,15 @@ public class ZabbixAlarm { |
|
|
|
|
|
Double outNet = PointBuilder.findValueByKey(NetIfEnum.NET_IF_OUT.key(), itemInfos, historyList);
|
|
|
|
|
|
//|| zabbixMemAlarm > memPer
|
|
|
//|| zabbixMemAlarm > memPer && queryErrorMap(ip)
|
|
|
|
|
|
if ((zabbixCpuAlarm < userCpu || zabbixNetAlarm < inNet || zabbixNetAlarm < outNet) && queryErrorMap(ip)) {
|
|
|
if ((zabbixCpuAlarm < userCpu || zabbixNetAlarm < inNet || zabbixNetAlarm < outNet)) {
|
|
|
|
|
|
String nowTime = DateTime.now().toString("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
|
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);
|
|
|
DEBUG.info("send alarm vm info {}", alarmInfo);
|
|
|
|
|
|
Constants.ERRORMAP.remove(ip);
|
|
|
|
...
|
...
|
|