优化agent多网卡ip探测功能
This commit is contained in:
@@ -303,7 +303,9 @@ public class AgentServiceImpl implements AgentService {
|
||||
long milli = AgentUtil.getMillisToNextMinute() + 60000;
|
||||
AssertLog.info("启动更新策略定时任务 - 延迟: {}ms, 间隔: {}ms", milli, 60000);
|
||||
dynamicTaskService.scheduleTask("policy", businessTasks::policyTask, milli, 60000);
|
||||
|
||||
// 创建多网IP探测上报
|
||||
AssertLog.info("启动多网IP探测定时任务 - 延迟: {}ms, 间隔: {}ms", milli, 300000);
|
||||
dynamicTaskService.scheduleTask("networkDetect", businessTasks::networkDetectTask, milli, 300000);
|
||||
// 检测监控策略配置
|
||||
AssertLog.info("检测监控策略配置");
|
||||
checkMonitor();
|
||||
|
||||
@@ -100,10 +100,10 @@ public class NetworkInterfaceUtil {
|
||||
} else {
|
||||
AssertLog.info(" 未能提取公网 IP 地址");
|
||||
}
|
||||
if (StringUtils.isBlank(publicIp)) {
|
||||
AssertLog.info(" 跳过网卡 {}: 无公网IP", name);
|
||||
continue;
|
||||
}
|
||||
// if (StringUtils.isBlank(publicIp)) {
|
||||
// AssertLog.info(" 跳过网卡 {}: 无公网IP", name);
|
||||
// continue;
|
||||
// }
|
||||
for (String ip : publicIps) {
|
||||
if (ip != null && !ip.isEmpty()) {
|
||||
// 删除临时路由
|
||||
|
||||
@@ -47,7 +47,7 @@ public class NetworkUtil {
|
||||
ip + "/" + prefix, "via", gateway, "dev", dev);
|
||||
return pb.start().waitFor() == 0;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
AssertLog.error("删除路由失败:{}", e.getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ logging:
|
||||
netty:
|
||||
server:
|
||||
host: 120.211.95.173
|
||||
port: 56620
|
||||
port: 6620
|
||||
client:
|
||||
client-id: client-001
|
||||
reconnect-interval: 5
|
||||
|
||||
@@ -6,12 +6,13 @@ spring:
|
||||
matching-strategy: ant_path_matcher
|
||||
application:
|
||||
name: tr-agent-client
|
||||
version: 1.1.7
|
||||
version: 1.1.10
|
||||
conf-path: /usr/local/tongran/conf
|
||||
script-path: /usr/local/tongran/sbin
|
||||
tmp-path: /usr/local/tongran/tmp
|
||||
temp-path: /usr/local/tongran/temp
|
||||
frp-path: /usr/local/tongran/frp
|
||||
poe-path: /usr/local/tongran/sbin/pppoe1
|
||||
web:
|
||||
resources:
|
||||
static-locations: classpath*:/META-INF/resources/
|
||||
|
||||
Reference in New Issue
Block a user