Authored by qinchao

zabbix报警排除所有的bigdata

@@ -159,7 +159,7 @@ public class ZabbixAlarm { @@ -159,7 +159,7 @@ public class ZabbixAlarm {
159 Constants.ZABBIXALARMIDMPA.put(zabbixHostInfo.getHostId(), zabbixHostInfo.getIp()); 159 Constants.ZABBIXALARMIDMPA.put(zabbixHostInfo.getHostId(), zabbixHostInfo.getIp());
160 } 160 }
161 } 161 }
162 - 162 +
163 /** 163 /**
164 * 根据id查询item,转存内存map中,供后续使用 164 * 根据id查询item,转存内存map中,供后续使用
165 */ 165 */
@@ -232,8 +232,8 @@ public class ZabbixAlarm { @@ -232,8 +232,8 @@ public class ZabbixAlarm {
232 return; 232 return;
233 } 233 }
234 String tags = hostInfo.getTags(); 234 String tags = hostInfo.getTags();
235 - //过滤 ops 、 gray  
236 - if (StringUtils.isBlank(tags) || StringUtils.contains(StringUtils.lowerCase(tags), "ops") || StringUtils.contains(tags, "灰度")) { 235 + //过滤 ops 、 gray 、bigdata
  236 + if (StringUtils.isBlank(tags) || StringUtils.contains(StringUtils.lowerCase(tags), "ops") || StringUtils.contains(tags, "灰度")||(("bigdata,").equals(tags))) {
237 return; 237 return;
238 } 238 }
239 //当前cpu 239 //当前cpu
@@ -266,25 +266,23 @@ public class ZabbixAlarm { @@ -266,25 +266,23 @@ public class ZabbixAlarm {
266 //网卡进出流量 大于 500m 266 //网卡进出流量 大于 500m
267 if (zabbixNetAlarm < inNet || zabbixNetAlarm < outNet) { 267 if (zabbixNetAlarm < inNet || zabbixNetAlarm < outNet) {
268 boolean sendFlag=true; 268 boolean sendFlag=true;
269 - if(tags!=null){  
270 - if(tags.indexOf("bigdata,")>=0){  
271 - //// 暂时不报警  
272 - if(tags.indexOf("mysql,")>=0){  
273 - if(700.00 < inNet || 700.00 < outNet){  
274 - sendFlag=true;  
275 - }else{  
276 - sendFlag=false;  
277 - }  
278 -  
279 - }else{  
280 - sendFlag=false;  
281 - }  
282 - }else if(tags.indexOf("mysql,")>=0){ 269 + if(tags.indexOf("bigdata,")>=0){
  270 + //// 暂时不报警
  271 + if(tags.indexOf("mysql,")>=0){
283 if(700.00 < inNet || 700.00 < outNet){ 272 if(700.00 < inNet || 700.00 < outNet){
284 sendFlag=true; 273 sendFlag=true;
285 }else{ 274 }else{
286 sendFlag=false; 275 sendFlag=false;
287 } 276 }
  277 +
  278 + }else{
  279 + sendFlag=false;
  280 + }
  281 + }else if(tags.indexOf("mysql,")>=0){
  282 + if(700.00 < inNet || 700.00 < outNet){
  283 + sendFlag=true;
  284 + }else{
  285 + sendFlag=false;
288 } 286 }
289 } 287 }
290 288
@@ -300,17 +298,13 @@ public class ZabbixAlarm { @@ -300,17 +298,13 @@ public class ZabbixAlarm {
300 } 298 }
301 //cpu 大于 90% 299 //cpu 大于 90%
302 if (zabbixCpuAlarm < userCpu) { 300 if (zabbixCpuAlarm < userCpu) {
303 - if(tags!=null&&tags.indexOf("bigdata,")<0){  
304 - //// 暂时不报警  
305 - }else{  
306 - String nowTime = DateTime.now().toString("yyyy-MM-dd HH:mm:ss");  
307 - String alarmInfo = String.format(ALARMTEMPLATE, nowTime, userCpuTime, ip, tags, userCpu, String.valueOf(avMem) + " / " + String.valueOf(toMem), inNet, outNet);  
308 - DEBUG.info("send alarm vm info {}", alarmInfo);  
309 - DEBUG.info("cpu Index is too high,the timestamp is:" + userCpuTimeStamp);  
310 - Constants.ERRORMAP.remove(ip);  
311 - //vm 性能告警  
312 - alarmMsgService.sendSms("vm-per-cpu", alarmInfo, mobile_yunwei);  
313 - } 301 + String nowTime = DateTime.now().toString("yyyy-MM-dd HH:mm:ss");
  302 + String alarmInfo = String.format(ALARMTEMPLATE, nowTime, userCpuTime, ip, tags, userCpu, String.valueOf(avMem) + " / " + String.valueOf(toMem), inNet, outNet);
  303 + DEBUG.info("send alarm vm info {}", alarmInfo);
  304 + DEBUG.info("cpu Index is too high,the timestamp is:" + userCpuTimeStamp);
  305 + Constants.ERRORMAP.remove(ip);
  306 + //vm 性能告警
  307 + alarmMsgService.sendSms("vm-per-cpu", alarmInfo, mobile_yunwei);
314 } 308 }
315 } 309 }
316 310