Search in sources :

Example 6 with InstanceAlertValueResult

use of com.sohu.cache.entity.InstanceAlertValueResult in project cachecloud by sohutv.

the class InstanceAlertValueServiceImpl method checkStaticInstanceInfoAlert.

/**
     * 检测每个实例统计信息
     * 
     * @param standardStats
     * @param instanceAlertList
     * @return
     */
public List<InstanceAlertValueResult> checkStaticInstanceInfoAlert(StandardStats standardStats, List<InstanceAlert> instanceAlertList) {
    List<InstanceAlertValueResult> resultList = new ArrayList<InstanceAlertValueResult>();
    // 标准Redis info统计信息
    String jsonInfo = standardStats.getInfoJson();
    if (StringUtils.isBlank(jsonInfo)) {
        return null;
    }
    // 转换成Map
    Map<String, Object> infoMap = JsonUtil.fromJson(jsonInfo, Map.class);
    if (MapUtils.isEmpty(infoMap)) {
        return null;
    }
    // 转换成Map<String, Map<String,Object>>
    for (Entry<String, Object> entry : infoMap.entrySet()) {
        Object object = entry.getValue();
        if (!(object instanceof Map)) {
            continue;
        }
        Map<String, Object> sectionInfoMap = (Map<String, Object>) object;
        for (Entry<String, Object> sectionInfoEntry : sectionInfoMap.entrySet()) {
            String infoKey = sectionInfoEntry.getKey();
            Object infoValue = sectionInfoEntry.getValue();
            InstanceAlertValueResult instanceAlertValueResult = generateInstanceValueResult(instanceAlertList, infoKey, infoValue, standardStats.getIp(), standardStats.getPort());
            if (instanceAlertValueResult != null) {
                resultList.add(instanceAlertValueResult);
            }
        }
    }
    return resultList;
}
Also used : InstanceAlertValueResult(com.sohu.cache.entity.InstanceAlertValueResult) ArrayList(java.util.ArrayList) Map(java.util.Map)

Aggregations

InstanceAlertValueResult (com.sohu.cache.entity.InstanceAlertValueResult)6 ArrayList (java.util.ArrayList)3 AppDailyData (com.sohu.cache.entity.AppDailyData)1 AppUser (com.sohu.cache.entity.AppUser)1 InstanceAlert (com.sohu.cache.entity.InstanceAlert)1 InstanceInfo (com.sohu.cache.entity.InstanceInfo)1 StandardStats (com.sohu.cache.entity.StandardStats)1 SimpleDateFormat (java.text.SimpleDateFormat)1 Date (java.util.Date)1 Map (java.util.Map)1