优化mtr探测策略
告警日志增加业务名称、告警推送是否成功字段
This commit is contained in:
@@ -45,7 +45,7 @@ public class RmAlarmLog extends BaseEntity
|
||||
@Excel(name = "业务名称")
|
||||
private String businessName;
|
||||
|
||||
/** 推送标志(0失败,1成功,3未配置消息推送机制) */
|
||||
@Excel(name = "推送标志", readConverterExp = "0=失败,1=成功,3=未配置消息推送机制")
|
||||
/** 推送标志(0失败,1成功,2未配置消息推送机制) */
|
||||
@Excel(name = "推送标志", readConverterExp = "0=失败,1=成功,2=未配置消息推送机制")
|
||||
private Long pushFlag;
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ public class DynamicOidCollector {
|
||||
// 获取过滤条件
|
||||
String filterType = deviceType + "OID";
|
||||
List<String> filterValues = switchVo.getFilterByType(filterType);
|
||||
log.info("采集交换机 {} 的 {} 设备信息,筛选条件: {}",
|
||||
log.debug("采集交换机 {} 的 {} 设备信息,筛选条件: {}",
|
||||
switchVo.getIp(), deviceType, filterValues);
|
||||
|
||||
if(needIndex){
|
||||
@@ -115,7 +115,7 @@ public class DynamicOidCollector {
|
||||
// 获取索引列表
|
||||
List<Integer> indexes = getIndexes(target, indexOID, filterValues);
|
||||
if (indexes.isEmpty()) {
|
||||
log.info("交换机 {} 的 {} 设备索引为空", switchVo.getIp(), deviceType);
|
||||
log.debug("交换机 {} 的 {} 设备索引为空", switchVo.getIp(), deviceType);
|
||||
return new CollectionResult(switchVo.getIp(), deviceType, results, true);
|
||||
}
|
||||
|
||||
@@ -399,7 +399,7 @@ public class DynamicOidCollector {
|
||||
// 获取交换机支持的所有设备类型
|
||||
List<String> deviceTypes = switchVo.getSupportedDeviceTypes();
|
||||
if (deviceTypes.isEmpty()) {
|
||||
log.info("交换机 {} 未配置任何设备类型的OID", switchVo.getIp());
|
||||
log.debug("交换机 {} 未配置任何设备类型的OID", switchVo.getIp());
|
||||
return results;
|
||||
}
|
||||
|
||||
@@ -415,10 +415,10 @@ public class DynamicOidCollector {
|
||||
results.put(deviceType, result);
|
||||
|
||||
if (result.isSuccess()) {
|
||||
log.info("交换机 {} 的 {} 采集完成: %d 个设备",
|
||||
log.debug("交换机 {} 的 {} 采集完成: %d 个设备",
|
||||
switchVo.getIp(), deviceType, result.getData().size());
|
||||
} else {
|
||||
log.info("交换机 {} 的 {} 采集失败: {}",
|
||||
log.error("交换机 {} 的 {} 采集失败: {}",
|
||||
switchVo.getIp(), deviceType, result.getErrorMessage());
|
||||
}
|
||||
}, deviceTypeExecutor))
|
||||
@@ -438,12 +438,12 @@ public class DynamicOidCollector {
|
||||
|
||||
List<CompletableFuture<Void>> futures = switches.stream()
|
||||
.map(switchVo -> CompletableFuture.runAsync(() -> {
|
||||
log.info("开始采集交换机: {}", switchVo.getIp());
|
||||
log.debug("开始采集交换机: {}", switchVo.getIp());
|
||||
|
||||
Map<String, CollectionResult> switchResults = collectSwitch(switchVo);
|
||||
allResults.put(switchVo.getIp(), switchResults);
|
||||
|
||||
log.info("完成采集交换机: {}, 采集了 %d 种设备类型",
|
||||
log.debug("完成采集交换机: {}, 采集了 %d 种设备类型",
|
||||
switchVo.getIp(), switchResults.size());
|
||||
}, switchExecutor))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
+11
-11
@@ -136,7 +136,7 @@ public class MultiSwitchCollectionScheduler {
|
||||
allSwitchConfigs.put(switchIp, switchVo);
|
||||
allSwitchCollectConfigs.put(switchIp, new ArrayList<>(collectVos));
|
||||
|
||||
log.info("启动交换机 {} 的采集任务,包含 {} 个采集类型{}",
|
||||
log.debug("启动交换机 {} 的采集任务,包含 {} 个采集类型{}",
|
||||
switchIp, switchTasks.size());
|
||||
}
|
||||
|
||||
@@ -236,7 +236,7 @@ public class MultiSwitchCollectionScheduler {
|
||||
allSwitchConfigs.put(switchIp, switchVo);
|
||||
allSwitchCollectConfigs.put(switchIp, new ArrayList<>(collectVos));
|
||||
|
||||
log.info("启动SNMP v3交换机 {} 的采集任务,包含 {} 个采集类型{}",
|
||||
log.debug("启动SNMP v3交换机 {} 的采集任务,包含 {} 个采集类型{}",
|
||||
switchIp, switchTasks.size());
|
||||
}
|
||||
|
||||
@@ -321,7 +321,7 @@ public class MultiSwitchCollectionScheduler {
|
||||
ScheduledFuture<?> future = taskScheduler.scheduleWithFixedDelay(
|
||||
heartbeatTask, Instant.now().plus(initialDelay), interval);
|
||||
|
||||
log.info("交换机 {} 心跳检测任务启动,检测间隔: 30秒", switchIp);
|
||||
log.debug("交换机 {} 心跳检测任务启动,检测间隔: 30秒", switchIp);
|
||||
return future;
|
||||
}
|
||||
|
||||
@@ -349,7 +349,7 @@ public class MultiSwitchCollectionScheduler {
|
||||
// 获取当前时间作为采集时间戳(对齐到5分钟整点)
|
||||
long collectionTimestamp = getAlignedTimestamp();
|
||||
|
||||
log.info("[流量采集] 开始采集交换机 {} 的网络数据, 时间: {}", switchIp, collectionTimestamp);
|
||||
log.debug("[流量采集] 开始采集交换机 {} 的网络数据, 时间: {}", switchIp, collectionTimestamp);
|
||||
|
||||
CollectionResult result = dynamicOidCollector.getInterfaceInfoByType(switchVo, "net");
|
||||
|
||||
@@ -359,7 +359,7 @@ public class MultiSwitchCollectionScheduler {
|
||||
// 这里可以处理采集结果,比如保存到数据库或发送到消息队列
|
||||
processCollectionResult(result, clientId);
|
||||
|
||||
log.info("[流量采集] 完成采集交换机 {} 的网络数据, 时间戳: {}", switchIp, collectionTimestamp);
|
||||
log.debug("[流量采集] 完成采集交换机 {} 的网络数据, 时间戳: {}", switchIp, collectionTimestamp);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("[流量采集] 采集交换机 {} 数据失败: {}", switchIp, e.getMessage());
|
||||
@@ -369,7 +369,7 @@ public class MultiSwitchCollectionScheduler {
|
||||
CronTrigger trigger = new CronTrigger(cronExpression);
|
||||
ScheduledFuture<?> future = taskScheduler.schedule(trafficTask, trigger);
|
||||
|
||||
log.info("交换机 {} 流量采集任务启动,时间点: 每5分钟整点", switchIp);
|
||||
log.debug("交换机 {} 流量采集任务启动,时间点: 每5分钟整点", switchIp);
|
||||
return future;
|
||||
}
|
||||
/**
|
||||
@@ -418,7 +418,7 @@ public class MultiSwitchCollectionScheduler {
|
||||
|
||||
Runnable regularTask = () -> {
|
||||
try {
|
||||
log.info("[{}] 开始采集交换机 {} 的数据, 时间: {}",
|
||||
log.debug("[{}] 开始采集交换机 {} 的数据, 时间: {}",
|
||||
collectVo.getType(), switchIp, LocalDateTime.now());
|
||||
// 获取对齐到整分钟的时间戳
|
||||
long collectionTimestamp = getAlignedMinuteTimestamp();
|
||||
@@ -429,7 +429,7 @@ public class MultiSwitchCollectionScheduler {
|
||||
// 处理采集结果
|
||||
processCollectionResult(result, clientId);
|
||||
|
||||
log.info("[{}] 完成采集交换机 {} 的数据", collectVo.getType(), switchIp);
|
||||
log.debug("[{}] 完成采集交换机 {} 的数据", collectVo.getType(), switchIp);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("[{}] 采集交换机 {} 数据失败: {}",
|
||||
@@ -440,7 +440,7 @@ public class MultiSwitchCollectionScheduler {
|
||||
ScheduledFuture<?> future = taskScheduler.scheduleWithFixedDelay(
|
||||
regularTask, startTime, interval);
|
||||
|
||||
log.info("交换机 {} [{}] 采集任务启动,间隔: {}秒, 开始时间: {}",
|
||||
log.debug("交换机 {} [{}] 采集任务启动,间隔: {}秒, 开始时间: {}",
|
||||
switchIp, collectVo.getType(), intervalSeconds, startTime);
|
||||
return future;
|
||||
}
|
||||
@@ -521,7 +521,7 @@ public class MultiSwitchCollectionScheduler {
|
||||
|
||||
Instant instant = alignedTime.atZone(shanghaiZone).toInstant();
|
||||
|
||||
log.info("任务启动时间: {} (上海时间), 间隔: {}秒", alignedTime, intervalSeconds);
|
||||
log.debug("任务启动时间: {} (上海时间), 间隔: {}秒", alignedTime, intervalSeconds);
|
||||
return instant;
|
||||
}
|
||||
|
||||
@@ -733,7 +733,7 @@ public class MultiSwitchCollectionScheduler {
|
||||
// 重新启动任务
|
||||
startV3SwitchCollection(switchIp, port, clientId, securityName, authProtocol, authPassword,
|
||||
privProtocol, privPassword, securityLevel, collectVos, switchOidVo);
|
||||
log.info("更新SNMP v3交换机 {} 的采集配置{}", switchIp);
|
||||
log.debug("更新SNMP v3交换机 {} 的采集配置{}", switchIp);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user