class MasterSlaveOffsetAlertStrategy extends AlertConfigStrategy {

    /**
     * 格式：
     *     connected_slaves:2
     *     slave0:ip=x.x.x.x,port=6380,state=online,offset=33119690469561,lag=1
     *     slave1:ip=x.x.x.x,port=6380,state=online,offset=33119690513578,lag=0
     *     master_repl_offset:33119653194425
     */
    @Override
    public List<InstanceAlertValueResult> checkConfig(InstanceAlertConfig instanceAlertConfig, AlertConfigBaseData alertConfigBaseData) {<FILL_FUNCTION_BODY>}

}

        Object connectedSlavesObject = getValueFromRedisInfo(alertConfigBaseData.getStandardStats(), RedisInfoEnum.connected_slaves.getValue());
        if (connectedSlavesObject == null) {
            return null;
        }
        int connectedSlaves = NumberUtils.toInt(connectedSlavesObject.toString());
        if (connectedSlaves == 0) {
            return null;
        }
        Object masterReplOffsetObject = getValueFromRedisInfo(alertConfigBaseData.getStandardStats(), RedisInfoEnum.master_repl_offset.getValue());
        if (masterReplOffsetObject == null) {
            return null;
        }
        List<InstanceAlertValueResult> instanceAlertValueResultList = new ArrayList<InstanceAlertValueResult>();
        for (int i = 0; i < connectedSlaves; i++) {
            Object slaveInfo = getValueFromRedisInfo(alertConfigBaseData.getStandardStats(), "slave" + i);
            if (slaveInfo == null) {
                continue;
            }
            String[] arr = slaveInfo.toString().split(",");
            if (arr.length < 5) {
                continue;
            }
            String state = arr[2];
            if (!"state=online".equals(state)) {
                continue;
            }
            String slaveHostPort = arr[0] + "," + arr[1];
            String slaveOffsetStr = arr[3];
            String[] slaveOffsetArr = slaveOffsetStr.split("=");
            if (slaveOffsetArr.length != 2) {
                continue;
            }
            String slaveOffset = slaveOffsetArr[1];
            long diffOffset = Math.abs(NumberUtils.toLong(masterReplOffsetObject.toString()) - NumberUtils.toLong(slaveOffset));
            boolean compareRight = isCompareDoubleRight(instanceAlertConfig, diffOffset);
            if (compareRight) {
                return null;
            }
            InstanceInfo instanceInfo = alertConfigBaseData.getInstanceInfo();
            InstanceAlertValueResult instanceAlertValueResult = new InstanceAlertValueResult(instanceAlertConfig, instanceInfo, String.valueOf(diffOffset),
                    instanceInfo.getAppId(), EMPTY);
            String otherInfo = String.format("masterOffset is %s<br/>slaveOffset  is %s<br/>%s", masterReplOffsetObject.toString(), slaveOffset, slaveHostPort);
            instanceAlertValueResult.setOtherInfo(otherInfo);
            instanceAlertValueResultList.add(instanceAlertValueResult);
        }
        return instanceAlertValueResultList;
    
<methods>public non-sealed void <init>() ,public abstract List<com.sohu.cache.entity.InstanceAlertValueResult> checkConfig(com.sohu.cache.entity.InstanceAlertConfig, com.sohu.cache.alert.bean.AlertConfigBaseData) <variables>protected static final java.lang.String EMPTY,protected static final java.lang.String MB_STRING