|
|
1
|
+package com.monitor.other.task.handler;
|
|
|
2
|
+
|
|
|
3
|
+import com.model.TaskModel;
|
|
|
4
|
+import org.springframework.stereotype.Service;
|
|
|
5
|
+
|
|
|
6
|
+import java.util.HashMap;
|
|
|
7
|
+import java.util.List;
|
|
|
8
|
+import java.util.Map;
|
|
|
9
|
+
|
|
|
10
|
+/**
|
|
|
11
|
+ * Created by zhengyouwei on 2016/8/11.
|
|
|
12
|
+ * <p>
|
|
|
13
|
+ * 5:单个influxdb 没出现或者出现次数小于某个值
|
|
|
14
|
+ */
|
|
|
15
|
+@Service("handlerType_5")
|
|
|
16
|
+public class HandlerType_5 extends BaseHandler {
|
|
|
17
|
+
|
|
|
18
|
+ @Override
|
|
|
19
|
+ public void handle(TaskModel taskModel, Map<String, List<List<Map<String, Object>>>> resultMap) {
|
|
|
20
|
+ String[] influxdbs = taskModel.getInfluxdbs().split(",");
|
|
|
21
|
+
|
|
|
22
|
+ for (String influx : influxdbs) {
|
|
|
23
|
+ if (!resultMap.containsKey(influx)) {//没有取到数据
|
|
|
24
|
+ Map<String, Object> map=new HashMap<String, Object>();
|
|
|
25
|
+ map.put("count",0);
|
|
|
26
|
+ map.put("influxdb",influx);
|
|
|
27
|
+ sendSms(taskModel, map);
|
|
|
28
|
+ }else {
|
|
|
29
|
+ List<List<Map<String, Object>>> lists = resultMap.get(influx);
|
|
|
30
|
+ for(List<Map<String, Object>> mapList : lists){
|
|
|
31
|
+ for (Map<String, Object> map : mapList){
|
|
|
32
|
+ double count = (double) map.get("count");
|
|
|
33
|
+ if(count < taskModel.getAlarmNumFlag()){
|
|
|
34
|
+ map.put("influxdb",influx);
|
|
|
35
|
+ sendSms(taskModel, map);
|
|
|
36
|
+ }
|
|
|
37
|
+ }
|
|
|
38
|
+ }
|
|
|
39
|
+ }
|
|
|
40
|
+ }
|
|
|
41
|
+
|
|
|
42
|
+ }
|
|
|
43
|
+
|
|
|
44
|
+ @Override
|
|
|
45
|
+ public void handleCompareWithLastPeriod(TaskModel taskModel, Map<String, List<List<Map<String, Object>>>> result, Map<String, List<List<Map<String, Object>>>> resultLastPeriod){
|
|
|
46
|
+
|
|
|
47
|
+ }
|
|
|
48
|
+
|
|
|
49
|
+
|
|
|
50
|
+} |