优化mtr探测策略
告警日志增加业务名称、告警推送是否成功字段
This commit is contained in:
@@ -23,7 +23,7 @@ spring:
|
||||
server-addr: 172.16.15.52:8848
|
||||
# server-addr: 172.16.15.103:8848
|
||||
# namespace: public
|
||||
namespace: saas-local
|
||||
namespace: saas-prod
|
||||
username: nacos
|
||||
password: nacos
|
||||
# 配置文件格式
|
||||
|
||||
@@ -23,7 +23,7 @@ spring:
|
||||
server-addr: 172.16.15.52:8848
|
||||
# server-addr: 172.16.15.103:8848
|
||||
# namespace: public
|
||||
namespace: saas-local
|
||||
namespace: saas-prod
|
||||
username: nacos
|
||||
password: nacos
|
||||
# 配置文件格式
|
||||
|
||||
+2
-2
@@ -22,7 +22,7 @@
|
||||
//
|
||||
// // quartz参数
|
||||
// Properties prop = new Properties();
|
||||
// prop.put("org.quartz.scheduler.instanceName", "RuoyiScheduler");
|
||||
// prop.put("org.quartz.scheduler.instanceName", "TongRanScheduler");
|
||||
// prop.put("org.quartz.scheduler.instanceId", "AUTO");
|
||||
// // 线程池配置
|
||||
// prop.put("org.quartz.threadPool.class", "org.quartz.simpl.SimpleThreadPool");
|
||||
@@ -42,7 +42,7 @@
|
||||
// prop.put("org.quartz.jobStore.tablePrefix", "QRTZ_");
|
||||
// factory.setQuartzProperties(prop);
|
||||
//
|
||||
// factory.setSchedulerName("RuoyiScheduler");
|
||||
// factory.setSchedulerName("TongRanScheduler");
|
||||
// // 延时启动
|
||||
// factory.setStartupDelay(1);
|
||||
// factory.setApplicationContextSchedulerContextKey("applicationContextKey");
|
||||
|
||||
@@ -97,4 +97,20 @@
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package com.tongran.mtragent.domain.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* mtr探测策略配置对象 rm_mtr_policy_config
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-11-18
|
||||
*/
|
||||
@Data
|
||||
public class RmMtrPolicyConfigVo
|
||||
{
|
||||
/** 开始时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date startTime;
|
||||
|
||||
/** 结束时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date endTime;
|
||||
|
||||
/** 探测频率(秒) */
|
||||
private Long probeFrequency;
|
||||
/** clientId和ip对应集合 */
|
||||
private Map<String, List<String>> clientIdToIpsMap;
|
||||
}
|
||||
+17
-7
@@ -27,8 +27,10 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.math.BigDecimal;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 设备消息处理器
|
||||
@@ -229,12 +231,18 @@ public class MessageHandler {
|
||||
if(!interfaces.isEmpty()) {
|
||||
RegisterMsgVo registerMsgVo = interfaces.get(0);
|
||||
String mtrClientId = registerMsgVo.getClientId();
|
||||
List<RmMtrPolicyConfig> mtrPolicyConfigList = rmMtrPolicyConfigService.getPoliciesForMtrClient(mtrClientId);
|
||||
if(mtrPolicyConfigList == null){
|
||||
mtrPolicyConfigList = new ArrayList<>();
|
||||
}
|
||||
List<RmMtrPolicyConfig> mtrPolicyConfigList = Optional.ofNullable(rmMtrPolicyConfigService.getPoliciesForMtrClient(mtrClientId))
|
||||
.orElse(new ArrayList<>());
|
||||
|
||||
List<RmMtrPolicyConfigVo> rmMtrPolicyConfigVoList = mtrPolicyConfigList.stream()
|
||||
.map(policy -> {
|
||||
RmMtrPolicyConfigVo vo = new RmMtrPolicyConfigVo();
|
||||
BeanUtils.copyProperties(policy, vo);
|
||||
return vo;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
// 构建mtrclient消息
|
||||
String mtrPolicyListStr = JSONObject.toJSONString(mtrPolicyConfigList);
|
||||
String mtrPolicyListStr = JSONObject.toJSONString(rmMtrPolicyConfigVoList);
|
||||
PolicyTypeVo policyTypeVo = new PolicyTypeVo();
|
||||
policyTypeVo.setMtrPolicys(mtrPolicyListStr);
|
||||
String configJson = JSONObject.toJSONString(policyTypeVo);
|
||||
@@ -247,9 +255,11 @@ public class MessageHandler {
|
||||
messageProducer.sendAsyncProducerMessage(
|
||||
producerMode.getAgentTopic(),
|
||||
"",
|
||||
"",
|
||||
"test",
|
||||
JSONObject.toJSONString(message)
|
||||
);
|
||||
int size = message.getData().getBytes(StandardCharsets.UTF_8).length;
|
||||
log.info("消息大小: {} 字节, {} KB", size, size/1024.0);
|
||||
} catch (Exception e) {
|
||||
log.error("发送mtr策略失败,mtrClientId: {}", mtrClientId, e);
|
||||
}
|
||||
@@ -332,7 +342,7 @@ public class MessageHandler {
|
||||
|
||||
// 只有达到3次心跳才执行数据库操作
|
||||
if (newHeartbeatCount >= 3) {
|
||||
log.info("客户端ID: {} 达到{}次心跳,开始执行数据库操作", clientId, newHeartbeatCount);
|
||||
log.debug("客户端ID: {} 达到{}次心跳,开始执行数据库操作", clientId, newHeartbeatCount);
|
||||
// agent更新结果存储
|
||||
RmMtrClientRegistration queryMtrClient = new RmMtrClientRegistration();
|
||||
queryMtrClient.setMtrClientId(clientId);
|
||||
|
||||
+2
-2
@@ -165,7 +165,7 @@ public class MessageProducer {
|
||||
try
|
||||
{
|
||||
Message msg = new Message(topic,tag,key, value.getBytes(RemotingHelper.DEFAULT_CHARSET));
|
||||
System.out.println("生产者发送消息:"+ JSON.toJSONString(value));
|
||||
log.info("生产者发送消息:"+ JSON.toJSONString(value));
|
||||
//设置消息延迟级别,我这里设置5,对应就是延时一分钟
|
||||
// "1s 5s 10s 30s 1m 2m 3m 4m 5m 6m 7m 8m 9m 10m 20m 30m 1h 2h"
|
||||
msg.setDelayTimeLevel(level);
|
||||
@@ -197,7 +197,7 @@ public class MessageProducer {
|
||||
try {
|
||||
//创建一个消息实例,指定主题、标签和消息体。
|
||||
Message msg = new Message(topic,tag,key, value.getBytes(RemotingHelper.DEFAULT_CHARSET));
|
||||
System.out.println("生产者发送消息:"+ JSON.toJSONString(value));
|
||||
log.info("生产者发送消息:"+ JSON.toJSONString(value));
|
||||
producer.send(msg,new SendCallback() {
|
||||
// 异步回调的处理
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ public class RmMtrClientRegistrationServiceImpl implements IRmMtrClientRegistrat
|
||||
List<RmMtrClientRegistration> list = rmMtrClientRegistrationMapper.selectRmMtrClientRegistrationList(rmMtrClientRegistration);
|
||||
for (RmMtrClientRegistration mtrClientRegistration : list) {
|
||||
// 处理网卡信息
|
||||
setNetworkMsg(rmMtrClientRegistration);
|
||||
setNetworkMsg(mtrClientRegistration);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
+2
@@ -150,6 +150,8 @@ public class RmMtrPolicyConfigServiceImpl implements IRmMtrPolicyConfigService
|
||||
public int updateRmMtrPolicyConfig(RmMtrPolicyConfig rmMtrPolicyConfig)
|
||||
{
|
||||
rmMtrPolicyConfig.setUpdateTime(DateUtils.getNowDate());
|
||||
// 给ip赋值
|
||||
setServerip(rmMtrPolicyConfig);
|
||||
return rmMtrPolicyConfigMapper.updateRmMtrPolicyConfig(rmMtrPolicyConfig);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ spring:
|
||||
server-addr: 172.16.15.52:8848
|
||||
# server-addr: 172.16.15.103:8848
|
||||
# namespace: public
|
||||
namespace: saas-local
|
||||
namespace: saas-prod
|
||||
username: nacos
|
||||
password: nacos
|
||||
# 配置文件格式
|
||||
|
||||
+11
-1
@@ -58,6 +58,12 @@ public class TableScheduleConfig {
|
||||
// 每天0点执行 计算95带宽值/日
|
||||
@Scheduled(cron = "0 4 0 * * ?", zone = "Asia/Shanghai")
|
||||
public void calculate95BandwidthDaily() {
|
||||
// 获取当月的日期范围
|
||||
LocalDate lastMonth = LocalDate.now(ZoneId.of("Asia/Shanghai"));
|
||||
LocalDate firstDayOfMonth = lastMonth.withDayOfMonth(1);
|
||||
LocalDate lastDayOfMonth = lastMonth.withDayOfMonth(lastMonth.lengthOfMonth());
|
||||
String monthlyStartTime = firstDayOfMonth.atStartOfDay().format(TIME_FORMAT);
|
||||
String monthlyEndTime = lastDayOfMonth.atTime(23, 59, 59).format(TIME_FORMAT);
|
||||
// 获取昨天的日期范围(北京时间)
|
||||
LocalDate yesterday = LocalDate.now(ZoneId.of("Asia/Shanghai")).minusDays(1);
|
||||
String dailyStartTime = yesterday.atStartOfDay().format(TIME_FORMAT); // 00:00:00
|
||||
@@ -77,7 +83,11 @@ public class TableScheduleConfig {
|
||||
.thenRun(() -> executeWithLog("交换机带宽1000",
|
||||
() -> initialSwitchInfoDetailsService.calculateSwitch95BandwidthDaily(initialSwitchInfoDetails, dailyStartTime, dailyEndTime, "1000")))
|
||||
.thenRun(() -> executeWithLog("交换机带宽1024",
|
||||
() -> initialSwitchInfoDetailsService.calculateSwitch95BandwidthDaily(initialSwitchInfoDetails, dailyStartTime, dailyEndTime, "1024")));
|
||||
() -> initialSwitchInfoDetailsService.calculateSwitch95BandwidthDaily(initialSwitchInfoDetails, dailyStartTime, dailyEndTime, "1024")))
|
||||
.thenRun(() -> calculateSwitchMonthlyBandwidth(monthlyStartTime, monthlyEndTime, "1000"))
|
||||
.thenRun(() -> calculateSwitchMonthlyBandwidth(monthlyStartTime, monthlyEndTime, "1024"))
|
||||
.thenRun(() -> calculateSwitchAvgMonthlyBandwidth(monthlyStartTime, monthlyEndTime, "1000"))
|
||||
.thenRun(() -> calculateSwitchAvgMonthlyBandwidth(monthlyStartTime, monthlyEndTime, "1024"));
|
||||
}
|
||||
// 每天5点04执行 计算金山95带宽值/日
|
||||
@Scheduled(cron = "0 4 5 * * ?", zone = "Asia/Shanghai")
|
||||
|
||||
+3
@@ -5,6 +5,7 @@ import com.tongran.common.core.annotation.Excel;
|
||||
import com.tongran.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -224,4 +225,6 @@ public class RmResourceRegistration extends BaseEntity
|
||||
private boolean businessEmpty;
|
||||
/** 逻辑节点空标识 */
|
||||
private boolean logicalNodeEmpty;
|
||||
/** 昨日95值 */
|
||||
private BigDecimal bandwidthResult;
|
||||
}
|
||||
-2
@@ -191,8 +191,6 @@ public class EpsNodeBandwidthServiceImpl implements IEpsNodeBandwidthService
|
||||
|
||||
// 4. 安全获取求和值
|
||||
BigDecimal sum95Daily = Optional.ofNullable(calculatedData.getBandwidth95Daily()).orElse(BigDecimal.ZERO);
|
||||
BigDecimal sumEffectiveBandwidth95Daily = Optional.ofNullable(calculatedData.getEffectiveBandwidth95Daily()).orElse(BigDecimal.ZERO);
|
||||
|
||||
// 5. 计算当月天数
|
||||
LocalDate monthTime;
|
||||
try {
|
||||
|
||||
+21
@@ -23,6 +23,8 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -68,6 +70,8 @@ public class RmResourceRegistrationServiceImpl implements IRmResourceRegistratio
|
||||
setNetWorkMsg(rmResourceRegistration);
|
||||
// set金山machineCode
|
||||
setMachineMsg(rmResourceRegistration);
|
||||
// set昨日95值
|
||||
setBandwidthYestoday(rmResourceRegistration);
|
||||
}
|
||||
return rmResourceRegistration;
|
||||
}
|
||||
@@ -93,6 +97,8 @@ public class RmResourceRegistrationServiceImpl implements IRmResourceRegistratio
|
||||
if(resourceRegistration.getClientId() != null){
|
||||
// 网卡信息
|
||||
setNetWorkMsg(resourceRegistration);
|
||||
// set昨日95值
|
||||
setBandwidthYestoday(resourceRegistration);
|
||||
}
|
||||
}
|
||||
if(rmResourceRegistration.getQueryParam() != null && !rmResourceRegistration.getQueryParam().trim().isEmpty()){
|
||||
@@ -297,6 +303,21 @@ public class RmResourceRegistrationServiceImpl implements IRmResourceRegistratio
|
||||
registration.setMachineCode(machineMsg.getMachineCode());
|
||||
}
|
||||
}
|
||||
|
||||
public void setBandwidthYestoday(RmResourceRegistration registration){
|
||||
// 查询昨日95值
|
||||
String yesterday = LocalDate.now().minusDays(1).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));;
|
||||
Date yesterdayDate = DateUtils.parseDate(yesterday);
|
||||
EpsNodeBandwidth epsNodeBandwidth = new EpsNodeBandwidth();
|
||||
epsNodeBandwidth.setClientId(registration.getClientId());
|
||||
epsNodeBandwidth.setBandwidthType("1");
|
||||
epsNodeBandwidth.setCreateTime(yesterdayDate);
|
||||
List<EpsNodeBandwidth> nodeBandwidthList = epsNodeBandwidthMapper.selectEpsNodeBandwidthList(epsNodeBandwidth);
|
||||
if(nodeBandwidthList != null && !nodeBandwidthList.isEmpty()){
|
||||
EpsNodeBandwidth nodeBandwidth = nodeBandwidthList.get(0);
|
||||
registration.setBandwidthResult(nodeBandwidth.getBandwidthResult());
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 新增资源注册
|
||||
*
|
||||
|
||||
@@ -21,7 +21,7 @@ spring:
|
||||
# 配置中心地址
|
||||
server-addr: 172.16.15.52:8848
|
||||
# server-addr: 172.16.15.103:8848
|
||||
namespace: saas-local
|
||||
namespace: saas-prod
|
||||
# namespace: public
|
||||
username: nacos
|
||||
password: nacos
|
||||
|
||||
+1
-2
@@ -230,8 +230,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</delete>
|
||||
|
||||
<select id="calculateAvg" parameterType="EpsNodeBandwidth" resultType="EpsNodeBandwidth">
|
||||
select sum(ifnull(bandwidth_95_daily,0)) bandwidth95Daily,
|
||||
sum(ifnull(effective_bandwidth_95_daily,0)) effectiveBandwidth95Daily
|
||||
select sum(ifnull(bandwidth_95_daily,0)) bandwidth95Daily
|
||||
from eps_node_bandwidth
|
||||
<where>
|
||||
<if test="startTime != null">
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,7 +22,7 @@ spring:
|
||||
# 配置中心地址
|
||||
server-addr: 172.16.15.52:8848
|
||||
# server-addr: 172.16.15.103:8848
|
||||
namespace: saas-local
|
||||
namespace: saas-prod
|
||||
# namespace: public
|
||||
username: nacos
|
||||
password: nacos
|
||||
|
||||
Reference in New Issue
Block a user