diff --git a/src/main/java/com/zdjizhi/etl/ParseStaticThreshold.java b/src/main/java/com/zdjizhi/etl/ParseStaticThreshold.java index f9c1a39..521c4a0 100644 --- a/src/main/java/com/zdjizhi/etl/ParseStaticThreshold.java +++ b/src/main/java/com/zdjizhi/etl/ParseStaticThreshold.java @@ -112,7 +112,7 @@ public class ParseStaticThreshold { URIBuilder uriBuilder = new URIBuilder(CommonConfig.BIFANG_SERVER_URI); HashMap parms = new HashMap<>(); parms.put("pageSize", -1); - parms.put("orderBy", "vsysId desc"); +// parms.put("orderBy", "vsysId desc"); parms.put("type", 1); HttpClientUtils.setUrlWithParams(uriBuilder, CommonConfig.BIFANG_SERVER_POLICY_VSYSID_PATH, parms); String token = NacosUtils.getStringProperty("bifang.server.token"); @@ -155,7 +155,7 @@ public class ParseStaticThreshold { try { if (vsysIds != null) { for (DosVsysId dosVsysId : vsysIds) { - Integer vsysId = dosVsysId.getId(); + Integer vsysId = dosVsysId.getId() == null ? 1 : dosVsysId.getId(); Integer[] superiorIds = dosVsysId.getSuperiorIds(); URIBuilder uriBuilder = new URIBuilder(CommonConfig.BIFANG_SERVER_URI); HashMap parms = new HashMap<>(); @@ -178,11 +178,11 @@ public class ParseStaticThreshold { Object list = data.get("list"); if (list != null) { ArrayList thresholds = jsonMapperInstance.fromJson(jsonMapperInstance.toJson(list), thresholdType); - for (DosDetectionThreshold dosDetectionThreshold:thresholds){ + for (DosDetectionThreshold dosDetectionThreshold : thresholds) { dosDetectionThreshold.setSuperiorIds(superiorIds); vsysThresholds.add(dosDetectionThreshold); } - logger.info("获取到vsys id是{}静态阈值配置{}条",vsysId, thresholds.size()); + logger.info("获取到vsys id是{}静态阈值配置{}条", vsysId, thresholds.size()); } else { logger.warn("静态阈值配置为空"); } @@ -205,8 +205,8 @@ public class ParseStaticThreshold { * * @return threshold RangeMap */ - static HashMap>> createStaticThreshold() { - HashMap>> thresholdRangeMap = new HashMap<>(4); + static HashMap>> createStaticThreshold() { + HashMap>> thresholdRangeMap = new HashMap<>(4); try { ArrayList dosDetectionThreshold = getDosDetectionThreshold(); if (dosDetectionThreshold != null && !dosDetectionThreshold.isEmpty()) { @@ -249,7 +249,7 @@ public class ParseStaticThreshold { } } rangeMap.put(attackType, treeRangeMap); - thresholdRangeMap.put(vsysId,rangeMap); + thresholdRangeMap.put(vsysId, rangeMap); } } } catch (Exception e) { @@ -265,17 +265,17 @@ public class ParseStaticThreshold { getVsysId().forEach(System.out::println); System.out.println("------------------------"); */ - HashMap>> staticThreshold = createStaticThreshold(); + HashMap>> staticThreshold = createStaticThreshold(); System.out.println("------------------------"); - for (Integer integer : staticThreshold.keySet()){ + for (Integer integer : staticThreshold.keySet()) { HashMap> stringTreeRangeMapHashMap = staticThreshold.get(integer); for (String type : stringTreeRangeMapHashMap.keySet()) { Map, DosDetectionThreshold> asMapOfRanges = stringTreeRangeMapHashMap.get(type).asMapOfRanges(); for (Range range : asMapOfRanges.keySet()) { DosDetectionThreshold threshold = asMapOfRanges.get(range); - System.out.println(integer+"---"+type + "---" + range + "---" + threshold); + System.out.println(integer + "---" + type + "---" + range + "---" + threshold); } System.out.println("------------------------"); } diff --git a/src/main/resources/common.properties b/src/main/resources/common.properties index 212b90c..0cfedc0 100644 --- a/src/main/resources/common.properties +++ b/src/main/resources/common.properties @@ -15,7 +15,7 @@ kafka.input.topic.name=DOS-SKETCH-RECORD kafka.input.bootstrap.servers=192.168.44.11:9094,192.168.44.14:9094,192.168.44.15:9094 #读取kafka group id -kafka.input.group.id=dos-detection-job-220816-1 +kafka.input.group.id=dos-detection-job-221010-1 #kafka.input.group.id=dos-detection-job-210813-1 #发送kafka metrics并行度大小 @@ -51,7 +51,7 @@ hbase.baseline.table.name=dos:ddos_traffic_baselines hbase.baseline.total.num=1000000 #baseline ttl,单位:天 -hbase.baseline.ttl=1 +hbase.baseline.ttl=10 #设置聚合并行度,2个key flink.first.agg.parallelism=1