|
|
package com.monitor.other.task.handler;
|
|
|
|
|
|
import com.model.TaskModel;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* Created by zhengyouwei on 2016/8/11.
|
|
|
* <p>
|
|
|
* 5:单个influxdb 没出现或者出现次数小于某个值
|
|
|
*/
|
|
|
@Service("handlerType_5")
|
|
|
public class HandlerType_5 extends BaseHandler {
|
|
|
|
|
|
@Override
|
|
|
public void handle(TaskModel taskModel, Map<String, List<List<Map<String, Object>>>> resultMap) {
|
|
|
String[] influxdbs = taskModel.getInfluxdbs().split(",");
|
|
|
|
|
|
for (String influx : influxdbs) {
|
|
|
if (!resultMap.containsKey(influx)) {//没有取到数据
|
|
|
Map<String, Object> map=new HashMap<String, Object>();
|
|
|
map.put("count",0);
|
|
|
map.put("influxdb",influx);
|
|
|
sendSms(taskModel, map);
|
|
|
}else {
|
|
|
List<List<Map<String, Object>>> lists = resultMap.get(influx);
|
|
|
for(List<Map<String, Object>> mapList : lists){
|
|
|
for (Map<String, Object> map : mapList){
|
|
|
double count = (double) map.get("count");
|
|
|
if(count < taskModel.getAlarmNumFlag()){
|
|
|
map.put("influxdb",influx);
|
|
|
sendSms(taskModel, map);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void handleCompareWithLastPeriod(TaskModel taskModel, Map<String, List<List<Map<String, Object>>>> result, Map<String, List<List<Map<String, Object>>>> resultLastPeriod){
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
} |
...
|
...
|
|