zabbixalarm报警排除ip主机:10.67.2.46
Showing
1 changed file
with
3 additions
and
2 deletions
@@ -46,7 +46,6 @@ import java.util.concurrent.ThreadFactory; | @@ -46,7 +46,6 @@ import java.util.concurrent.ThreadFactory; | ||
46 | @EnableScheduling | 46 | @EnableScheduling |
47 | public class ZabbixAlarm { | 47 | public class ZabbixAlarm { |
48 | 48 | ||
49 | - //private static String ALARMTEMPLATE = "时间:%s,IP:%s,标签:%s,CPU使用率:%.2f%%,可用内存/总内存(MB):%s,输入/输出带宽(Mbps):%.2f / %.2f"; | ||
50 | private static String ALARMTEMPLATE = "报警时间:%s,性能指标响应时间:%s,IP:%s,标签:%s,CPU使用率:%.2f%%,可用内存/总内存(MB):%s,输入/输出带宽(Mbps):%.2f / %.2f"; | 49 | private static String ALARMTEMPLATE = "报警时间:%s,性能指标响应时间:%s,IP:%s,标签:%s,CPU使用率:%.2f%%,可用内存/总内存(MB):%s,输入/输出带宽(Mbps):%.2f / %.2f"; |
51 | 50 | ||
52 | public static final Logger DEBUG = LoggerFactory.getLogger(ZabbixAlarm.class); | 51 | public static final Logger DEBUG = LoggerFactory.getLogger(ZabbixAlarm.class); |
@@ -264,8 +263,9 @@ public class ZabbixAlarm { | @@ -264,8 +263,9 @@ public class ZabbixAlarm { | ||
264 | Double toMem = PointBuilder.findValueByKey(VmMemoryEnum.MEMORY_SIZE_TOTAL.key(), itemInfos, historyList); | 263 | Double toMem = PointBuilder.findValueByKey(VmMemoryEnum.MEMORY_SIZE_TOTAL.key(), itemInfos, historyList); |
265 | Double memPer = (0 == toMem) ? 1 : (avMem / toMem); | 264 | Double memPer = (0 == toMem) ? 1 : (avMem / toMem); |
266 | Double outNet = PointBuilder.findValueByKey(NetIfEnum.NET_IF_OUT.key(), itemInfos, historyList); | 265 | Double outNet = PointBuilder.findValueByKey(NetIfEnum.NET_IF_OUT.key(), itemInfos, historyList); |
267 | - //网卡进出流量 大于 300m | 266 | + //网卡进出流量 大于 500m |
268 | if (zabbixNetAlarm < inNet || zabbixNetAlarm < outNet) { | 267 | if (zabbixNetAlarm < inNet || zabbixNetAlarm < outNet) { |
268 | + if(!"10.67.2.46".equals(ip)){ | ||
269 | String nowTime = DateTime.now().toString("yyyy-MM-dd HH:mm:ss"); | 269 | String nowTime = DateTime.now().toString("yyyy-MM-dd HH:mm:ss"); |
270 | String alarmInfo = String.format(ALARMTEMPLATE, nowTime, inNetTime, ip, tags, userCpu, String.valueOf(avMem) + " / " + String.valueOf(toMem), inNet, outNet); | 270 | String alarmInfo = String.format(ALARMTEMPLATE, nowTime, inNetTime, ip, tags, userCpu, String.valueOf(avMem) + " / " + String.valueOf(toMem), inNet, outNet); |
271 | DEBUG.info("send alarm vm info {}", alarmInfo); | 271 | DEBUG.info("send alarm vm info {}", alarmInfo); |
@@ -274,6 +274,7 @@ public class ZabbixAlarm { | @@ -274,6 +274,7 @@ public class ZabbixAlarm { | ||
274 | //vm 带宽告警 | 274 | //vm 带宽告警 |
275 | alarmMsgService.sendSms("vm-per-net", alarmInfo, mobile_yunwei); | 275 | alarmMsgService.sendSms("vm-per-net", alarmInfo, mobile_yunwei); |
276 | } | 276 | } |
277 | + } | ||
277 | //cpu 大于 90% | 278 | //cpu 大于 90% |
278 | if (zabbixCpuAlarm < userCpu) { | 279 | if (zabbixCpuAlarm < userCpu) { |
279 | String nowTime = DateTime.now().toString("yyyy-MM-dd HH:mm:ss"); | 280 | String nowTime = DateTime.now().toString("yyyy-MM-dd HH:mm:ss"); |
-
Please register or login to post a comment