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