Authored by simba

update

... ... @@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSONObject;
import com.model.MObjectInfo;
import com.model.RedisMonitor;
import com.model.TypeInfo;
import com.monitor.common.config.SnsMobileConfig;
import com.monitor.common.service.AlarmMsgService;
import com.monitor.common.util.HttpRestClient;
import com.monitor.common.util.RedisCommonUtil;
import com.monitor.common.util.TelnetUtils;
... ... @@ -43,6 +45,12 @@ public class RedisMonitorHandleServiceImpl implements IRedisMonitorHandleService
@Autowired
RedisMonitorMapper redisMonitorMapper;
@Autowired
public AlarmMsgService alarmMsgService;
@Autowired
private SnsMobileConfig snsMobileConfig;
@Override
public void redisMonitor() {
... ... @@ -199,6 +207,7 @@ public class RedisMonitorHandleServiceImpl implements IRedisMonitorHandleService
if(flag){
msg="OK";
}else{
slaveAramCount++;
msg="ERROR";
}
redisInfoList.add(new RedisMonitor(ipConfig[0]+":"+ipConfig[1],result.get("master_host").toString()+":"+result.get("master_port").toString(),2,isFailed,1,Integer.valueOf(ipConfig[2]),msg));
... ... @@ -218,5 +227,26 @@ public class RedisMonitorHandleServiceImpl implements IRedisMonitorHandleService
redisMonitorMapper.deleteAllRedisMonitor();
redisMonitorMapper.bachInsertRedisMonitor(redisInfoList);
}
/**********************************************************************
*4、告警
***********************************************************************/
StringBuffer alrarmMsg=new StringBuffer("");
if(twemproxyAlarmCount>0){
alrarmMsg.append("twemproxy:"+twemproxyAlarmCount+"台连接失败;");
}
if(redisAlarmCount>0){
alrarmMsg.append("redis:"+redisAlarmCount+"台连接失败;");
}
if(slaveAramCount>0){
alrarmMsg.append("redis主从:"+redisAlarmCount+"台连接失败;请及时查看!");
}
if(StringUtils.isNotBlank(alrarmMsg.toString())){
alarmMsgService.sendSms("zookeeper", alarmMsgService.toString(), snsMobileConfig.getBaseMobile());
}
}
}
... ...