修复网卡信息有变动saas平台未及时更新、脚本策略下发未返回结果bug。
优化mtr探测策略
This commit is contained in:
+1
-1
@@ -20,6 +20,6 @@ public class TongRanMtragentApplication
|
||||
public static void main(String[] args)
|
||||
{
|
||||
SpringApplication.run(TongRanMtragentApplication.class, args);
|
||||
System.out.println("(♥◠‿◠)ノ゙ RuoYiMtragent模块启动成功 ლ(´ڡ`ლ)゙");
|
||||
System.out.println("(♥◠‿◠)ノ゙ TongRanMtragent模块启动成功 ლ(´ڡ`ლ)゙");
|
||||
}
|
||||
}
|
||||
|
||||
+2
@@ -60,4 +60,6 @@ public class RmMtrPolicyConfig extends BaseEntity
|
||||
private Long probeFrequency;
|
||||
/** clientId和ip对应集合 */
|
||||
private Map<String, List<String>> clientIdToIpsMap;
|
||||
/** 查询条件 */
|
||||
private String queryName;
|
||||
}
|
||||
|
||||
+21
-20
@@ -230,27 +230,28 @@ public class MessageHandler {
|
||||
RegisterMsgVo registerMsgVo = interfaces.get(0);
|
||||
String mtrClientId = registerMsgVo.getClientId();
|
||||
List<RmMtrPolicyConfig> mtrPolicyConfigList = rmMtrPolicyConfigService.getPoliciesForMtrClient(mtrClientId);
|
||||
if(mtrPolicyConfigList != null && !mtrPolicyConfigList.isEmpty()){
|
||||
// 构建mtrclient消息
|
||||
String mtrPolicyListStr = JSONObject.toJSONString(mtrPolicyConfigList);
|
||||
PolicyTypeVo policyTypeVo = new PolicyTypeVo();
|
||||
policyTypeVo.setMtrPolicys(mtrPolicyListStr);
|
||||
String configJson = JSONObject.toJSONString(policyTypeVo);
|
||||
try {
|
||||
DeviceMessage message = new DeviceMessage();
|
||||
message.setClientId(mtrClientId);
|
||||
message.setData(configJson);
|
||||
message.setDataType(MsgEnum.获取最新策略应答.getValue());
|
||||
if(mtrPolicyConfigList == null){
|
||||
mtrPolicyConfigList = new ArrayList<>();
|
||||
}
|
||||
// 构建mtrclient消息
|
||||
String mtrPolicyListStr = JSONObject.toJSONString(mtrPolicyConfigList);
|
||||
PolicyTypeVo policyTypeVo = new PolicyTypeVo();
|
||||
policyTypeVo.setMtrPolicys(mtrPolicyListStr);
|
||||
String configJson = JSONObject.toJSONString(policyTypeVo);
|
||||
try {
|
||||
DeviceMessage message = new DeviceMessage();
|
||||
message.setClientId(mtrClientId);
|
||||
message.setData(configJson);
|
||||
message.setDataType(MsgEnum.获取最新策略应答.getValue());
|
||||
|
||||
messageProducer.sendAsyncProducerMessage(
|
||||
producerMode.getAgentTopic(),
|
||||
"",
|
||||
"",
|
||||
JSONObject.toJSONString(message)
|
||||
);
|
||||
} catch (Exception e) {
|
||||
log.error("发送mtr策略失败,mtrClientId: {}", mtrClientId, e);
|
||||
}
|
||||
messageProducer.sendAsyncProducerMessage(
|
||||
producerMode.getAgentTopic(),
|
||||
"",
|
||||
"",
|
||||
JSONObject.toJSONString(message)
|
||||
);
|
||||
} catch (Exception e) {
|
||||
log.error("发送mtr策略失败,mtrClientId: {}", mtrClientId, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-2
@@ -189,9 +189,8 @@ public class RmMtrPolicyConfigServiceImpl implements IRmMtrPolicyConfigService
|
||||
return result;
|
||||
}
|
||||
|
||||
// 查询所有有效的策略(探测标志为1)
|
||||
// 查询所有策略
|
||||
RmMtrPolicyConfig query = new RmMtrPolicyConfig();
|
||||
query.setProbeFlag(1L); // 只查询启用探测的策略
|
||||
List<RmMtrPolicyConfig> allPolicies = rmMtrPolicyConfigMapper.selectRmMtrPolicyConfigList(query);
|
||||
|
||||
if (allPolicies == null || allPolicies.isEmpty()) {
|
||||
|
||||
@@ -14,8 +14,7 @@ spring:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 172.16.15.52:8848
|
||||
# server-addr: 172.16.15.103:8848
|
||||
server-addr: ${spring.cloud.nacos.config.server-addr}
|
||||
namespace: ${spring.cloud.nacos.config.namespace}
|
||||
username: ${spring.cloud.nacos.config.username}
|
||||
password: ${spring.cloud.nacos.config.password}
|
||||
|
||||
+3
@@ -37,6 +37,9 @@
|
||||
<if test="startTime != null "> and start_time = #{startTime}</if>
|
||||
<if test="endTime != null "> and end_time = #{endTime}</if>
|
||||
<if test="probeFrequency != null "> and probe_frequency = #{probeFrequency}</if>
|
||||
<if test="queryName != null "> and (policy_name like concat('%', #{queryName}, '%')
|
||||
or mtr_client_id like concat('%', #{queryName}, '%') or server_group like concat('%', #{queryName}, '%')
|
||||
)</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
+1
-1
@@ -143,6 +143,6 @@
|
||||
<if test="bindIp != null">bind_ip = #{bindIp},</if>
|
||||
<if test="newFlag != null">new_flag = #{newFlag},</if>
|
||||
</trim>
|
||||
where mac_address = #{macAddress} and clientId = #{clientId}
|
||||
where mac_address = #{macAddress} and client_id = #{clientId}
|
||||
</update>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user