Authored by qinchao

zabbix报警排除所有的bigdata

... ... @@ -159,7 +159,7 @@ public class ZabbixAlarm {
Constants.ZABBIXALARMIDMPA.put(zabbixHostInfo.getHostId(), zabbixHostInfo.getIp());
}
}
/**
* 根据id查询item,转存内存map中,供后续使用
*/
... ... @@ -232,8 +232,8 @@ public class ZabbixAlarm {
return;
}
String tags = hostInfo.getTags();
//过滤 ops 、 gray
if (StringUtils.isBlank(tags) || StringUtils.contains(StringUtils.lowerCase(tags), "ops") || StringUtils.contains(tags, "灰度")) {
//过滤 ops 、 gray 、bigdata
if (StringUtils.isBlank(tags) || StringUtils.contains(StringUtils.lowerCase(tags), "ops") || StringUtils.contains(tags, "灰度")||(("bigdata,").equals(tags))) {
return;
}
//当前cpu
... ... @@ -266,25 +266,23 @@ public class ZabbixAlarm {
//网卡进出流量 大于 500m
if (zabbixNetAlarm < inNet || zabbixNetAlarm < outNet) {
boolean sendFlag=true;
if(tags!=null){
if(tags.indexOf("bigdata,")>=0){
//// 暂时不报警
if(tags.indexOf("mysql,")>=0){
if(700.00 < inNet || 700.00 < outNet){
sendFlag=true;
}else{
sendFlag=false;
}
}else{
sendFlag=false;
}
}else if(tags.indexOf("mysql,")>=0){
if(tags.indexOf("bigdata,")>=0){
//// 暂时不报警
if(tags.indexOf("mysql,")>=0){
if(700.00 < inNet || 700.00 < outNet){
sendFlag=true;
}else{
sendFlag=false;
}
}else{
sendFlag=false;
}
}else if(tags.indexOf("mysql,")>=0){
if(700.00 < inNet || 700.00 < outNet){
sendFlag=true;
}else{
sendFlag=false;
}
}
... ... @@ -300,17 +298,13 @@ public class ZabbixAlarm {
}
//cpu 大于 90%
if (zabbixCpuAlarm < userCpu) {
if(tags!=null&&tags.indexOf("bigdata,")<0){
//// 暂时不报警
}else{
String nowTime = DateTime.now().toString("yyyy-MM-dd HH:mm:ss");
String alarmInfo = String.format(ALARMTEMPLATE, nowTime, userCpuTime, ip, tags, userCpu, String.valueOf(avMem) + " / " + String.valueOf(toMem), inNet, outNet);
DEBUG.info("send alarm vm info {}", alarmInfo);
DEBUG.info("cpu Index is too high,the timestamp is:" + userCpuTimeStamp);
Constants.ERRORMAP.remove(ip);
//vm 性能告警
alarmMsgService.sendSms("vm-per-cpu", alarmInfo, mobile_yunwei);
}
String nowTime = DateTime.now().toString("yyyy-MM-dd HH:mm:ss");
String alarmInfo = String.format(ALARMTEMPLATE, nowTime, userCpuTime, ip, tags, userCpu, String.valueOf(avMem) + " / " + String.valueOf(toMem), inNet, outNet);
DEBUG.info("send alarm vm info {}", alarmInfo);
DEBUG.info("cpu Index is too high,the timestamp is:" + userCpuTimeStamp);
Constants.ERRORMAP.remove(ip);
//vm 性能告警
alarmMsgService.sendSms("vm-per-cpu", alarmInfo, mobile_yunwei);
}
}
... ...