与agent交互方式更改,生产者,消费者更改,监控模板策略微调,拓扑管理新增接口,资源组新增查重接口。

This commit is contained in:
gaoyutao
2025-09-22 21:24:06 +08:00
parent a797147d95
commit a9270027f4
27 changed files with 948 additions and 23 deletions

View File

@@ -53,6 +53,16 @@ public class RmEpsTopologyManagementController extends BaseController
List<RmEpsTopologyManagement> list = rmEpsTopologyManagementService.selectRmEpsTopologyManagementList(rmEpsTopologyManagement);
return getDataTable(list);
}
/**
* 查询拓扑管理图形
*/
@RequiresPermissions("system:management:list")
@PostMapping("/getListChart")
public AjaxResult getListChart(@RequestBody RmEpsTopologyManagement rmEpsTopologyManagement)
{
List<RmEpsTopologyManagement> list = rmEpsTopologyManagementService.selectRmEpsTopologyManagementList(rmEpsTopologyManagement);
return success(list);
}
/**
* 导出拓扑管理列表

View File

@@ -112,4 +112,15 @@ public class RmResourceGroupController extends BaseController
{
return R.ok(rmResourceGroupService.selectRmResourceGroupById(id));
}
/**
* 获取资源分组详细信息
*/
@RequiresPermissions("system:group:query")
@PostMapping(value = "/exitsResourceById")
public AjaxResult exitsResourceById(@RequestBody RmResourceGroup rmResourceGroup)
{
// 根据资源id查询该资源是否已经在资源组中
String exits = rmResourceGroupService.exitsResourceById(rmResourceGroup);
return success(exits);
}
}

View File

@@ -73,4 +73,6 @@ public class RmEpsTopologyManagement extends BaseEntity
private String updaterName;
/** 交换机ip */
private String switchIpAddress;
/** 资源名称 */
private String resourceName;
}

View File

@@ -60,5 +60,7 @@ public class RmResourceGroup extends BaseEntity
private String monitorItems;
/** 自动发现项 */
private String discoveryRules;
/** 资源id */
private String resourceIds;
}

View File

@@ -68,6 +68,9 @@ public class RmResourceRegistration extends BaseEntity
/** SNMP采集地址 */
@Excel(name = "SNMP采集地址")
private String snmpCollectAddr;
/** SNMP采集端口 */
@Excel(name = "SNMP采集端口")
private String snmpCollectPort;
/** 安全级别(1.authPriv、2.authNoPriv3.noAuthNoPriv) */
@Excel(name = "安全级别",readConverterExp = "1=authPriv,2=authNoPriv,3=noAuthNoPriv")

View File

@@ -66,4 +66,6 @@ public interface RmResourceGroupMapper
* @return
*/
public RmResourceGroup selectMonitorMsgAndGroupMsg(Long id);
int exitsResourceById(RmResourceGroup rmResourceGroup);
}

View File

@@ -62,4 +62,6 @@ public interface IRmResourceGroupService
public int deleteRmResourceGroupById(Long id);
List<RmResourceRegistration> getRegisterList(RmResourceGroup rmResourceGroup);
String exitsResourceById(RmResourceGroup rmResourceGroup);
}

View File

@@ -124,4 +124,18 @@ public class RmResourceGroupServiceImpl implements IRmResourceGroupService
return rmResourceRegistrationList;
}
}
@Override
public String exitsResourceById(RmResourceGroup rmResourceGroup) {
String ids = rmResourceGroup.getResourceIds();
StringBuilder resultStr = new StringBuilder();
String[] idArray = ids.split(",");
for (String s : idArray) {
int rows = rmResourceGroupMapper.exitsResourceById(rmResourceGroup);
if(rows > 0){
resultStr.append(s);
}
}
return resultStr.toString();
}
}

View File

@@ -221,7 +221,6 @@ public class RmResourceRegistrationServiceImpl implements IRmResourceRegistratio
private void sendRegistrationMessage(RmResourceRegistration registration) {
String messageType = "1".equals(registration.getRegistrationStatus()) ? MsgEnum.注册.getValue() : MsgEnum.断开.getValue();
ResourceVo resourceVo = createResourceVo(registration);
MessageVo messageVo = new MessageVo();
messageVo.setClientId(registration.getHardwareSn());
messageVo.setDataType(messageType);
@@ -240,13 +239,14 @@ public class RmResourceRegistrationServiceImpl implements IRmResourceRegistratio
resourceVo.setClientPort(Integer.valueOf(registration.getResourcePort()));
if (!"1".equals(registration.getResourceType())) {
Map<String, String> switchMap = new HashMap<>();
switchMap.put("community", registration.getTeamName());
switchMap.put("ip", registration.getIpAddress());
switchMap.put("port", registration.getResourcePort());
resourceVo.setSwitchBoard(JSONObject.toJSONString(switchMap));
if("1".equals(registration.getSnmpDetect())){
Map<String, String> switchMap = new HashMap<>();
switchMap.put("community", registration.getTeamName());
switchMap.put("ip", registration.getSnmpCollectAddr());
switchMap.put("port", registration.getSnmpCollectPort());
resourceVo.setSwitchBoard(JSONObject.toJSONString(switchMap));
}
}
return resourceVo;
}

View File

