资源模板以及资源策略模块方法和接口。
This commit is contained in:
+42
@@ -0,0 +1,42 @@
|
||||
package com.ruoyi.rocketmq.controller;
|
||||
|
||||
import com.ruoyi.common.core.web.controller.BaseController;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.rocketmq.domain.RmInitialMonitorItem;
|
||||
import com.ruoyi.rocketmq.service.IRmInitialMonitorItemService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 基础监控项Controller
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-09-10
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/initialMonitorItem")
|
||||
public class RmInitialMonitorItemController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IRmInitialMonitorItemService rmInitialMonitorItemService;
|
||||
|
||||
/**
|
||||
* 查询监控项列表
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:item:list")
|
||||
@PostMapping("/list")
|
||||
public AjaxResult list(@RequestBody RmInitialMonitorItem rmInitialMonitorItem)
|
||||
{
|
||||
Map<String, List<RmInitialMonitorItem>> map = rmInitialMonitorItemService.selectAllMsgList(rmInitialMonitorItem);
|
||||
return success(map);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
package com.ruoyi.rocketmq.controller;
|
||||
|
||||
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.web.controller.BaseController;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.web.page.TableDataInfo;
|
||||
import com.ruoyi.common.log.annotation.Log;
|
||||
import com.ruoyi.common.log.enums.BusinessType;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.rocketmq.domain.RmMonitorPolicy;
|
||||
import com.ruoyi.rocketmq.service.IRmMonitorPolicyService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 资源监控策略Controller
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-09-10
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/policy")
|
||||
public class RmMonitorPolicyController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IRmMonitorPolicyService rmMonitorPolicyService;
|
||||
|
||||
/**
|
||||
* 查询资源监控策略列表
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:policy:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(RmMonitorPolicy rmMonitorPolicy)
|
||||
{
|
||||
startPage();
|
||||
List<RmMonitorPolicy> list = rmMonitorPolicyService.selectRmMonitorPolicyList(rmMonitorPolicy);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出资源监控策略列表
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:policy:export")
|
||||
@Log(title = "资源监控策略", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, RmMonitorPolicy rmMonitorPolicy)
|
||||
{
|
||||
List<RmMonitorPolicy> list = rmMonitorPolicyService.selectRmMonitorPolicyList(rmMonitorPolicy);
|
||||
ExcelUtil<RmMonitorPolicy> util = new ExcelUtil<RmMonitorPolicy>(RmMonitorPolicy.class);
|
||||
util.exportExcel(response, list, "资源监控策略数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取资源监控策略详细信息
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:policy:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(rmMonitorPolicyService.getRmMonitorPolicyMsgById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增资源监控策略
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:policy:add")
|
||||
@Log(title = "资源监控策略", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody RmMonitorPolicy rmMonitorPolicy)
|
||||
{
|
||||
return toAjax(rmMonitorPolicyService.addRmMonitorPolicy(rmMonitorPolicy));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改资源监控策略
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:policy:edit")
|
||||
@Log(title = "资源监控策略", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody RmMonitorPolicy rmMonitorPolicy)
|
||||
{
|
||||
return toAjax(rmMonitorPolicyService.updateRmMonitorPolicy(rmMonitorPolicy));
|
||||
}
|
||||
/**
|
||||
* 资源监控策略下发
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:policy:edit")
|
||||
@Log(title = "资源监控策略下发", businessType = BusinessType.UPDATE)
|
||||
@GetMapping("/issuePolicy")
|
||||
public AjaxResult issuePolicy(Long id)
|
||||
{
|
||||
return toAjax(rmMonitorPolicyService.issuePolicy(id));
|
||||
}
|
||||
|
||||
}
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
package com.ruoyi.rocketmq.controller;
|
||||
|
||||
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.web.controller.BaseController;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.web.page.PageDomain;
|
||||
import com.ruoyi.common.core.web.page.TableDataInfo;
|
||||
import com.ruoyi.common.log.annotation.Log;
|
||||
import com.ruoyi.common.log.enums.BusinessType;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.rocketmq.domain.RmMonitorTemplate;
|
||||
import com.ruoyi.rocketmq.domain.vo.RmMonitorTemplateVo;
|
||||
import com.ruoyi.rocketmq.service.IRmMonitorTemplateService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 监控模板Controller
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-09-09
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/template")
|
||||
public class RmMonitorTemplateController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IRmMonitorTemplateService rmMonitorTemplateService;
|
||||
|
||||
/**
|
||||
* 查询监控模板列表
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:template:list")
|
||||
@PostMapping("/list")
|
||||
public TableDataInfo list(@RequestBody RmMonitorTemplate rmMonitorTemplate)
|
||||
{
|
||||
PageDomain pageDomain = new PageDomain();
|
||||
pageDomain.setPageNum(rmMonitorTemplate.getPageNum());
|
||||
pageDomain.setPageSize(rmMonitorTemplate.getPageSize());
|
||||
startPage(pageDomain);
|
||||
List<RmMonitorTemplate> list = rmMonitorTemplateService.selectRmMonitorTemplateList(rmMonitorTemplate);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出监控模板列表
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:template:export")
|
||||
@Log(title = "监控模板", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, RmMonitorTemplate rmMonitorTemplate)
|
||||
{
|
||||
List<RmMonitorTemplate> list = rmMonitorTemplateService.selectRmMonitorTemplateList(rmMonitorTemplate);
|
||||
ExcelUtil<RmMonitorTemplate> util = new ExcelUtil<RmMonitorTemplate>(RmMonitorTemplate.class);
|
||||
util.exportExcel(response, list, "监控模板数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取监控模板详细信息
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:template:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(rmMonitorTemplateService.getTemplateMsgById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增监控模板
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:template:add")
|
||||
@Log(title = "监控模板", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody RmMonitorTemplateVo rmMonitorTemplateVo)
|
||||
{
|
||||
return toAjax(rmMonitorTemplateService.addRmMonitorTemplate(rmMonitorTemplateVo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改监控模板
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:template:edit")
|
||||
@Log(title = "监控模板", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody RmMonitorTemplate rmMonitorTemplate)
|
||||
{
|
||||
return toAjax(rmMonitorTemplateService.updateRmMonitorTemplate(rmMonitorTemplate));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除监控模板
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:template:remove")
|
||||
@Log(title = "监控模板", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(rmMonitorTemplateService.deleteRmMonitorTemplateByIds(ids));
|
||||
}
|
||||
}
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
package com.ruoyi.rocketmq.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.log.annotation.Log;
|
||||
import com.ruoyi.common.log.enums.BusinessType;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.rocketmq.domain.RmTemplateLinux;
|
||||
import com.ruoyi.rocketmq.service.IRmTemplateLinuxService;
|
||||
import com.ruoyi.common.core.web.controller.BaseController;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.web.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* Linux系统监控项Controller
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-09-09
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/linux")
|
||||
public class RmTemplateLinuxController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IRmTemplateLinuxService rmTemplateLinuxService;
|
||||
|
||||
/**
|
||||
* 查询Linux系统监控项列表
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:linux:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(RmTemplateLinux rmTemplateLinux)
|
||||
{
|
||||
startPage();
|
||||
List<RmTemplateLinux> list = rmTemplateLinuxService.selectRmTemplateLinuxList(rmTemplateLinux);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出Linux系统监控项列表
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:linux:export")
|
||||
@Log(title = "Linux系统监控项", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, RmTemplateLinux rmTemplateLinux)
|
||||
{
|
||||
List<RmTemplateLinux> list = rmTemplateLinuxService.selectRmTemplateLinuxList(rmTemplateLinux);
|
||||
ExcelUtil<RmTemplateLinux> util = new ExcelUtil<RmTemplateLinux>(RmTemplateLinux.class);
|
||||
util.exportExcel(response, list, "Linux系统监控项数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取Linux系统监控项详细信息
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:linux:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(rmTemplateLinuxService.selectRmTemplateLinuxById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增Linux系统监控项
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:linux:add")
|
||||
@Log(title = "Linux系统监控项", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody RmTemplateLinux rmTemplateLinux)
|
||||
{
|
||||
return toAjax(rmTemplateLinuxService.insertRmTemplateLinux(rmTemplateLinux));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改Linux系统监控项
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:linux:edit")
|
||||
@Log(title = "Linux系统监控项", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody RmTemplateLinux rmTemplateLinux)
|
||||
{
|
||||
return toAjax(rmTemplateLinuxService.updateRmTemplateLinux(rmTemplateLinux));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除Linux系统监控项
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:linux:remove")
|
||||
@Log(title = "Linux系统监控项", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(rmTemplateLinuxService.deleteRmTemplateLinuxByIds(ids));
|
||||
}
|
||||
}
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
package com.ruoyi.rocketmq.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.log.annotation.Log;
|
||||
import com.ruoyi.common.log.enums.BusinessType;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.rocketmq.domain.RmTemplateSwitch;
|
||||
import com.ruoyi.rocketmq.service.IRmTemplateSwitchService;
|
||||
import com.ruoyi.common.core.web.controller.BaseController;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.web.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 交换机监控模板Controller
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-09-09
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/switch")
|
||||
public class RmTemplateSwitchController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IRmTemplateSwitchService rmTemplateSwitchService;
|
||||
|
||||
/**
|
||||
* 查询交换机监控模板列表
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:switch:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(RmTemplateSwitch rmTemplateSwitch)
|
||||
{
|
||||
startPage();
|
||||
List<RmTemplateSwitch> list = rmTemplateSwitchService.selectRmTemplateSwitchList(rmTemplateSwitch);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出交换机监控模板列表
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:switch:export")
|
||||
@Log(title = "交换机监控模板", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, RmTemplateSwitch rmTemplateSwitch)
|
||||
{
|
||||
List<RmTemplateSwitch> list = rmTemplateSwitchService.selectRmTemplateSwitchList(rmTemplateSwitch);
|
||||
ExcelUtil<RmTemplateSwitch> util = new ExcelUtil<RmTemplateSwitch>(RmTemplateSwitch.class);
|
||||
util.exportExcel(response, list, "交换机监控模板数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取交换机监控模板详细信息
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:switch:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(rmTemplateSwitchService.selectRmTemplateSwitchById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增交换机监控模板
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:switch:add")
|
||||
@Log(title = "交换机监控模板", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody RmTemplateSwitch rmTemplateSwitch)
|
||||
{
|
||||
return toAjax(rmTemplateSwitchService.insertRmTemplateSwitch(rmTemplateSwitch));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改交换机监控模板
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:switch:edit")
|
||||
@Log(title = "交换机监控模板", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody RmTemplateSwitch rmTemplateSwitch)
|
||||
{
|
||||
return toAjax(rmTemplateSwitchService.updateRmTemplateSwitch(rmTemplateSwitch));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除交换机监控模板
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:switch:remove")
|
||||
@Log(title = "交换机监控模板", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(rmTemplateSwitchService.deleteRmTemplateSwitchByIds(ids));
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.ruoyi.rocketmq.controller;
|
||||
|
||||
|
||||
import com.ruoyi.common.security.annotation.InnerAuth;
|
||||
import com.ruoyi.rocketmq.producer.MessageProducer;
|
||||
import org.apache.rocketmq.client.producer.SendResult;
|
||||
import org.apache.rocketmq.common.message.Message;
|
||||
@@ -124,11 +125,12 @@ public class RocketMqController {
|
||||
/**
|
||||
* 发送异步的消息
|
||||
*/
|
||||
@InnerAuth
|
||||
@PostMapping("/sendAsyncProducerMessage")
|
||||
private Map sendAsyncProducerMessage(@RequestParam("topic") String topic,@RequestParam("tag") String tag,@RequestParam("key") String key,@RequestParam("value") String value){
|
||||
MessageProducer messageProducer = new MessageProducer();
|
||||
//调用MessageProducer配置好的消息方法 topic需要你根据你们业务定制相应的
|
||||
SendResult sendResult = messageProducer.sendAsyncProducerMessage("order-message","order_timeout_tag","title","content");
|
||||
SendResult sendResult = messageProducer.sendAsyncProducerMessage(topic,tag,key,value);
|
||||
Map<String,Object> result = new HashMap<>();
|
||||
result.put("data",sendResult);
|
||||
return result;
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.ruoyi.rocketmq.domain;
|
||||
|
||||
import com.ruoyi.common.core.annotation.Excel;
|
||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 基础监控项对象 rm_initial_monitor_item
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-09-10
|
||||
*/
|
||||
@Data
|
||||
public class RmInitialMonitorItem extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键ID */
|
||||
private Long id;
|
||||
|
||||
/** 监控项类型(监控项,自动发现项) */
|
||||
@Excel(name = "监控项类型(监控项,自动发现项)")
|
||||
private String itemType;
|
||||
|
||||
/** 监控标识(唯一键) */
|
||||
@Excel(name = "监控标识(唯一键)")
|
||||
private String metricKey;
|
||||
|
||||
/** 监控名称 */
|
||||
@Excel(name = "监控名称")
|
||||
private String metricName;
|
||||
|
||||
/** 监控OID */
|
||||
@Excel(name = "监控OID")
|
||||
private String oid;
|
||||
|
||||
/** 过滤值 */
|
||||
@Excel(name = "过滤值")
|
||||
private String filterValue;
|
||||
|
||||
/** 监控说明 */
|
||||
@Excel(name = "监控说明")
|
||||
private String monitorDescription;
|
||||
|
||||
/** 数据类型 */
|
||||
@Excel(name = "数据类型")
|
||||
private String dataType;
|
||||
|
||||
/** 资源类型 */
|
||||
@Excel(name = "资源类型")
|
||||
private String resourceType;
|
||||
/** 采集周期 */
|
||||
@Excel(name = "采集周期")
|
||||
private String collectionCycle;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.ruoyi.rocketmq.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ruoyi.common.core.annotation.Excel;
|
||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||
import com.ruoyi.rocketmq.domain.vo.RmMonitorPolicyVo;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 资源监控策略对象 rm_monitor_policy
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-09-10
|
||||
*/
|
||||
@Data
|
||||
public class RmMonitorPolicy extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键ID */
|
||||
private Long id;
|
||||
|
||||
/** 模板ID */
|
||||
@Excel(name = "模板ID")
|
||||
private Long templateId;
|
||||
|
||||
/** 资源组ID */
|
||||
@Excel(name = "资源组ID")
|
||||
private Long resourceGroupId;
|
||||
/** 资源组名称 */
|
||||
private String resourceGroupName;
|
||||
|
||||
/** 策略名称 */
|
||||
@Excel(name = "策略名称")
|
||||
private String policyName;
|
||||
|
||||
/** 描述 */
|
||||
@Excel(name = "描述")
|
||||
private String description;
|
||||
|
||||
/** 状态:0-待下发,1-已下发 */
|
||||
@Excel(name = "状态:0-待下发,1-已下发")
|
||||
private String status;
|
||||
|
||||
/** 下发策略时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "下发策略时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date deployTime;
|
||||
/** 采集周期及id集合 */
|
||||
private List<RmMonitorPolicyVo> collectionAndIdList;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.ruoyi.rocketmq.domain;
|
||||
|
||||
import com.ruoyi.common.core.annotation.Excel;
|
||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 监控模板对象 rm_monitor_template
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-09-09
|
||||
*/
|
||||
@Data
|
||||
public class RmMonitorTemplate extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键ID */
|
||||
private Long id;
|
||||
|
||||
/** 模板名称 */
|
||||
@Excel(name = "模板名称")
|
||||
private String templateName;
|
||||
|
||||
/** 模板描述 */
|
||||
@Excel(name = "模板描述")
|
||||
private String description;
|
||||
|
||||
/** 监控项 */
|
||||
@Excel(name = "监控项")
|
||||
private String monitorItems;
|
||||
|
||||
/** 自动发现项 */
|
||||
@Excel(name = "自动发现项")
|
||||
private String discoveryRules;
|
||||
|
||||
/** 资源组ID */
|
||||
@Excel(name = "资源组ID")
|
||||
private Long resourceGroupId;
|
||||
/** 资源组名称 */
|
||||
private String resourceGroupName;
|
||||
/** 资源类型(linux,switch) */
|
||||
private String resourcyType;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.ruoyi.rocketmq.domain;
|
||||
|
||||
import com.ruoyi.common.core.annotation.Excel;
|
||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* Linux系统监控项对象 rm_template_linux
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-09-09
|
||||
*/
|
||||
@Data
|
||||
public class RmTemplateLinux extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键ID */
|
||||
private Long id;
|
||||
|
||||
/** 关联的模板ID */
|
||||
@Excel(name = "关联的模板ID")
|
||||
private Long templateId;
|
||||
|
||||
/** 关联的策略ID */
|
||||
private Long policyId;
|
||||
|
||||
/** 监控项类型 */
|
||||
@Excel(name = "监控项类型")
|
||||
private String itemType;
|
||||
|
||||
/** 监控标识(唯一键) */
|
||||
@Excel(name = "监控标识(唯一键)")
|
||||
private String metricKey;
|
||||
|
||||
/** 监控名称 */
|
||||
@Excel(name = "监控名称")
|
||||
private String metricName;
|
||||
|
||||
/** 数据类型 */
|
||||
@Excel(name = "数据类型")
|
||||
private String dataType;
|
||||
|
||||
/** 监控状态(0-禁用,1启用) */
|
||||
@Excel(name = "监控状态(0-禁用,1启用)")
|
||||
private String monitorStatus;
|
||||
/** 采集周期 */
|
||||
private Long collectionCycle;
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.ruoyi.rocketmq.domain;
|
||||
|
||||
import com.ruoyi.common.core.annotation.Excel;
|
||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 交换机监控模板对象 rm_template_switch
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-09-09
|
||||
*/
|
||||
@Data
|
||||
public class RmTemplateSwitch extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键ID */
|
||||
private Long id;
|
||||
|
||||
/** 关联的模板ID */
|
||||
@Excel(name = "关联的模板ID")
|
||||
private Long templateId;
|
||||
|
||||
/** 关联的策略ID */
|
||||
private Long policyId;
|
||||
|
||||
/** 监控项类型 */
|
||||
@Excel(name = "监控项类型")
|
||||
private String itemType;
|
||||
|
||||
/** 监控标识(唯一键) */
|
||||
@Excel(name = "监控标识(唯一键)")
|
||||
private String metricKey;
|
||||
|
||||
/** 监控名称 */
|
||||
@Excel(name = "监控名称")
|
||||
private String metricName;
|
||||
|
||||
/** 监控OID(SNMP标识) */
|
||||
@Excel(name = "监控OID(SNMP标识)")
|
||||
private String oid;
|
||||
|
||||
/** 过滤值(用于特定端口或接口过滤) */
|
||||
@Excel(name = "过滤值(用于特定端口或接口过滤)")
|
||||
private String filterValue;
|
||||
|
||||
/** 监控说明 */
|
||||
@Excel(name = "监控说明")
|
||||
private String switchDescription;
|
||||
|
||||
/** 数据类型 */
|
||||
@Excel(name = "数据类型")
|
||||
private String dataType;
|
||||
|
||||
/** 监控状态(0-禁用,1启用) */
|
||||
@Excel(name = "监控状态(0-禁用,1启用)")
|
||||
private String monitorStatus;
|
||||
/** 采集周期 */
|
||||
private Long collectionCycle;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.ruoyi.rocketmq.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CollectVo {
|
||||
/** 采集类型 */
|
||||
private String type;
|
||||
/** 是否采集 */
|
||||
private boolean collect = false;
|
||||
/** 采集周期 */
|
||||
private Long interval = 300L;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.ruoyi.rocketmq.domain.vo;
|
||||
|
||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 资源监控策略对象 rm_monitor_policy
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-09-10
|
||||
*/
|
||||
@Data
|
||||
public class RmMonitorPolicyVo extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键ID */
|
||||
private Long id;
|
||||
|
||||
/** 采集周期 */
|
||||
private Long collectionCycle;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.ruoyi.rocketmq.domain.vo;
|
||||
|
||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 监控模板对象 rm_monitor_template业务类
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-09-09
|
||||
*/
|
||||
@Data
|
||||
public class RmMonitorTemplateVo extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键ID */
|
||||
private Long id;
|
||||
|
||||
/** 模板名称 */
|
||||
private String templateName;
|
||||
|
||||
/** 模板描述 */
|
||||
private String description;
|
||||
|
||||
/** 监控项 */
|
||||
private String monitorItems;
|
||||
|
||||
/** 自动发现项 */
|
||||
private String discoveryRules;
|
||||
|
||||
/** 资源组ID */
|
||||
private Long resourceGroupId;
|
||||
|
||||
/** 关联的模板ID */
|
||||
private Long templateId;
|
||||
/** 监控项类型 */
|
||||
private String itemType;
|
||||
/** 监控标识(唯一键) */
|
||||
private String metricKey;
|
||||
|
||||
/** 监控名称 */
|
||||
private String metricName;
|
||||
|
||||
/** 数据类型 */
|
||||
private String dataType;
|
||||
|
||||
/** 监控状态(0-禁用,1启用) */
|
||||
private String monitorStatus;
|
||||
/** 监控OID(SNMP标识) */
|
||||
private String oid;
|
||||
|
||||
/** 过滤值(用于特定端口或接口过滤) */
|
||||
private String filterValue;
|
||||
|
||||
/** 监控说明 */
|
||||
private String switchDescription;
|
||||
/**
|
||||
* 资源类型,linux,switch
|
||||
*/
|
||||
private String resourceType;
|
||||
/**
|
||||
* 监控ids
|
||||
*/
|
||||
private Long[] monitorIds;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.ruoyi.rocketmq.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 控制码
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public enum MsgEnum {
|
||||
|
||||
注册("REGISTER"),
|
||||
|
||||
注册应答("REGISTER_RSP"),
|
||||
|
||||
断开("DISCONNECT"),
|
||||
|
||||
断开应答("DISCONNECT_RSP"),
|
||||
|
||||
心跳上报("HEARTBEAT"),
|
||||
|
||||
CPU上报("CPU"),
|
||||
|
||||
磁盘上报("DISK"),
|
||||
|
||||
容器上报("DOCKER"),
|
||||
|
||||
内存上报("MEMORY"),
|
||||
|
||||
网络上报("NET"),
|
||||
|
||||
挂载上报("POINT"),
|
||||
|
||||
系统其他上报("OTHER_SYSTEM"),
|
||||
|
||||
交换机上报("SWITCHBOARD"),
|
||||
|
||||
开启系统采集("SYSTEM_COLLECT_START"),
|
||||
|
||||
开启系统采集应答("SYSTEM_COLLECT_START_RSP"),
|
||||
|
||||
关闭系统采集("SYSTEM_COLLECT_STOP"),
|
||||
|
||||
关闭系统采集应答("SYSTEM_COLLECT_STOP_RSP"),
|
||||
|
||||
开启交换机采集("SWITCH_COLLECT_START"),
|
||||
|
||||
开启交换机采集应答("SWITCH_COLLECT_START_RSP"),
|
||||
|
||||
关闭交换机采集("SWITCH_COLLECT_STOP"),
|
||||
|
||||
关闭交换机采集应答("SWITCH_COLLECT_STOP_RSP"),
|
||||
|
||||
告警设置("ALARM_SET"),
|
||||
|
||||
告警设置应答("ALARM_SET_RSP"),
|
||||
|
||||
执行脚本策略("SCRIPT_POLICY"),
|
||||
|
||||
执行脚本策略应答("SCRIPT_POLICY_RSP"),
|
||||
|
||||
Agent版本更新("AGENT_VERSION_UPDATE"),
|
||||
|
||||
Agent版本更新应答("AGENT_VERSION_UPDATE_RSP");
|
||||
|
||||
private String value;
|
||||
|
||||
|
||||
|
||||
}
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
package com.ruoyi.rocketmq.mapper;
|
||||
|
||||
import com.ruoyi.rocketmq.domain.RmInitialMonitorItem;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 基础监控项Mapper接口
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-09-10
|
||||
*/
|
||||
public interface RmInitialMonitorItemMapper
|
||||
{
|
||||
/**
|
||||
* 查询基础监控项
|
||||
*
|
||||
* @param id 基础监控项主键
|
||||
* @return 基础监控项
|
||||
*/
|
||||
public RmInitialMonitorItem selectRmInitialMonitorItemById(Long id);
|
||||
|
||||
/**
|
||||
* 查询基础监控项列表
|
||||
*
|
||||
* @param rmInitialMonitorItem 基础监控项
|
||||
* @return 基础监控项集合
|
||||
*/
|
||||
public List<RmInitialMonitorItem> selectRmInitialMonitorItemList(RmInitialMonitorItem rmInitialMonitorItem);
|
||||
|
||||
/**
|
||||
* 新增基础监控项
|
||||
*
|
||||
* @param rmInitialMonitorItem 基础监控项
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRmInitialMonitorItem(RmInitialMonitorItem rmInitialMonitorItem);
|
||||
|
||||
/**
|
||||
* 修改基础监控项
|
||||
*
|
||||
* @param rmInitialMonitorItem 基础监控项
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRmInitialMonitorItem(RmInitialMonitorItem rmInitialMonitorItem);
|
||||
|
||||
/**
|
||||
* 删除基础监控项
|
||||
*
|
||||
* @param id 基础监控项主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmInitialMonitorItemById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除基础监控项
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmInitialMonitorItemByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 批量查询基础监控项
|
||||
*
|
||||
* @param ids 基础监控项主键
|
||||
* @return 基础监控项
|
||||
*/
|
||||
public List<RmInitialMonitorItem> selectRmInitialMonitorItemByIds(Long[] ids);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.rocketmq.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.rocketmq.domain.RmMonitorPolicy;
|
||||
|
||||
/**
|
||||
* 资源监控策略Mapper接口
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-09-10
|
||||
*/
|
||||
public interface RmMonitorPolicyMapper
|
||||
{
|
||||
/**
|
||||
* 查询资源监控策略
|
||||
*
|
||||
* @param id 资源监控策略主键
|
||||
* @return 资源监控策略
|
||||
*/
|
||||
public RmMonitorPolicy selectRmMonitorPolicyById(Long id);
|
||||
|
||||
/**
|
||||
* 查询资源监控策略列表
|
||||
*
|
||||
* @param rmMonitorPolicy 资源监控策略
|
||||
* @return 资源监控策略集合
|
||||
*/
|
||||
public List<RmMonitorPolicy> selectRmMonitorPolicyList(RmMonitorPolicy rmMonitorPolicy);
|
||||
|
||||
/**
|
||||
* 新增资源监控策略
|
||||
*
|
||||
* @param rmMonitorPolicy 资源监控策略
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRmMonitorPolicy(RmMonitorPolicy rmMonitorPolicy);
|
||||
|
||||
/**
|
||||
* 修改资源监控策略
|
||||
*
|
||||
* @param rmMonitorPolicy 资源监控策略
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRmMonitorPolicy(RmMonitorPolicy rmMonitorPolicy);
|
||||
|
||||
/**
|
||||
* 删除资源监控策略
|
||||
*
|
||||
* @param id 资源监控策略主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmMonitorPolicyById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除资源监控策略
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmMonitorPolicyByIds(Long[] ids);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.rocketmq.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.rocketmq.domain.RmMonitorTemplate;
|
||||
|
||||
/**
|
||||
* 监控模板Mapper接口
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-09-09
|
||||
*/
|
||||
public interface RmMonitorTemplateMapper
|
||||
{
|
||||
/**
|
||||
* 查询监控模板
|
||||
*
|
||||
* @param id 监控模板主键
|
||||
* @return 监控模板
|
||||
*/
|
||||
public RmMonitorTemplate selectRmMonitorTemplateById(Long id);
|
||||
|
||||
/**
|
||||
* 查询监控模板列表
|
||||
*
|
||||
* @param rmMonitorTemplate 监控模板
|
||||
* @return 监控模板集合
|
||||
*/
|
||||
public List<RmMonitorTemplate> selectRmMonitorTemplateList(RmMonitorTemplate rmMonitorTemplate);
|
||||
|
||||
/**
|
||||
* 新增监控模板
|
||||
*
|
||||
* @param rmMonitorTemplate 监控模板
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRmMonitorTemplate(RmMonitorTemplate rmMonitorTemplate);
|
||||
|
||||
/**
|
||||
* 修改监控模板
|
||||
*
|
||||
* @param rmMonitorTemplate 监控模板
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRmMonitorTemplate(RmMonitorTemplate rmMonitorTemplate);
|
||||
|
||||
/**
|
||||
* 删除监控模板
|
||||
*
|
||||
* @param id 监控模板主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmMonitorTemplateById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除监控模板
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmMonitorTemplateByIds(Long[] ids);
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.ruoyi.rocketmq.mapper;
|
||||
|
||||
import com.ruoyi.rocketmq.domain.RmTemplateLinux;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Linux系统监控项Mapper接口
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-09-09
|
||||
*/
|
||||
public interface RmTemplateLinuxMapper
|
||||
{
|
||||
/**
|
||||
* 查询Linux系统监控项
|
||||
*
|
||||
* @param id Linux系统监控项主键
|
||||
* @return Linux系统监控项
|
||||
*/
|
||||
public RmTemplateLinux selectRmTemplateLinuxById(Long id);
|
||||
|
||||
/**
|
||||
* 查询Linux系统监控项列表
|
||||
*
|
||||
* @param rmTemplateLinux Linux系统监控项
|
||||
* @return Linux系统监控项集合
|
||||
*/
|
||||
public List<RmTemplateLinux> selectRmTemplateLinuxList(RmTemplateLinux rmTemplateLinux);
|
||||
|
||||
/**
|
||||
* 新增Linux系统监控项
|
||||
*
|
||||
* @param rmTemplateLinux Linux系统监控项
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRmTemplateLinux(RmTemplateLinux rmTemplateLinux);
|
||||
|
||||
/**
|
||||
* 修改Linux系统监控项
|
||||
*
|
||||
* @param rmTemplateLinux Linux系统监控项
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRmTemplateLinux(RmTemplateLinux rmTemplateLinux);
|
||||
|
||||
/**
|
||||
* 删除Linux系统监控项
|
||||
*
|
||||
* @param id Linux系统监控项主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmTemplateLinuxById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除Linux系统监控项
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmTemplateLinuxByIds(Long[] ids);
|
||||
|
||||
void batchInsertRmTemplateLinux(@Param("list") List<RmTemplateLinux> linuxItems);
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.ruoyi.rocketmq.mapper;
|
||||
|
||||
import com.ruoyi.rocketmq.domain.RmTemplateSwitch;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 交换机监控模板Mapper接口
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-09-09
|
||||
*/
|
||||
public interface RmTemplateSwitchMapper
|
||||
{
|
||||
/**
|
||||
* 查询交换机监控模板
|
||||
*
|
||||
* @param id 交换机监控模板主键
|
||||
* @return 交换机监控模板
|
||||
*/
|
||||
public RmTemplateSwitch selectRmTemplateSwitchById(Long id);
|
||||
|
||||
/**
|
||||
* 查询交换机监控模板列表
|
||||
*
|
||||
* @param rmTemplateSwitch 交换机监控模板
|
||||
* @return 交换机监控模板集合
|
||||
*/
|
||||
public List<RmTemplateSwitch> selectRmTemplateSwitchList(RmTemplateSwitch rmTemplateSwitch);
|
||||
|
||||
/**
|
||||
* 新增交换机监控模板
|
||||
*
|
||||
* @param rmTemplateSwitch 交换机监控模板
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRmTemplateSwitch(RmTemplateSwitch rmTemplateSwitch);
|
||||
|
||||
/**
|
||||
* 修改交换机监控模板
|
||||
*
|
||||
* @param rmTemplateSwitch 交换机监控模板
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRmTemplateSwitch(RmTemplateSwitch rmTemplateSwitch);
|
||||
|
||||
/**
|
||||
* 删除交换机监控模板
|
||||
*
|
||||
* @param id 交换机监控模板主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmTemplateSwitchById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除交换机监控模板
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmTemplateSwitchByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 批量新增交换机监控模板信息
|
||||
* @param switchItems
|
||||
*/
|
||||
void batchInsertRmTemplateSwitch(@Param("list") List<RmTemplateSwitch> switchItems);
|
||||
}
|
||||
@@ -23,4 +23,8 @@ public class ConsumerMode {
|
||||
private int consumeThreadMax;
|
||||
@Value("${suning.rocketmq.conumer.consumeMessageBatchMaxSize}")
|
||||
private int consumeMessageBatchMaxSize;
|
||||
@Value("${suning.rocketmq.producer.agentTopic}")
|
||||
private String agentTopic;
|
||||
@Value("${suning.rocketmq.producer.agentGroup}")
|
||||
private String agentGroup;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,10 @@ import org.springframework.context.annotation.Configuration;
|
||||
public class ProducerMode {
|
||||
@Value("${suning.rocketmq.producer.groupName}")
|
||||
private String groupName;
|
||||
@Value("${suning.rocketmq.producer.agentTopic}")
|
||||
private String agentTopic;
|
||||
@Value("${suning.rocketmq.producer.agentGroup}")
|
||||
private String agentGroup;
|
||||
@Value("${suning.rocketmq.namesrvAddr}")
|
||||
private String namesrvAddr;
|
||||
@Value("${suning.rocketmq.producer.maxMessageSize}")
|
||||
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
package com.ruoyi.rocketmq.service;
|
||||
|
||||
import com.ruoyi.rocketmq.domain.RmInitialMonitorItem;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 基础监控项Service接口
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-09-10
|
||||
*/
|
||||
public interface IRmInitialMonitorItemService
|
||||
{
|
||||
/**
|
||||
* 查询基础监控项
|
||||
*
|
||||
* @param id 基础监控项主键
|
||||
* @return 基础监控项
|
||||
*/
|
||||
public RmInitialMonitorItem selectRmInitialMonitorItemById(Long id);
|
||||
|
||||
/**
|
||||
* 查询基础监控项列表
|
||||
*
|
||||
* @param rmInitialMonitorItem 基础监控项
|
||||
* @return 基础监控项集合
|
||||
*/
|
||||
public List<RmInitialMonitorItem> selectRmInitialMonitorItemList(RmInitialMonitorItem rmInitialMonitorItem);
|
||||
|
||||
/**
|
||||
* 新增基础监控项
|
||||
*
|
||||
* @param rmInitialMonitorItem 基础监控项
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRmInitialMonitorItem(RmInitialMonitorItem rmInitialMonitorItem);
|
||||
|
||||
/**
|
||||
* 修改基础监控项
|
||||
*
|
||||
* @param rmInitialMonitorItem 基础监控项
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRmInitialMonitorItem(RmInitialMonitorItem rmInitialMonitorItem);
|
||||
|
||||
/**
|
||||
* 批量删除基础监控项
|
||||
*
|
||||
* @param ids 需要删除的基础监控项主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmInitialMonitorItemByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除基础监控项信息
|
||||
*
|
||||
* @param id 基础监控项主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmInitialMonitorItemById(Long id);
|
||||
|
||||
/**
|
||||
* 查询linux监控项列表
|
||||
* @return
|
||||
*/
|
||||
Map<String, List<RmInitialMonitorItem>> selectAllMsgList(RmInitialMonitorItem rmInitialMonitorItem);
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.ruoyi.rocketmq.service;
|
||||
|
||||
import com.ruoyi.rocketmq.domain.RmMonitorPolicy;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 资源监控策略Service接口
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-09-10
|
||||
*/
|
||||
public interface IRmMonitorPolicyService
|
||||
{
|
||||
/**
|
||||
* 查询资源监控策略
|
||||
*
|
||||
* @param id 资源监控策略主键
|
||||
* @return 资源监控策略
|
||||
*/
|
||||
public RmMonitorPolicy selectRmMonitorPolicyById(Long id);
|
||||
|
||||
/**
|
||||
* 查询资源监控策略列表
|
||||
*
|
||||
* @param rmMonitorPolicy 资源监控策略
|
||||
* @return 资源监控策略集合
|
||||
*/
|
||||
public List<RmMonitorPolicy> selectRmMonitorPolicyList(RmMonitorPolicy rmMonitorPolicy);
|
||||
|
||||
/**
|
||||
* 新增资源监控策略
|
||||
*
|
||||
* @param rmMonitorPolicy 资源监控策略
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRmMonitorPolicy(RmMonitorPolicy rmMonitorPolicy);
|
||||
|
||||
/**
|
||||
* 修改资源监控策略
|
||||
*
|
||||
* @param rmMonitorPolicy 资源监控策略
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRmMonitorPolicy(RmMonitorPolicy rmMonitorPolicy);
|
||||
|
||||
/**
|
||||
* 批量删除资源监控策略
|
||||
*
|
||||
* @param ids 需要删除的资源监控策略主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmMonitorPolicyByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除资源监控策略信息
|
||||
*
|
||||
* @param id 资源监控策略主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmMonitorPolicyById(Long id);
|
||||
|
||||
int addRmMonitorPolicy(RmMonitorPolicy rmMonitorPolicy);
|
||||
|
||||
Map<String, Object> getRmMonitorPolicyMsgById(Long id);
|
||||
|
||||
int issuePolicy(Long id);
|
||||
}
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
package com.ruoyi.rocketmq.service;
|
||||
|
||||
import com.ruoyi.rocketmq.domain.RmMonitorTemplate;
|
||||
import com.ruoyi.rocketmq.domain.vo.RmMonitorTemplateVo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 监控模板Service接口
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-09-09
|
||||
*/
|
||||
public interface IRmMonitorTemplateService
|
||||
{
|
||||
/**
|
||||
* 查询监控模板
|
||||
*
|
||||
* @param id 监控模板主键
|
||||
* @return 监控模板
|
||||
*/
|
||||
public RmMonitorTemplate selectRmMonitorTemplateById(Long id);
|
||||
|
||||
/**
|
||||
* 查询监控模板列表
|
||||
*
|
||||
* @param rmMonitorTemplate 监控模板
|
||||
* @return 监控模板集合
|
||||
*/
|
||||
public List<RmMonitorTemplate> selectRmMonitorTemplateList(RmMonitorTemplate rmMonitorTemplate);
|
||||
|
||||
/**
|
||||
* 新增监控模板
|
||||
*
|
||||
* @param rmMonitorTemplate 监控模板
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRmMonitorTemplate(RmMonitorTemplate rmMonitorTemplate);
|
||||
|
||||
/**
|
||||
* 修改监控模板
|
||||
*
|
||||
* @param rmMonitorTemplate 监控模板
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRmMonitorTemplate(RmMonitorTemplate rmMonitorTemplate);
|
||||
|
||||
/**
|
||||
* 批量删除监控模板
|
||||
*
|
||||
* @param ids 需要删除的监控模板主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmMonitorTemplateByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除监控模板信息
|
||||
*
|
||||
* @param id 监控模板主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmMonitorTemplateById(Long id);
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* @param rmMonitorTemplateVo
|
||||
* @return
|
||||
*/
|
||||
public int addRmMonitorTemplate(RmMonitorTemplateVo rmMonitorTemplateVo);
|
||||
|
||||
/**
|
||||
* 详情
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> getTemplateMsgById(Long id);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.rocketmq.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.rocketmq.domain.RmTemplateLinux;
|
||||
|
||||
/**
|
||||
* Linux系统监控项Service接口
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-09-09
|
||||
*/
|
||||
public interface IRmTemplateLinuxService
|
||||
{
|
||||
/**
|
||||
* 查询Linux系统监控项
|
||||
*
|
||||
* @param id Linux系统监控项主键
|
||||
* @return Linux系统监控项
|
||||
*/
|
||||
public RmTemplateLinux selectRmTemplateLinuxById(Long id);
|
||||
|
||||
/**
|
||||
* 查询Linux系统监控项列表
|
||||
*
|
||||
* @param rmTemplateLinux Linux系统监控项
|
||||
* @return Linux系统监控项集合
|
||||
*/
|
||||
public List<RmTemplateLinux> selectRmTemplateLinuxList(RmTemplateLinux rmTemplateLinux);
|
||||
|
||||
/**
|
||||
* 新增Linux系统监控项
|
||||
*
|
||||
* @param rmTemplateLinux Linux系统监控项
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRmTemplateLinux(RmTemplateLinux rmTemplateLinux);
|
||||
|
||||
/**
|
||||
* 修改Linux系统监控项
|
||||
*
|
||||
* @param rmTemplateLinux Linux系统监控项
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRmTemplateLinux(RmTemplateLinux rmTemplateLinux);
|
||||
|
||||
/**
|
||||
* 批量删除Linux系统监控项
|
||||
*
|
||||
* @param ids 需要删除的Linux系统监控项主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmTemplateLinuxByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除Linux系统监控项信息
|
||||
*
|
||||
* @param id Linux系统监控项主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmTemplateLinuxById(Long id);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.rocketmq.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.rocketmq.domain.RmTemplateSwitch;
|
||||
|
||||
/**
|
||||
* 交换机监控模板Service接口
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-09-09
|
||||
*/
|
||||
public interface IRmTemplateSwitchService
|
||||
{
|
||||
/**
|
||||
* 查询交换机监控模板
|
||||
*
|
||||
* @param id 交换机监控模板主键
|
||||
* @return 交换机监控模板
|
||||
*/
|
||||
public RmTemplateSwitch selectRmTemplateSwitchById(Long id);
|
||||
|
||||
/**
|
||||
* 查询交换机监控模板列表
|
||||
*
|
||||
* @param rmTemplateSwitch 交换机监控模板
|
||||
* @return 交换机监控模板集合
|
||||
*/
|
||||
public List<RmTemplateSwitch> selectRmTemplateSwitchList(RmTemplateSwitch rmTemplateSwitch);
|
||||
|
||||
/**
|
||||
* 新增交换机监控模板
|
||||
*
|
||||
* @param rmTemplateSwitch 交换机监控模板
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRmTemplateSwitch(RmTemplateSwitch rmTemplateSwitch);
|
||||
|
||||
/**
|
||||
* 修改交换机监控模板
|
||||
*
|
||||
* @param rmTemplateSwitch 交换机监控模板
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRmTemplateSwitch(RmTemplateSwitch rmTemplateSwitch);
|
||||
|
||||
/**
|
||||
* 批量删除交换机监控模板
|
||||
*
|
||||
* @param ids 需要删除的交换机监控模板主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmTemplateSwitchByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除交换机监控模板信息
|
||||
*
|
||||
* @param id 交换机监控模板主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmTemplateSwitchById(Long id);
|
||||
}
|
||||
+162
@@ -0,0 +1,162 @@
|
||||
package com.ruoyi.rocketmq.service.impl;
|
||||
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
import com.ruoyi.rocketmq.domain.RmInitialMonitorItem;
|
||||
import com.ruoyi.rocketmq.mapper.RmInitialMonitorItemMapper;
|
||||
import com.ruoyi.rocketmq.service.IRmInitialMonitorItemService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 基础监控项Service业务层处理
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-09-10
|
||||
*/
|
||||
@Service
|
||||
public class RmInitialMonitorItemServiceImpl implements IRmInitialMonitorItemService
|
||||
{
|
||||
@Autowired
|
||||
private RmInitialMonitorItemMapper rmInitialMonitorItemMapper;
|
||||
|
||||
/**
|
||||
* 查询基础监控项
|
||||
*
|
||||
* @param id 基础监控项主键
|
||||
* @return 基础监控项
|
||||
*/
|
||||
@Override
|
||||
public RmInitialMonitorItem selectRmInitialMonitorItemById(Long id)
|
||||
{
|
||||
return rmInitialMonitorItemMapper.selectRmInitialMonitorItemById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询基础监控项列表
|
||||
*
|
||||
* @param rmInitialMonitorItem 基础监控项
|
||||
* @return 基础监控项
|
||||
*/
|
||||
@Override
|
||||
public List<RmInitialMonitorItem> selectRmInitialMonitorItemList(RmInitialMonitorItem rmInitialMonitorItem)
|
||||
{
|
||||
return rmInitialMonitorItemMapper.selectRmInitialMonitorItemList(rmInitialMonitorItem);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增基础监控项
|
||||
*
|
||||
* @param rmInitialMonitorItem 基础监控项
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertRmInitialMonitorItem(RmInitialMonitorItem rmInitialMonitorItem)
|
||||
{
|
||||
rmInitialMonitorItem.setCreateTime(DateUtils.getNowDate());
|
||||
return rmInitialMonitorItemMapper.insertRmInitialMonitorItem(rmInitialMonitorItem);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改基础监控项
|
||||
*
|
||||
* @param rmInitialMonitorItem 基础监控项
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateRmInitialMonitorItem(RmInitialMonitorItem rmInitialMonitorItem)
|
||||
{
|
||||
rmInitialMonitorItem.setUpdateTime(DateUtils.getNowDate());
|
||||
return rmInitialMonitorItemMapper.updateRmInitialMonitorItem(rmInitialMonitorItem);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除基础监控项
|
||||
*
|
||||
* @param ids 需要删除的基础监控项主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRmInitialMonitorItemByIds(Long[] ids)
|
||||
{
|
||||
return rmInitialMonitorItemMapper.deleteRmInitialMonitorItemByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除基础监控项信息
|
||||
*
|
||||
* @param id 基础监控项主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRmInitialMonitorItemById(Long id)
|
||||
{
|
||||
return rmInitialMonitorItemMapper.deleteRmInitialMonitorItemById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有监控标识以及监控名称
|
||||
* @param rmInitialMonitorItem
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Map<String, List<RmInitialMonitorItem>> selectAllMsgList(RmInitialMonitorItem rmInitialMonitorItem) {
|
||||
Map<String, List<RmInitialMonitorItem>> resultMap = new HashMap<>();
|
||||
String resourceType = rmInitialMonitorItem.getResourceType();
|
||||
String itemType = rmInitialMonitorItem.getItemType();
|
||||
|
||||
List<RmInitialMonitorItem> allItems = rmInitialMonitorItemMapper.selectRmInitialMonitorItemList(rmInitialMonitorItem);
|
||||
|
||||
if ("linux".equals(resourceType)) {
|
||||
if ("monitorItem".equals(itemType)) {
|
||||
// CPU信息
|
||||
resultMap.put("cpu", filterItems(allItems, "CPU"));
|
||||
// 其他系统信息
|
||||
resultMap.put("other", filterItems(allItems, "OTHER"));
|
||||
}
|
||||
else if ("autodiscoverItem".equals(itemType)) {
|
||||
// 挂载点信息
|
||||
resultMap.put("point", filterItems(allItems, "POINT"));
|
||||
// 网络接口信息
|
||||
resultMap.put("net", filterItems(allItems, "NET"));
|
||||
// 磁盘信息
|
||||
resultMap.put("disk", filterItems(allItems, "DISK"));
|
||||
// Docker容器信息
|
||||
resultMap.put("docker", filterItems(allItems, "DOCKER"));
|
||||
}
|
||||
}
|
||||
else if ("switch".equals(resourceType)) {
|
||||
if ("monitorItem".equals(itemType)) {
|
||||
// 系统信息
|
||||
resultMap.put("system", filterItems(allItems, "SYSTEM"));
|
||||
// MPU信息
|
||||
resultMap.put("mpu", filterItems(allItems, "MPU"));
|
||||
// 电源信息
|
||||
resultMap.put("power", filterItems(allItems, "POWERSOURCE"));
|
||||
}
|
||||
else if ("autodiscoverItem".equals(itemType)) {
|
||||
// 网络端口信息
|
||||
resultMap.put("netport", filterItems(allItems, "NETPORT"));
|
||||
// 光模块信息
|
||||
resultMap.put("lightmodule", filterItems(allItems, "LIGHTMODULE"));
|
||||
// 风扇信息
|
||||
resultMap.put("fan", filterItems(allItems, "FAN"));
|
||||
}
|
||||
}
|
||||
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通用过滤方法
|
||||
*/
|
||||
private List<RmInitialMonitorItem> filterItems(List<RmInitialMonitorItem> items, String dataType) {
|
||||
return items.stream()
|
||||
.filter(item -> dataType.equals(item.getDataType()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
+303
@@ -0,0 +1,303 @@
|
||||
package com.ruoyi.rocketmq.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ruoyi.common.core.constant.SecurityConstants;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
import com.ruoyi.common.core.utils.StringUtils;
|
||||
import com.ruoyi.rocketmq.domain.*;
|
||||
import com.ruoyi.rocketmq.domain.vo.CollectVo;
|
||||
import com.ruoyi.rocketmq.domain.vo.RmMonitorPolicyVo;
|
||||
import com.ruoyi.rocketmq.mapper.RmMonitorPolicyMapper;
|
||||
import com.ruoyi.rocketmq.mapper.RmMonitorTemplateMapper;
|
||||
import com.ruoyi.rocketmq.mapper.RmTemplateLinuxMapper;
|
||||
import com.ruoyi.rocketmq.model.ProducerMode;
|
||||
import com.ruoyi.rocketmq.producer.MessageProducer;
|
||||
import com.ruoyi.rocketmq.service.IRmMonitorPolicyService;
|
||||
import com.ruoyi.rocketmq.utils.DataProcessUtil;
|
||||
import com.ruoyi.system.api.RemoteRevenueConfigService;
|
||||
import com.ruoyi.system.api.domain.RmResourceGroupRemote;
|
||||
import com.ruoyi.system.api.domain.RmResourceRegistrationRemote;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 资源监控策略Service业务层处理
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-09-10
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class RmMonitorPolicyServiceImpl implements IRmMonitorPolicyService
|
||||
{
|
||||
@Autowired
|
||||
private ProducerMode producerMode;
|
||||
@Autowired
|
||||
private RmMonitorPolicyMapper rmMonitorPolicyMapper;
|
||||
@Autowired
|
||||
private RmTemplateLinuxMapper rmTemplateLinuxMapper;
|
||||
@Autowired
|
||||
private RmMonitorTemplateMapper rmMonitorTemplateMapper;
|
||||
@Autowired
|
||||
private RemoteRevenueConfigService remoteRevenueConfigService;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询资源监控策略
|
||||
*
|
||||
* @param id 资源监控策略主键
|
||||
* @return 资源监控策略
|
||||
*/
|
||||
@Override
|
||||
public RmMonitorPolicy selectRmMonitorPolicyById(Long id)
|
||||
{
|
||||
return rmMonitorPolicyMapper.selectRmMonitorPolicyById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询资源监控策略列表
|
||||
*
|
||||
* @param rmMonitorPolicy 资源监控策略
|
||||
* @return 资源监控策略
|
||||
*/
|
||||
@Override
|
||||
public List<RmMonitorPolicy> selectRmMonitorPolicyList(RmMonitorPolicy rmMonitorPolicy)
|
||||
{
|
||||
return rmMonitorPolicyMapper.selectRmMonitorPolicyList(rmMonitorPolicy);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增资源监控策略
|
||||
*
|
||||
* @param rmMonitorPolicy 资源监控策略
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertRmMonitorPolicy(RmMonitorPolicy rmMonitorPolicy)
|
||||
{
|
||||
rmMonitorPolicy.setCreateTime(DateUtils.getNowDate());
|
||||
return rmMonitorPolicyMapper.insertRmMonitorPolicy(rmMonitorPolicy);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改资源监控策略
|
||||
*
|
||||
* @param rmMonitorPolicy 资源监控策略
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateRmMonitorPolicy(RmMonitorPolicy rmMonitorPolicy)
|
||||
{
|
||||
rmMonitorPolicy.setUpdateTime(DateUtils.getNowDate());
|
||||
return rmMonitorPolicyMapper.updateRmMonitorPolicy(rmMonitorPolicy);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除资源监控策略
|
||||
*
|
||||
* @param ids 需要删除的资源监控策略主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRmMonitorPolicyByIds(Long[] ids)
|
||||
{
|
||||
return rmMonitorPolicyMapper.deleteRmMonitorPolicyByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除资源监控策略信息
|
||||
*
|
||||
* @param id 资源监控策略主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRmMonitorPolicyById(Long id)
|
||||
{
|
||||
return rmMonitorPolicyMapper.deleteRmMonitorPolicyById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addRmMonitorPolicy(RmMonitorPolicy rmMonitorPolicy) {
|
||||
rmMonitorPolicyMapper.insertRmMonitorPolicy(rmMonitorPolicy);
|
||||
// 模板绑定资源组信息
|
||||
RmMonitorTemplate rmMonitorTemplate = new RmMonitorTemplate();
|
||||
rmMonitorTemplate.setId(rmMonitorPolicy.getTemplateId());
|
||||
rmMonitorTemplate.setResourceGroupId(rmMonitorPolicy.getResourceGroupId());
|
||||
rmMonitorTemplateMapper.updateRmMonitorTemplate(rmMonitorTemplate);
|
||||
// 拿到采集周期
|
||||
List<RmMonitorPolicyVo> collectionAndIdList = rmMonitorPolicy.getCollectionAndIdList();
|
||||
if(!collectionAndIdList.isEmpty()){
|
||||
for (RmMonitorPolicyVo rmMonitorPolicyVo : collectionAndIdList) {
|
||||
// 添加采集周期
|
||||
RmTemplateLinux rmTemplateLinux = new RmTemplateLinux();
|
||||
rmTemplateLinux.setId(rmMonitorPolicyVo.getId());
|
||||
rmTemplateLinux.setCollectionCycle(rmMonitorPolicyVo.getCollectionCycle());
|
||||
rmTemplateLinuxMapper.updateRmTemplateLinux(rmTemplateLinux);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询监控策略详情
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> getRmMonitorPolicyMsgById(Long id) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
|
||||
// 1. 获取资源监控策略基础信息
|
||||
RmMonitorPolicy rmMonitorPolicy = rmMonitorPolicyMapper.selectRmMonitorPolicyById(id);
|
||||
if(rmMonitorPolicy != null){
|
||||
rmMonitorPolicy.setResourceGroupName(DataProcessUtil.getResourceGroupNameById(rmMonitorPolicy.getResourceGroupId()));
|
||||
result.put("policy", rmMonitorPolicy);
|
||||
// 模板id
|
||||
Long templateId = rmMonitorPolicy.getTemplateId();
|
||||
|
||||
// 2. 处理Linux模板数据
|
||||
DataProcessUtil.processLinuxTemplateData(templateId, result);
|
||||
|
||||
// 3. 处理Switch模板数据
|
||||
DataProcessUtil.processSwitchTemplateData(templateId, result);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 下发策略
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int issuePolicy(Long id) {
|
||||
try {
|
||||
// 获取策略详情和资源设备
|
||||
RmMonitorPolicy policy = rmMonitorPolicyMapper.selectRmMonitorPolicyById(id);
|
||||
if (policy == null) {
|
||||
log.error("策略不存在,id: {}", id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
List<RmResourceRegistrationRemote> devices = getResourceDevices(policy.getResourceGroupId());
|
||||
if (CollectionUtils.isEmpty(devices)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 构建并发送采集配置
|
||||
Map<String, Object> policyDetails = getRmMonitorPolicyMsgById(id);
|
||||
List<CollectVo> collectVos = buildCollectConfigurations(policyDetails);
|
||||
sendConfigurationsToDevices(devices, collectVos);
|
||||
// 更新策略状态为已下发
|
||||
RmMonitorPolicy policyUpdate = new RmMonitorPolicy();
|
||||
policyUpdate.setId(id);
|
||||
policyUpdate.setStatus("1");
|
||||
rmMonitorPolicyMapper.updateRmMonitorPolicy(policyUpdate);
|
||||
|
||||
return 1;
|
||||
} catch (Exception e) {
|
||||
log.error("下发策略失败,id: {}", id, e);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取资源设备列表
|
||||
*/
|
||||
private List<RmResourceRegistrationRemote> getResourceDevices(Long resourceGroupId) {
|
||||
R<RmResourceGroupRemote> groupResponse = remoteRevenueConfigService
|
||||
.getResourceGroupMsgById(resourceGroupId, SecurityConstants.INNER);
|
||||
|
||||
if (groupResponse == null || groupResponse.getData() == null
|
||||
|| StringUtils.isEmpty(groupResponse.getData().getIncludedDevicesId())) {
|
||||
log.error("资源组信息不完整,resourceGroupId: {}", resourceGroupId);
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
String[] deviceIds = groupResponse.getData().getIncludedDevicesId().split(",");
|
||||
R<List<RmResourceRegistrationRemote>> devicesResponse = remoteRevenueConfigService
|
||||
.getRegistrationByIds(deviceIds, SecurityConstants.INNER);
|
||||
|
||||
return devicesResponse != null ? devicesResponse.getData() : Collections.emptyList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建采集配置
|
||||
*/
|
||||
private List<CollectVo> buildCollectConfigurations(Map<String, Object> policyDetails) {
|
||||
List<CollectVo> collectVos = new ArrayList<>();
|
||||
|
||||
// 处理Linux配置
|
||||
if (policyDetails.containsKey("linux")) {
|
||||
Map<String, List<RmTemplateLinux>> linuxConfigs = (Map<String, List<RmTemplateLinux>>) policyDetails.get("linux");
|
||||
processConfigurations(linuxConfigs, collectVos, new String[]{"cpu", "other", "point", "net", "disk", "docker"});
|
||||
}
|
||||
|
||||
// 处理Switch配置
|
||||
if (policyDetails.containsKey("switch")) {
|
||||
Map<String, List<RmTemplateSwitch>> switchConfigs = (Map<String, List<RmTemplateSwitch>>) policyDetails.get("switch");
|
||||
processConfigurations(switchConfigs, collectVos, new String[]{"system", "mpu", "power", "netport", "lightmodule", "fan"});
|
||||
}
|
||||
|
||||
return collectVos;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通用配置处理方法
|
||||
*/
|
||||
private <T> void processConfigurations(Map<String, List<T>> configs, List<CollectVo> collectVos, String[] types) {
|
||||
for (String type : types) {
|
||||
if (configs.get(type) != null) {
|
||||
for (T config : configs.get(type)) {
|
||||
CollectVo vo = new CollectVo();
|
||||
vo.setCollect(true);
|
||||
|
||||
if (config instanceof RmTemplateLinux) {
|
||||
RmTemplateLinux linuxConfig = (RmTemplateLinux) config;
|
||||
vo.setType(linuxConfig.getMetricKey());
|
||||
vo.setInterval(linuxConfig.getCollectionCycle());
|
||||
} else if (config instanceof RmTemplateSwitch) {
|
||||
RmTemplateSwitch switchConfig = (RmTemplateSwitch) config;
|
||||
vo.setType(switchConfig.getMetricKey());
|
||||
vo.setInterval(switchConfig.getCollectionCycle());
|
||||
}
|
||||
|
||||
collectVos.add(vo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送配置到设备
|
||||
*/
|
||||
private void sendConfigurationsToDevices(List<RmResourceRegistrationRemote> devices, List<CollectVo> collectVos) {
|
||||
MessageProducer messageProducer = new MessageProducer();
|
||||
String configJson = JSONObject.toJSONString(collectVos);
|
||||
|
||||
for (RmResourceRegistrationRemote device : devices) {
|
||||
try {
|
||||
DeviceMessage message = new DeviceMessage();
|
||||
message.setClientId(device.getHardwareSn());
|
||||
message.setData(configJson);
|
||||
message.setDataType("collects");
|
||||
|
||||
messageProducer.sendAsyncProducerMessage(
|
||||
producerMode.getAgentTopic(),
|
||||
"collects",
|
||||
"title",
|
||||
JSONObject.toJSONString(message)
|
||||
);
|
||||
} catch (Exception e) {
|
||||
log.error("发送设备配置失败,deviceId: {}", device.getHardwareSn(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+214
@@ -0,0 +1,214 @@
|
||||
package com.ruoyi.rocketmq.service.impl;
|
||||
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
import com.ruoyi.rocketmq.domain.RmInitialMonitorItem;
|
||||
import com.ruoyi.rocketmq.domain.RmMonitorTemplate;
|
||||
import com.ruoyi.rocketmq.domain.RmTemplateLinux;
|
||||
import com.ruoyi.rocketmq.domain.RmTemplateSwitch;
|
||||
import com.ruoyi.rocketmq.domain.vo.RmMonitorTemplateVo;
|
||||
import com.ruoyi.rocketmq.mapper.RmInitialMonitorItemMapper;
|
||||
import com.ruoyi.rocketmq.mapper.RmMonitorTemplateMapper;
|
||||
import com.ruoyi.rocketmq.mapper.RmTemplateLinuxMapper;
|
||||
import com.ruoyi.rocketmq.mapper.RmTemplateSwitchMapper;
|
||||
import com.ruoyi.rocketmq.service.IRmMonitorTemplateService;
|
||||
import com.ruoyi.rocketmq.utils.DataProcessUtil;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 监控模板Service业务层处理
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-09-09
|
||||
*/
|
||||
@Service
|
||||
public class RmMonitorTemplateServiceImpl implements IRmMonitorTemplateService
|
||||
{
|
||||
@Autowired
|
||||
private RmMonitorTemplateMapper rmMonitorTemplateMapper;
|
||||
@Autowired
|
||||
private RmTemplateLinuxMapper rmTemplateLinuxMapper;
|
||||
@Autowired
|
||||
private RmTemplateSwitchMapper rmTemplateSwitchMapper;
|
||||
@Autowired
|
||||
private RmInitialMonitorItemMapper rmInitialMonitorItemMapper;
|
||||
/**
|
||||
* 查询监控模板
|
||||
*
|
||||
* @param id 监控模板主键
|
||||
* @return 监控模板
|
||||
*/
|
||||
@Override
|
||||
public RmMonitorTemplate selectRmMonitorTemplateById(Long id)
|
||||
{
|
||||
return rmMonitorTemplateMapper.selectRmMonitorTemplateById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询监控模板列表
|
||||
*
|
||||
* @param rmMonitorTemplate 监控模板
|
||||
* @return 监控模板
|
||||
*/
|
||||
@Override
|
||||
public List<RmMonitorTemplate> selectRmMonitorTemplateList(RmMonitorTemplate rmMonitorTemplate)
|
||||
{
|
||||
return rmMonitorTemplateMapper.selectRmMonitorTemplateList(rmMonitorTemplate);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增监控模板
|
||||
*
|
||||
* @param rmMonitorTemplate 监控模板
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertRmMonitorTemplate(RmMonitorTemplate rmMonitorTemplate)
|
||||
{
|
||||
rmMonitorTemplate.setCreateTime(DateUtils.getNowDate());
|
||||
return rmMonitorTemplateMapper.insertRmMonitorTemplate(rmMonitorTemplate);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改监控模板
|
||||
*
|
||||
* @param rmMonitorTemplate 监控模板
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateRmMonitorTemplate(RmMonitorTemplate rmMonitorTemplate)
|
||||
{
|
||||
rmMonitorTemplate.setUpdateTime(DateUtils.getNowDate());
|
||||
return rmMonitorTemplateMapper.updateRmMonitorTemplate(rmMonitorTemplate);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除监控模板
|
||||
*
|
||||
* @param ids 需要删除的监控模板主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRmMonitorTemplateByIds(Long[] ids)
|
||||
{
|
||||
return rmMonitorTemplateMapper.deleteRmMonitorTemplateByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除监控模板信息
|
||||
*
|
||||
* @param id 监控模板主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRmMonitorTemplateById(Long id)
|
||||
{
|
||||
return rmMonitorTemplateMapper.deleteRmMonitorTemplateById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int addRmMonitorTemplate(RmMonitorTemplateVo rmMonitorTemplateVo) {
|
||||
RmMonitorTemplate rmMonitorTemplate = new RmMonitorTemplate();
|
||||
BeanUtils.copyProperties(rmMonitorTemplateVo, rmMonitorTemplate);
|
||||
rmMonitorTemplateMapper.insertRmMonitorTemplate(rmMonitorTemplate);
|
||||
Long templateId = rmMonitorTemplate.getId();
|
||||
|
||||
// linux系统信息
|
||||
if("linux".equals(rmMonitorTemplateVo.getResourceType())){
|
||||
// 根据监控信息id查询详细信息
|
||||
List<RmInitialMonitorItem> monitorItems = rmInitialMonitorItemMapper.selectRmInitialMonitorItemByIds(rmMonitorTemplateVo.getMonitorIds());
|
||||
// 批量准备插入数据
|
||||
List<RmTemplateLinux> linuxItems = monitorItems.stream()
|
||||
.map(item -> {
|
||||
RmTemplateLinux linuxItem = new RmTemplateLinux();
|
||||
linuxItem.setTemplateId(templateId);
|
||||
linuxItem.setMetricKey(item.getMetricKey());
|
||||
linuxItem.setMetricName(item.getMetricName());
|
||||
linuxItem.setDataType(item.getDataType());
|
||||
linuxItem.setItemType(item.getItemType());
|
||||
return linuxItem;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
// 批量插入
|
||||
if(!linuxItems.isEmpty()) {
|
||||
rmTemplateLinuxMapper.batchInsertRmTemplateLinux(linuxItems);
|
||||
int monitorCount = (int) linuxItems.stream().filter(r -> "monitorItem".equals(r.getItemType())).count();
|
||||
int autoDiscoverCount = (int) linuxItems.stream().filter(r -> "autoDiscoverItem".equals(r.getItemType())).count();
|
||||
RmMonitorTemplate monitorTemplate = new RmMonitorTemplate();
|
||||
monitorTemplate.setId(templateId);
|
||||
monitorTemplate.setMonitorItems(monitorCount + "");
|
||||
monitorTemplate.setDiscoveryRules(autoDiscoverCount + "");
|
||||
monitorTemplate.setResourcyType("linux");
|
||||
rmMonitorTemplateMapper.updateRmMonitorTemplate(monitorTemplate);
|
||||
}
|
||||
}
|
||||
// 华为交换机信息
|
||||
if("switch".equals(rmMonitorTemplateVo.getResourceType())){
|
||||
// 根据监控信息id查询详细信息
|
||||
List<RmInitialMonitorItem> monitorItems = rmInitialMonitorItemMapper.selectRmInitialMonitorItemByIds(rmMonitorTemplateVo.getMonitorIds());
|
||||
// 批量准备插入数据
|
||||
List<RmTemplateSwitch> switchItems = monitorItems.stream()
|
||||
.map(item -> {
|
||||
RmTemplateSwitch switchItem = new RmTemplateSwitch();
|
||||
switchItem.setTemplateId(templateId);
|
||||
switchItem.setMetricKey(item.getMetricKey());
|
||||
switchItem.setMetricName(item.getMetricName());
|
||||
switchItem.setOid(item.getOid());
|
||||
switchItem.setFilterValue(item.getFilterValue());
|
||||
switchItem.setSwitchDescription(item.getMonitorDescription());
|
||||
switchItem.setDataType(item.getDataType());
|
||||
switchItem.setItemType(item.getItemType());
|
||||
return switchItem;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
// 批量插入
|
||||
if(!switchItems.isEmpty()) {
|
||||
rmTemplateSwitchMapper.batchInsertRmTemplateSwitch(switchItems);
|
||||
int monitorCount = (int) switchItems.stream().filter(r -> "monitorItem".equals(r.getItemType())).count();
|
||||
int autoDiscoverCount = (int) switchItems.stream().filter(r -> "autoDiscoverItem".equals(r.getItemType())).count();
|
||||
RmMonitorTemplate monitorTemplate = new RmMonitorTemplate();
|
||||
monitorTemplate.setId(templateId);
|
||||
monitorTemplate.setMonitorItems(monitorCount + "");
|
||||
monitorTemplate.setDiscoveryRules(autoDiscoverCount + "");
|
||||
monitorTemplate.setResourcyType("switch");
|
||||
rmMonitorTemplateMapper.updateRmMonitorTemplate(monitorTemplate);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取监控模板详情
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> getTemplateMsgById(Long id) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
|
||||
// 1. 获取模板基础信息
|
||||
RmMonitorTemplate template = rmMonitorTemplateMapper.selectRmMonitorTemplateById(id);
|
||||
if(template.getResourceGroupId() != null){
|
||||
template.setResourceGroupName(DataProcessUtil.getResourceGroupNameById(template.getResourceGroupId()));
|
||||
}
|
||||
result.put("template", template);
|
||||
|
||||
// 2. 处理Linux模板数据
|
||||
DataProcessUtil.processLinuxTemplateData(id, result);
|
||||
|
||||
// 3. 处理Switch模板数据
|
||||
DataProcessUtil.processSwitchTemplateData(id, result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
package com.ruoyi.rocketmq.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.rocketmq.mapper.RmTemplateLinuxMapper;
|
||||
import com.ruoyi.rocketmq.domain.RmTemplateLinux;
|
||||
import com.ruoyi.rocketmq.service.IRmTemplateLinuxService;
|
||||
|
||||
/**
|
||||
* Linux系统监控项Service业务层处理
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-09-09
|
||||
*/
|
||||
@Service
|
||||
public class RmTemplateLinuxServiceImpl implements IRmTemplateLinuxService
|
||||
{
|
||||
@Autowired
|
||||
private RmTemplateLinuxMapper rmTemplateLinuxMapper;
|
||||
|
||||
/**
|
||||
* 查询Linux系统监控项
|
||||
*
|
||||
* @param id Linux系统监控项主键
|
||||
* @return Linux系统监控项
|
||||
*/
|
||||
@Override
|
||||
public RmTemplateLinux selectRmTemplateLinuxById(Long id)
|
||||
{
|
||||
return rmTemplateLinuxMapper.selectRmTemplateLinuxById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询Linux系统监控项列表
|
||||
*
|
||||
* @param rmTemplateLinux Linux系统监控项
|
||||
* @return Linux系统监控项
|
||||
*/
|
||||
@Override
|
||||
public List<RmTemplateLinux> selectRmTemplateLinuxList(RmTemplateLinux rmTemplateLinux)
|
||||
{
|
||||
return rmTemplateLinuxMapper.selectRmTemplateLinuxList(rmTemplateLinux);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增Linux系统监控项
|
||||
*
|
||||
* @param rmTemplateLinux Linux系统监控项
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertRmTemplateLinux(RmTemplateLinux rmTemplateLinux)
|
||||
{
|
||||
rmTemplateLinux.setCreateTime(DateUtils.getNowDate());
|
||||
return rmTemplateLinuxMapper.insertRmTemplateLinux(rmTemplateLinux);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改Linux系统监控项
|
||||
*
|
||||
* @param rmTemplateLinux Linux系统监控项
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateRmTemplateLinux(RmTemplateLinux rmTemplateLinux)
|
||||
{
|
||||
rmTemplateLinux.setUpdateTime(DateUtils.getNowDate());
|
||||
return rmTemplateLinuxMapper.updateRmTemplateLinux(rmTemplateLinux);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除Linux系统监控项
|
||||
*
|
||||
* @param ids 需要删除的Linux系统监控项主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRmTemplateLinuxByIds(Long[] ids)
|
||||
{
|
||||
return rmTemplateLinuxMapper.deleteRmTemplateLinuxByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除Linux系统监控项信息
|
||||
*
|
||||
* @param id Linux系统监控项主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRmTemplateLinuxById(Long id)
|
||||
{
|
||||
return rmTemplateLinuxMapper.deleteRmTemplateLinuxById(id);
|
||||
}
|
||||
}
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
package com.ruoyi.rocketmq.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.rocketmq.mapper.RmTemplateSwitchMapper;
|
||||
import com.ruoyi.rocketmq.domain.RmTemplateSwitch;
|
||||
import com.ruoyi.rocketmq.service.IRmTemplateSwitchService;
|
||||
|
||||
/**
|
||||
* 交换机监控模板Service业务层处理
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-09-09
|
||||
*/
|
||||
@Service
|
||||
public class RmTemplateSwitchServiceImpl implements IRmTemplateSwitchService
|
||||
{
|
||||
@Autowired
|
||||
private RmTemplateSwitchMapper rmTemplateSwitchMapper;
|
||||
|
||||
/**
|
||||
* 查询交换机监控模板
|
||||
*
|
||||
* @param id 交换机监控模板主键
|
||||
* @return 交换机监控模板
|
||||
*/
|
||||
@Override
|
||||
public RmTemplateSwitch selectRmTemplateSwitchById(Long id)
|
||||
{
|
||||
return rmTemplateSwitchMapper.selectRmTemplateSwitchById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询交换机监控模板列表
|
||||
*
|
||||
* @param rmTemplateSwitch 交换机监控模板
|
||||
* @return 交换机监控模板
|
||||
*/
|
||||
@Override
|
||||
public List<RmTemplateSwitch> selectRmTemplateSwitchList(RmTemplateSwitch rmTemplateSwitch)
|
||||
{
|
||||
return rmTemplateSwitchMapper.selectRmTemplateSwitchList(rmTemplateSwitch);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增交换机监控模板
|
||||
*
|
||||
* @param rmTemplateSwitch 交换机监控模板
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertRmTemplateSwitch(RmTemplateSwitch rmTemplateSwitch)
|
||||
{
|
||||
rmTemplateSwitch.setCreateTime(DateUtils.getNowDate());
|
||||
return rmTemplateSwitchMapper.insertRmTemplateSwitch(rmTemplateSwitch);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改交换机监控模板
|
||||
*
|
||||
* @param rmTemplateSwitch 交换机监控模板
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateRmTemplateSwitch(RmTemplateSwitch rmTemplateSwitch)
|
||||
{
|
||||
rmTemplateSwitch.setUpdateTime(DateUtils.getNowDate());
|
||||
return rmTemplateSwitchMapper.updateRmTemplateSwitch(rmTemplateSwitch);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除交换机监控模板
|
||||
*
|
||||
* @param ids 需要删除的交换机监控模板主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRmTemplateSwitchByIds(Long[] ids)
|
||||
{
|
||||
return rmTemplateSwitchMapper.deleteRmTemplateSwitchByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除交换机监控模板信息
|
||||
*
|
||||
* @param id 交换机监控模板主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRmTemplateSwitchById(Long id)
|
||||
{
|
||||
return rmTemplateSwitchMapper.deleteRmTemplateSwitchById(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package com.ruoyi.rocketmq.utils;
|
||||
|
||||
import com.ruoyi.common.core.constant.SecurityConstants;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.rocketmq.domain.RmTemplateLinux;
|
||||
import com.ruoyi.rocketmq.domain.RmTemplateSwitch;
|
||||
import com.ruoyi.rocketmq.mapper.RmMonitorTemplateMapper;
|
||||
import com.ruoyi.rocketmq.mapper.RmTemplateLinuxMapper;
|
||||
import com.ruoyi.rocketmq.mapper.RmTemplateSwitchMapper;
|
||||
import com.ruoyi.system.api.RemoteRevenueConfigService;
|
||||
import com.ruoyi.system.api.domain.RmResourceGroupRemote;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
@Slf4j
|
||||
public class DataProcessUtil {
|
||||
@Autowired
|
||||
private RmMonitorTemplateMapper rmMonitorTemplateMapper;
|
||||
@Autowired
|
||||
private static RmTemplateLinuxMapper rmTemplateLinuxMapper;
|
||||
@Autowired
|
||||
private static RmTemplateSwitchMapper rmTemplateSwitchMapper;
|
||||
@Autowired
|
||||
private static RemoteRevenueConfigService remoteRevenueConfigService;
|
||||
|
||||
/**
|
||||
* 补充资源组信息
|
||||
*/
|
||||
public static String getResourceGroupNameById(Long resourceGroupId) {
|
||||
try {
|
||||
R<RmResourceGroupRemote> resourceGroupResponse = remoteRevenueConfigService
|
||||
.getResourceGroupMsgById(resourceGroupId, SecurityConstants.INNER);
|
||||
|
||||
if (resourceGroupResponse != null && resourceGroupResponse.getData() != null) {
|
||||
return resourceGroupResponse.getData().getGroupName();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("获取资源组信息失败,resourceGroupId: {}", resourceGroupId, e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* 处理Linux模板数据
|
||||
*/
|
||||
public static void processLinuxTemplateData(Long templateId, Map<String, Object> result) {
|
||||
RmTemplateLinux query = new RmTemplateLinux();
|
||||
query.setTemplateId(templateId);
|
||||
List<RmTemplateLinux> linuxItems = rmTemplateLinuxMapper.selectRmTemplateLinuxList(query);
|
||||
|
||||
if (!linuxItems.isEmpty()) {
|
||||
Map<String, List<RmTemplateLinux>> linuxData = new HashMap<>();
|
||||
linuxData.put("cpu", filterItemsByDataType(linuxItems, "CPU"));
|
||||
linuxData.put("other", filterItemsByDataType(linuxItems, "OTHER"));
|
||||
linuxData.put("point", filterItemsByDataType(linuxItems, "POINT"));
|
||||
linuxData.put("net", filterItemsByDataType(linuxItems, "NET"));
|
||||
linuxData.put("disk", filterItemsByDataType(linuxItems, "DISK"));
|
||||
linuxData.put("docker", filterItemsByDataType(linuxItems, "DOCKER"));
|
||||
|
||||
result.put("linux", linuxData);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理Switch模板数据
|
||||
*/
|
||||
public static void processSwitchTemplateData(Long templateId, Map<String, Object> result) {
|
||||
RmTemplateSwitch query = new RmTemplateSwitch();
|
||||
query.setTemplateId(templateId);
|
||||
List<RmTemplateSwitch> switchItems = rmTemplateSwitchMapper.selectRmTemplateSwitchList(query);
|
||||
|
||||
if (!switchItems.isEmpty()) {
|
||||
Map<String, List<RmTemplateSwitch>> switchData = new HashMap<>();
|
||||
switchData.put("system", filterItemsByDataType(switchItems, "SYSTEM"));
|
||||
switchData.put("mpu", filterItemsByDataType(switchItems, "MPU"));
|
||||
switchData.put("power", filterItemsByDataType(switchItems, "POWERSOURCE"));
|
||||
switchData.put("netport", filterItemsByDataType(switchItems, "NETPORT"));
|
||||
switchData.put("lightmodule", filterItemsByDataType(switchItems, "LIGHTMODULE"));
|
||||
switchData.put("fan", filterItemsByDataType(switchItems, "FAN"));
|
||||
|
||||
result.put("switch", switchData);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 通用过滤方法
|
||||
*/
|
||||
public static <T> List<T> filterItemsByDataType(List<T> items, String dataType) {
|
||||
return items.stream()
|
||||
.filter(item -> {
|
||||
try {
|
||||
Field dataTypeField = item.getClass().getDeclaredField("dataType");
|
||||
dataTypeField.setAccessible(true);
|
||||
return dataType.equals(dataTypeField.get(item));
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
@@ -105,21 +105,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<insert id="insert" parameterType="InitialBandwidthTraffic">
|
||||
INSERT INTO ${tableName} (
|
||||
`name`, `mac`, `status`, `type`, ipV4, `in_dropped`, `out_dropped`,
|
||||
`in_speed`, `out_speed`, create_by, update_by, client_id, create_time
|
||||
`in_speed`, `out_speed`, duplex, speed, create_by, update_by, client_id, create_time
|
||||
) VALUES (
|
||||
#{name}, #{mac}, #{status}, #{type}, #{ipV4}, #{inDropped}, #{outDropped},
|
||||
#{inSpeed}, #{outSpeed}, #{createBy}, #{updateBy}, #{clientId}, #{createTime}
|
||||
#{inSpeed}, #{outSpeed}, #{duplex}, #{speed}, #{createBy}, #{updateBy}, #{clientId}, #{createTime}
|
||||
)
|
||||
</insert>
|
||||
<insert id="batchInsert" parameterType="InitialBandwidthTraffic">
|
||||
INSERT IGNORE INTO ${tableName} (
|
||||
`name`, `mac`, `status`, `type`, ipV4, `in_dropped`, `out_dropped`,
|
||||
`in_speed`, `out_speed`,create_by, update_by, client_id, create_time
|
||||
`in_speed`, `out_speed`,duplex, speed, create_by, update_by, client_id, create_time
|
||||
) VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
#{item.name}, #{item.mac}, #{item.status}, #{item.type}, #{item.ipV4}, #{item.inDropped}, #{item.outDropped},
|
||||
#{item.inSpeed}, #{item.outSpeed}, #{item.createBy}, #{item.updateBy}, #{item.clientId}, #{item.createTime}
|
||||
#{item.inSpeed}, #{item.outSpeed}, #{item.duplex}, #{item.speed}, #{item.createBy}, #{item.updateBy}, #{item.clientId}, #{item.createTime}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.rocketmq.mapper.RmInitialMonitorItemMapper">
|
||||
|
||||
<resultMap type="RmInitialMonitorItem" id="RmInitialMonitorItemResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="itemType" column="item_type" />
|
||||
<result property="metricKey" column="metric_key" />
|
||||
<result property="metricName" column="metric_name" />
|
||||
<result property="oid" column="oid" />
|
||||
<result property="filterValue" column="filter_value" />
|
||||
<result property="monitorDescription" column="monitor_description" />
|
||||
<result property="dataType" column="data_type" />
|
||||
<result property="resourceType" column="resource_type" />
|
||||
<result property="collectionCycle" column="collection_cycle" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectRmInitialMonitorItemVo">
|
||||
select id, item_type, metric_key, metric_name, oid, filter_value, monitor_description, data_type, resource_type, collection_cycle, create_time, update_time, create_by, update_by from rm_initial_monitor_item
|
||||
</sql>
|
||||
|
||||
<select id="selectRmInitialMonitorItemList" parameterType="RmInitialMonitorItem" resultMap="RmInitialMonitorItemResult">
|
||||
<include refid="selectRmInitialMonitorItemVo"/>
|
||||
<where>
|
||||
<if test="itemType != null and itemType != ''"> and item_type = #{itemType}</if>
|
||||
<if test="metricKey != null and metricKey != ''"> and metric_key = #{metricKey}</if>
|
||||
<if test="metricName != null and metricName != ''"> and metric_name like concat('%', #{metricName}, '%')</if>
|
||||
<if test="oid != null and oid != ''"> and oid = #{oid}</if>
|
||||
<if test="filterValue != null and filterValue != ''"> and filter_value = #{filterValue}</if>
|
||||
<if test="monitorDescription != null and monitorDescription != ''"> and monitor_description = #{monitorDescription}</if>
|
||||
<if test="dataType != null and dataType != ''"> and data_type = #{dataType}</if>
|
||||
<if test="resourceType != null and resourceType != ''"> and resource_type = #{resourceType}</if>
|
||||
<if test="collectionCycle != null and collectionCycle != ''"> and collection_cycle = #{collectionCycle}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectRmInitialMonitorItemById" parameterType="Long" resultMap="RmInitialMonitorItemResult">
|
||||
<include refid="selectRmInitialMonitorItemVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertRmInitialMonitorItem" parameterType="RmInitialMonitorItem" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into rm_initial_monitor_item
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="itemType != null and itemType != ''">item_type,</if>
|
||||
<if test="metricKey != null and metricKey != ''">metric_key,</if>
|
||||
<if test="metricName != null and metricName != ''">metric_name,</if>
|
||||
<if test="oid != null">oid,</if>
|
||||
<if test="filterValue != null">filter_value,</if>
|
||||
<if test="monitorDescription != null">monitor_description,</if>
|
||||
<if test="dataType != null and dataType != ''">data_type,</if>
|
||||
<if test="resourceType != null and resourceType != ''">resource_type,</if>
|
||||
<if test="collectionCycle != null">collection_cycle,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="itemType != null and itemType != ''">#{itemType},</if>
|
||||
<if test="metricKey != null and metricKey != ''">#{metricKey},</if>
|
||||
<if test="metricName != null and metricName != ''">#{metricName},</if>
|
||||
<if test="oid != null">#{oid},</if>
|
||||
<if test="filterValue != null">#{filterValue},</if>
|
||||
<if test="monitorDescription != null">#{monitorDescription},</if>
|
||||
<if test="dataType != null and dataType != ''">#{dataType},</if>
|
||||
<if test="resourceType != null and resourceType != ''">#{resourceType},</if>
|
||||
<if test="collectionCycle != null">#{collectionCycle},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateRmInitialMonitorItem" parameterType="RmInitialMonitorItem">
|
||||
update rm_initial_monitor_item
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="itemType != null and itemType != ''">item_type = #{itemType},</if>
|
||||
<if test="metricKey != null and metricKey != ''">metric_key = #{metricKey},</if>
|
||||
<if test="metricName != null and metricName != ''">metric_name = #{metricName},</if>
|
||||
<if test="oid != null">oid = #{oid},</if>
|
||||
<if test="filterValue != null">filter_value = #{filterValue},</if>
|
||||
<if test="monitorDescription != null">monitor_description = #{monitorDescription},</if>
|
||||
<if test="dataType != null and dataType != ''">data_type = #{dataType},</if>
|
||||
<if test="resourceType != null and resourceType != ''">resource_type = #{resourceType},</if>
|
||||
<if test="collectionCycle != null">collection_cycle = #{collectionCycle},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteRmInitialMonitorItemById" parameterType="Long">
|
||||
delete from rm_initial_monitor_item where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteRmInitialMonitorItemByIds" parameterType="String">
|
||||
delete from rm_initial_monitor_item where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
<select id="selectRmInitialMonitorItemByIds" parameterType="java.lang.Long" resultMap="RmInitialMonitorItemResult">
|
||||
<include refid="selectRmInitialMonitorItemVo"/>
|
||||
where id in
|
||||
<foreach item="id" collection="monitorIds" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,97 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.rocketmq.mapper.RmMonitorPolicyMapper">
|
||||
|
||||
<resultMap type="RmMonitorPolicy" id="RmMonitorPolicyResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="templateId" column="template_id" />
|
||||
<result property="resourceGroupId" column="resource_group_id" />
|
||||
<result property="policyName" column="policy_name" />
|
||||
<result property="description" column="description" />
|
||||
<result property="status" column="status" />
|
||||
<result property="deployTime" column="deploy_time" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectRmMonitorPolicyVo">
|
||||
select id, template_id, resource_group_id, policy_name, description, status, deploy_time, create_time, update_time, create_by, update_by from rm_monitor_policy
|
||||
</sql>
|
||||
|
||||
<select id="selectRmMonitorPolicyList" parameterType="RmMonitorPolicy" resultMap="RmMonitorPolicyResult">
|
||||
<include refid="selectRmMonitorPolicyVo"/>
|
||||
<where>
|
||||
<if test="templateId != null "> and template_id = #{templateId}</if>
|
||||
<if test="resourceGroupId != null "> and resource_group_id = #{resourceGroupId}</if>
|
||||
<if test="policyName != null and policyName != ''"> and policy_name like concat('%', #{policyName}, '%')</if>
|
||||
<if test="description != null and description != ''"> and description = #{description}</if>
|
||||
<if test="status != null and status != ''"> and status = #{status}</if>
|
||||
<if test="deployTime != null "> and deploy_time = #{deployTime}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectRmMonitorPolicyById" parameterType="Long" resultMap="RmMonitorPolicyResult">
|
||||
<include refid="selectRmMonitorPolicyVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertRmMonitorPolicy" parameterType="RmMonitorPolicy" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into rm_monitor_policy
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="templateId != null">template_id,</if>
|
||||
<if test="resourceGroupId != null">resource_group_id,</if>
|
||||
<if test="policyName != null and policyName != ''">policy_name,</if>
|
||||
<if test="description != null">description,</if>
|
||||
<if test="status != null and status != ''">status,</if>
|
||||
<if test="deployTime != null">deploy_time,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="templateId != null">#{templateId},</if>
|
||||
<if test="resourceGroupId != null">#{resourceGroupId},</if>
|
||||
<if test="policyName != null and policyName != ''">#{policyName},</if>
|
||||
<if test="description != null">#{description},</if>
|
||||
<if test="status != null and status != ''">#{status},</if>
|
||||
<if test="deployTime != null">#{deployTime},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateRmMonitorPolicy" parameterType="RmMonitorPolicy">
|
||||
update rm_monitor_policy
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="templateId != null">template_id = #{templateId},</if>
|
||||
<if test="resourceGroupId != null">resource_group_id = #{resourceGroupId},</if>
|
||||
<if test="policyName != null and policyName != ''">policy_name = #{policyName},</if>
|
||||
<if test="description != null">description = #{description},</if>
|
||||
<if test="status != null and status != ''">status = #{status},</if>
|
||||
<if test="deployTime != null">deploy_time = #{deployTime},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteRmMonitorPolicyById" parameterType="Long">
|
||||
delete from rm_monitor_policy where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteRmMonitorPolicyByIds" parameterType="String">
|
||||
delete from rm_monitor_policy where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -0,0 +1,97 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.rocketmq.mapper.RmMonitorTemplateMapper">
|
||||
|
||||
<resultMap type="RmMonitorTemplate" id="RmMonitorTemplateResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="templateName" column="template_name" />
|
||||
<result property="description" column="description" />
|
||||
<result property="monitorItems" column="monitor_items" />
|
||||
<result property="discoveryRules" column="discovery_rules" />
|
||||
<result property="resourceGroupId" column="resource_group_id" />
|
||||
<result property="resourcyType" column="resourcy_type" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectRmMonitorTemplateVo">
|
||||
select id, template_name, description, monitor_items, discovery_rules, resource_group_id, resourcy_type, create_time, update_time, create_by, update_by from rm_monitor_template
|
||||
</sql>
|
||||
|
||||
<select id="selectRmMonitorTemplateList" parameterType="RmMonitorTemplate" resultMap="RmMonitorTemplateResult">
|
||||
<include refid="selectRmMonitorTemplateVo"/>
|
||||
<where>
|
||||
<if test="templateName != null and templateName != ''"> and template_name like concat('%', #{templateName}, '%')</if>
|
||||
<if test="description != null and description != ''"> and description = #{description}</if>
|
||||
<if test="monitorItems != null and monitorItems != ''"> and monitor_items = #{monitorItems}</if>
|
||||
<if test="discoveryRules != null and discoveryRules != ''"> and discovery_rules = #{discoveryRules}</if>
|
||||
<if test="resourceGroupId != null "> and resource_group_id = #{resourceGroupId}</if>
|
||||
<if test="resourcyType != null and resourcyType != ''"> and resourcy_type = #{resourcyType}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectRmMonitorTemplateById" parameterType="Long" resultMap="RmMonitorTemplateResult">
|
||||
<include refid="selectRmMonitorTemplateVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertRmMonitorTemplate" parameterType="RmMonitorTemplate" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into rm_monitor_template
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="templateName != null and templateName != ''">template_name,</if>
|
||||
<if test="description != null">description,</if>
|
||||
<if test="monitorItems != null">monitor_items,</if>
|
||||
<if test="discoveryRules != null">discovery_rules,</if>
|
||||
<if test="resourceGroupId != null">resource_group_id,</if>
|
||||
<if test="resourcyType != null">resourcy_type,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="templateName != null and templateName != ''">#{templateName},</if>
|
||||
<if test="description != null">#{description},</if>
|
||||
<if test="monitorItems != null">#{monitorItems},</if>
|
||||
<if test="discoveryRules != null">#{discoveryRules},</if>
|
||||
<if test="resourceGroupId != null">#{resourceGroupId},</if>
|
||||
<if test="resourcyType != null">#{resourcyType},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateRmMonitorTemplate" parameterType="RmMonitorTemplate">
|
||||
update rm_monitor_template
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="templateName != null and templateName != ''">template_name = #{templateName},</if>
|
||||
<if test="description != null">description = #{description},</if>
|
||||
<if test="monitorItems != null">monitor_items = #{monitorItems},</if>
|
||||
<if test="discoveryRules != null">discovery_rules = #{discoveryRules},</if>
|
||||
<if test="resourceGroupId != null">resource_group_id = #{resourceGroupId},</if>
|
||||
<if test="resourcyType != null">resourcy_type = #{resourcyType},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteRmMonitorTemplateById" parameterType="Long">
|
||||
delete from rm_monitor_template where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteRmMonitorTemplateByIds" parameterType="String">
|
||||
delete from rm_monitor_template where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -0,0 +1,128 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.rocketmq.mapper.RmTemplateLinuxMapper">
|
||||
|
||||
<resultMap type="RmTemplateLinux" id="RmTemplateLinuxResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="templateId" column="template_id" />
|
||||
<result property="policyId" column="policy_id" />
|
||||
<result property="itemType" column="item_type" />
|
||||
<result property="metricKey" column="metric_key" />
|
||||
<result property="metricName" column="metric_name" />
|
||||
<result property="dataType" column="data_type" />
|
||||
<result property="monitorStatus" column="monitor_status" />
|
||||
<result property="collectionCycle" column="collection_cycle" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectRmTemplateLinuxVo">
|
||||
select id, template_id, policy_id, item_type, metric_key, metric_name, data_type, monitor_status, collection_cycle, create_time, update_time, create_by, update_by from rm_template_linux
|
||||
</sql>
|
||||
|
||||
<select id="selectRmTemplateLinuxList" parameterType="RmTemplateLinux" resultMap="RmTemplateLinuxResult">
|
||||
<include refid="selectRmTemplateLinuxVo"/>
|
||||
<where>
|
||||
<if test="templateId != null "> and template_id = #{templateId}</if>
|
||||
<if test="policyId != null "> and policy_id = #{policyId}</if>
|
||||
<if test="itemType != null and itemType != ''"> and item_type = #{itemType}</if>
|
||||
<if test="metricKey != null and metricKey != ''"> and metric_key = #{metricKey}</if>
|
||||
<if test="metricName != null and metricName != ''"> and metric_name like concat('%', #{metricName}, '%')</if>
|
||||
<if test="dataType != null and dataType != ''"> and data_type = #{dataType}</if>
|
||||
<if test="monitorStatus != null and monitorStatus != ''"> and monitor_status = #{monitorStatus}</if>
|
||||
<if test="collectionCycle != null and collectionCycle != ''"> and collection_cycle = #{collectionCycle}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectRmTemplateLinuxById" parameterType="Long" resultMap="RmTemplateLinuxResult">
|
||||
<include refid="selectRmTemplateLinuxVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertRmTemplateLinux" parameterType="RmTemplateLinux" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into rm_template_linux
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="templateId != null">template_id,</if>
|
||||
<if test="policyId != null">policy_id,</if>
|
||||
<if test="itemType != null and itemType != ''">item_type,</if>
|
||||
<if test="metricKey != null and metricKey != ''">metric_key,</if>
|
||||
<if test="metricName != null and metricName != ''">metric_name,</if>
|
||||
<if test="dataType != null and dataType != ''">data_type,</if>
|
||||
<if test="monitorStatus != null">monitor_status,</if>
|
||||
<if test="collectionCycle != null">collection_cycle,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="templateId != null">#{templateId},</if>
|
||||
<if test="policyId != null">#{policyId},</if>
|
||||
<if test="itemType != null and itemType != ''">#{itemType},</if>
|
||||
<if test="metricKey != null and metricKey != ''">#{metricKey},</if>
|
||||
<if test="metricName != null and metricName != ''">#{metricName},</if>
|
||||
<if test="dataType != null and dataType != ''">#{dataType},</if>
|
||||
<if test="monitorStatus != null">#{monitorStatus},</if>
|
||||
<if test="collectionCycle != null">#{collectionCycle},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateRmTemplateLinux" parameterType="RmTemplateLinux">
|
||||
update rm_template_linux
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="templateId != null">template_id = #{templateId},</if>
|
||||
<if test="policyId != null">policy_id = #{policyId},</if>
|
||||
<if test="itemType != null and itemType != ''">item_type = #{itemType},</if>
|
||||
<if test="metricKey != null and metricKey != ''">metric_key = #{metricKey},</if>
|
||||
<if test="metricName != null and metricName != ''">metric_name = #{metricName},</if>
|
||||
<if test="dataType != null and dataType != ''">data_type = #{dataType},</if>
|
||||
<if test="monitorStatus != null">monitor_status = #{monitorStatus},</if>
|
||||
<if test="collectionCycle != null">collection_cycle = #{collectionCycle},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteRmTemplateLinuxById" parameterType="Long">
|
||||
delete from rm_template_linux where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteRmTemplateLinuxByIds" parameterType="String">
|
||||
delete from rm_template_linux where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
<insert id="batchInsertRmTemplateLinux" parameterType="list">
|
||||
insert into rm_template_linux
|
||||
(template_id, policy_id, item_type, metric_key, metric_name, data_type,
|
||||
monitor_status, create_time, update_time, create_by, update_by)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
#{item.templateId},
|
||||
#{item.policyId},
|
||||
#{item.itemType},
|
||||
#{item.metricKey},
|
||||
#{item.metricName},
|
||||
#{item.dataType},
|
||||
#{item.monitorStatus},
|
||||
#{item.createTime},
|
||||
#{item.updateTime},
|
||||
#{item.createBy},
|
||||
#{item.updateBy}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
</mapper>
|
||||
@@ -0,0 +1,160 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.rocketmq.mapper.RmTemplateSwitchMapper">
|
||||
|
||||
<resultMap type="RmTemplateSwitch" id="RmTemplateSwitchResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="templateId" column="template_id" />
|
||||
<result property="policyId" column="policy_id" />
|
||||
<result property="itemType" column="item_type" />
|
||||
<result property="metricKey" column="metric_key" />
|
||||
<result property="metricName" column="metric_name" />
|
||||
<result property="oid" column="oid" />
|
||||
<result property="filterValue" column="filter_value" />
|
||||
<result property="switchDescription" column="switch_description" />
|
||||
<result property="dataType" column="data_type" />
|
||||
<result property="monitorStatus" column="monitor_status" />
|
||||
<result property="collectionCycle" column="collection_cycle" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectRmTemplateSwitchVo">
|
||||
select id, template_id, policy_id, item_type, metric_key, metric_name, oid, filter_value, switch_description, data_type, monitor_status, collection_cycle, create_time, update_time, create_by, update_by from rm_template_switch
|
||||
</sql>
|
||||
|
||||
<select id="selectRmTemplateSwitchList" parameterType="RmTemplateSwitch" resultMap="RmTemplateSwitchResult">
|
||||
<include refid="selectRmTemplateSwitchVo"/>
|
||||
<where>
|
||||
<if test="templateId != null "> and template_id = #{templateId}</if>
|
||||
<if test="policyId != null "> and policy_id = #{policyId}</if>
|
||||
<if test="itemType != null and itemType != ''"> and item_type = #{itemType}</if>
|
||||
<if test="metricKey != null and metricKey != ''"> and metric_key = #{metricKey}</if>
|
||||
<if test="metricName != null and metricName != ''"> and metric_name like concat('%', #{metricName}, '%')</if>
|
||||
<if test="oid != null and oid != ''"> and oid = #{oid}</if>
|
||||
<if test="filterValue != null and filterValue != ''"> and filter_value = #{filterValue}</if>
|
||||
<if test="switchDescription != null and switchDescription != ''"> and switch_description = #{switchDescription}</if>
|
||||
<if test="dataType != null and dataType != ''"> and data_type = #{dataType}</if>
|
||||
<if test="monitorStatus != null and monitorStatus != ''"> and monitor_status = #{monitorStatus}</if>
|
||||
<if test="collectionCycle != null and collectionCycle != ''"> and collection_cycle = #{collectionCycle}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectRmTemplateSwitchById" parameterType="Long" resultMap="RmTemplateSwitchResult">
|
||||
<include refid="selectRmTemplateSwitchVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertRmTemplateSwitch" parameterType="RmTemplateSwitch" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into rm_template_switch
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="templateId != null">template_id,</if>
|
||||
<if test="policyId != null">policy_id,</if>
|
||||
<if test="itemType != null and itemType != ''">item_type,</if>
|
||||
<if test="metricKey != null and metricKey != ''">metric_key,</if>
|
||||
<if test="metricName != null and metricName != ''">metric_name,</if>
|
||||
<if test="oid != null and oid != ''">oid,</if>
|
||||
<if test="filterValue != null">filter_value,</if>
|
||||
<if test="switchDescription != null">switch_description,</if>
|
||||
<if test="dataType != null and dataType != ''">data_type,</if>
|
||||
<if test="monitorStatus != null">monitor_status,</if>
|
||||
<if test="collectionCycle != null">collection_cycle,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="templateId != null">#{templateId},</if>
|
||||
<if test="policyId != null">#{policyId},</if>
|
||||
<if test="itemType != null and itemType != ''">#{itemType},</if>
|
||||
<if test="metricKey != null and metricKey != ''">#{metricKey},</if>
|
||||
<if test="metricName != null and metricName != ''">#{metricName},</if>
|
||||
<if test="oid != null and oid != ''">#{oid},</if>
|
||||
<if test="filterValue != null">#{filterValue},</if>
|
||||
<if test="switchDescription != null">#{switchDescription},</if>
|
||||
<if test="dataType != null and dataType != ''">#{dataType},</if>
|
||||
<if test="monitorStatus != null">#{monitorStatus},</if>
|
||||
<if test="collectionCycle != null">#{collectionCycle},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateRmTemplateSwitch" parameterType="RmTemplateSwitch">
|
||||
update rm_template_switch
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="templateId != null">template_id = #{templateId},</if>
|
||||
<if test="policyId != null">policy_id = #{policyId},</if>
|
||||
<if test="itemType != null and itemType != ''">item_type = #{itemType},</if>
|
||||
<if test="metricKey != null and metricKey != ''">metric_key = #{metricKey},</if>
|
||||
<if test="metricName != null and metricName != ''">metric_name = #{metricName},</if>
|
||||
<if test="oid != null and oid != ''">oid = #{oid},</if>
|
||||
<if test="filterValue != null">filter_value = #{filterValue},</if>
|
||||
<if test="switchDescription != null">switch_description = #{switchDescription},</if>
|
||||
<if test="dataType != null and dataType != ''">data_type = #{dataType},</if>
|
||||
<if test="monitorStatus != null">monitor_status = #{monitorStatus},</if>
|
||||
<if test="collectionCycle != null">collection_cycle = #{collectionCycle},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteRmTemplateSwitchById" parameterType="Long">
|
||||
delete from rm_template_switch where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteRmTemplateSwitchByIds" parameterType="String">
|
||||
delete from rm_template_switch where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
<insert id="batchInsertRmTemplateSwitch" parameterType="list">
|
||||
INSERT INTO rm_template_switch
|
||||
(
|
||||
template_id,
|
||||
policy_id,
|
||||
item_type,
|
||||
metric_key,
|
||||
metric_name,
|
||||
oid,
|
||||
filter_value,
|
||||
switch_description,
|
||||
data_type,
|
||||
monitor_status,
|
||||
create_time,
|
||||
update_time,
|
||||
create_by,
|
||||
update_by
|
||||
)
|
||||
VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
#{item.templateId},
|
||||
#{item.policyId},
|
||||
#{item.itemType},
|
||||
#{item.metricKey},
|
||||
#{item.metricName},
|
||||
#{item.oid},
|
||||
#{item.filterValue},
|
||||
#{item.switchDescription},
|
||||
#{item.dataType},
|
||||
#{item.monitorStatus},
|
||||
#{item.createTime},
|
||||
#{item.updateTime},
|
||||
#{item.createBy},
|
||||
#{item.updateBy}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user