zabbixalarm报警排除ip主机:10.67.2.46
Showing
1 changed file
with
10 additions
and
9 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,15 +263,17 @@ public class ZabbixAlarm { | @@ -264,15 +263,17 @@ 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) { |
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); | ||
271 | - DEBUG.info("send alarm vm info {}", alarmInfo); | ||
272 | - DEBUG.info("net Index is too high,the timestamp is:" + inNetTimeStamp); | ||
273 | - Constants.ERRORMAP.remove(ip); | ||
274 | - //vm 带宽告警 | ||
275 | - alarmMsgService.sendSms("vm-per-net", alarmInfo, mobile_yunwei); | 268 | + if(!"10.67.2.46".equals(ip)){ |
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); | ||
271 | + DEBUG.info("send alarm vm info {}", alarmInfo); | ||
272 | + DEBUG.info("net Index is too high,the timestamp is:" + inNetTimeStamp); | ||
273 | + Constants.ERRORMAP.remove(ip); | ||
274 | + //vm 带宽告警 | ||
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) { |
-
Please register or login to post a comment