@@ -41,6 +41,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updaterId != null "> and updater_id = #{updaterId}</if>
<if test="updaterName != null and updaterName != ''"> and updater_name like concat('%', #{updaterName}, '%')</if>
<if test="switchIpAddress != null and switchIpAddress != ''"> and switch_ip_address = #{switchIpAddress}</if>
<if test="resourceName != null and resourceName != ''">and (switch_name like concat('%', #{resourceName}, '%') or server_name like concat('%', #{resourceName}, '%'))</if>
</where>
</select>

View File

@@ -101,4 +101,9 @@
select b.monitor_items monitorItems,b.discovery_rules discoveryRules from rm_resource_group a left join rm_monitor_template b on a.id=b.resource_group_id
where FIND_IN_SET(#{id}, a.included_devices_id) > 0
</select>
<select id="exitsResourceById" parameterType="RmResourceGroup" resultType="java.lang.Integer">
select count(1) from rm_resource_group
where FIND_IN_SET(#{resourceIds}, included_devices_id) > 0
</select>
</mapper>

View File

@@ -19,6 +19,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="snmpDetect" column="snmp_detect" />
<result property="teamName" column="team_name" />
<result property="snmpCollectAddr" column="snmp_collect_addr" />
<result property="snmpCollectPort" column="snmp_collect_port" />
<result property="securityLevel" column="security_level" />
<result property="encryption" column="encryption" />
<result property="resourceUserName" column="resource_user_name" />
@@ -39,7 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectRmResourceRegistrationVo">
select id, hardware_sn, resource_type, resource_name, ip_address, resource_port, other_port_name, agent_version, protocol, resource_version, rw_permission, snmp_detect, team_name, snmp_collect_addr, security_level, encryption, resource_user_name, resource_pwd, registration_status, online_status, switch_online_status, description, customer_id, customer_name, service_number, create_time, update_time, creator_id, creator_name, updater_id, updater_name from rm_resource_registration
select id, hardware_sn, resource_type, resource_name, ip_address, resource_port, other_port_name, agent_version, protocol, resource_version, rw_permission, snmp_detect, team_name, snmp_collect_addr, snmp_collect_port, security_level, encryption, resource_user_name, resource_pwd, registration_status, online_status, switch_online_status, description, customer_id, customer_name, service_number, create_time, update_time, creator_id, creator_name, updater_id, updater_name from rm_resource_registration
</sql>
<select id="selectRmResourceRegistrationList" parameterType="RmResourceRegistration" resultMap="RmResourceRegistrationResult">
@@ -58,6 +59,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="snmpDetect != null and snmpDetect != ''"> and snmp_detect = #{snmpDetect}</if>
<if test="teamName != null and teamName != ''"> and team_name like concat('%', #{teamName}, '%')</if>
<if test="snmpCollectAddr != null and snmpCollectAddr != ''"> and snmp_collect_addr = #{snmpCollectAddr}</if>
<if test="snmpCollectPort != null "> and snmp_collect_port = #{snmpCollectPort}</if>
<if test="securityLevel != null and securityLevel != ''"> and security_level = #{securityLevel}</if>
<if test="encryption != null and encryption != ''"> and encryption = #{encryption}</if>
<if test="resourceUserName != null and resourceUserName != ''"> and resource_user_name like concat('%', #{resourceUserName}, '%')</if>
@@ -98,6 +100,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="snmpDetect != null">snmp_detect,</if>
<if test="teamName != null">team_name,</if>
<if test="snmpCollectAddr != null">snmp_collect_addr,</if>
<if test="snmpCollectPort != null">snmp_collect_port,</if>
<if test="securityLevel != null">security_level,</if>
<if test="encryption != null">encryption,</if>
<if test="resourceUserName != null">resource_user_name,</if>
@@ -130,6 +133,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="snmpDetect != null">#{snmpDetect},</if>
<if test="teamName != null">#{teamName},</if>
<if test="snmpCollectAddr != null">#{snmpCollectAddr},</if>
<if test="snmpCollectPort != null">#{snmpCollectPort},</if>
<if test="securityLevel != null">#{securityLevel},</if>
<if test="encryption != null">#{encryption},</if>
<if test="resourceUserName != null">#{resourceUserName},</if>
@@ -166,6 +170,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="snmpDetect != null">snmp_detect = #{snmpDetect},</if>
<if test="teamName != null">team_name = #{teamName},</if>
<if test="snmpCollectAddr != null">snmp_collect_addr = #{snmpCollectAddr},</if>
<if test="snmpCollectPort != null">snmp_collect_port = #{snmpCollectPort},</if>
<if test="securityLevel != null">security_level = #{securityLevel},</if>
<if test="encryption != null">encryption = #{encryption},</if>
<if test="resourceUserName != null">resource_user_name = #{resourceUserName},</if>
@@ -256,6 +261,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="snmpDetect != null">snmp_detect = #{snmpDetect},</if>
<if test="teamName != null">team_name = #{teamName},</if>
<if test="snmpCollectAddr != null">snmp_collect_addr = #{snmpCollectAddr},</if>
<if test="snmpCollectPort != null">snmp_collect_port = #{snmpCollectPort},</if>
<if test="securityLevel != null">security_level = #{securityLevel},</if>
<if test="encryption != null">encryption = #{encryption},</if>
<if test="resourceUserName != null">resource_user_name = #{resourceUserName},</if>