✨ Introducing new features. 增加cache监控
This commit is contained in:
1 parent
8eba77edad
commit
4d68be3359
2 files changed
+62
-1
No files matched your search
+3
-1
@@ -521,9 +521,10 @@ INSERT INTO `sys_menu` VALUES (3027, '新增菜单', 'mp_wxmenu_add', NULL, 3002
|
||||
INSERT INTO `sys_menu` VALUES (3028, '发布菜单', 'mp_wxmenu_push', NULL, 3002, NULL, '0', 0, '0', '0', '1', 'admin', '2023-02-27 20:54:48', ' ', NULL, '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (3029, '删除菜单', 'mp_wxmenu_del', NULL, 3002, NULL, '0', 0, '0', '0', '1', 'admin', '2023-02-27 20:54:57', ' ', NULL, '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (4000, '系统监控', NULL, '/daemon', -1, 'iconfont icon-shuju', '1', 3, '0', '0', '0', 'admin', '2023-02-06 20:20:47', 'admin', '2023-02-23 20:01:07', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (4001, '文档扩展', NULL, 'http://pigx-gateway:9999/doc.html', 4000, 'icon-wendang', '1', 2, '0', '1', '0', '', '2018-06-26 10:50:32', 'admin', '2023-02-23 20:01:29', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (4001, '文档扩展', NULL, 'http://pigx-gateway:9999/admin/doc.html', 4000, 'iconfont icon-biaodan', '1', 2, '0', '1', '0', '', '2018-06-26 10:50:32', 'admin', '2023-02-23 20:01:29', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (4002, '大屏设计', NULL, '/ext/report', -1, 'iconfont icon-putong', '1', 6, '0', '0', '0', 'admin', '2023-04-07 11:04:01', ' ', '2023-04-07 06:22:16', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (4003, '报表设计', NULL, '/ext/jimu', -1, 'iconfont icon-shuju', '1', 7, '0', '0', '0', 'admin', '2023-04-07 13:15:56', 'admin', '2023-04-07 06:22:19', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (4004, '缓存监控', NULL, '/ext/cache', 4000, 'iconfont icon-shuju', '1', 1, '0', '0', '0', 'admin', '2023-05-29 15:12:59', 'admin', '2023-06-06 19:31:18', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (5000, '支付系统', NULL, '/pay', -1, 'iconfont icon-neiqianshujuchucun', '1', 4, '0', '0', '0', 'admin', '2023-02-27 10:57:14', 'admin', '2023-02-27 11:00:47', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (5001, '收银台', NULL, '/pay/cd/index', 5000, 'iconfont icon-diqiu1', '1', 0, '0', '0', '0', 'admin', '2023-02-27 10:58:13', 'admin', '2023-02-27 11:00:14', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (5002, '支付渠道', NULL, '/pay/channel/index', 5000, 'iconfont icon-crew_feature', '1', 1, '0', '0', '0', 'admin', '2023-02-27 19:36:55', 'admin', '2023-02-28 20:02:53', '0', 1);
|
||||
@@ -883,6 +884,7 @@ INSERT INTO `sys_role_menu` VALUES (1, 4000);
|
||||
INSERT INTO `sys_role_menu` VALUES (1, 4001);
|
||||
INSERT INTO `sys_role_menu` VALUES (1, 4002);
|
||||
INSERT INTO `sys_role_menu` VALUES (1, 4003);
|
||||
INSERT INTO `sys_role_menu` VALUES (1, 4004);
|
||||
INSERT INTO `sys_role_menu` VALUES (1, 5000);
|
||||
INSERT INTO `sys_role_menu` VALUES (1, 5001);
|
||||
INSERT INTO `sys_role_menu` VALUES (1, 5002);
|
||||
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
package com.pig4cloud.pigx.admin.controller;
|
||||
|
||||
import com.pig4cloud.pigx.common.core.util.R;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.data.redis.connection.RedisServerCommands;
|
||||
import org.springframework.data.redis.core.RedisCallback;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/system")
|
||||
@RequiredArgsConstructor
|
||||
@Tag(description = "system", name = "系统监控")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class SysSystemInfoController {
|
||||
|
||||
private final RedisTemplate<String, String> redisTemplate;
|
||||
|
||||
/**
|
||||
* 缓存监控
|
||||
* @return R<Object>
|
||||
*/
|
||||
@GetMapping("/cache")
|
||||
public R cache() {
|
||||
Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) RedisServerCommands::info);
|
||||
Properties commandStats = (Properties) redisTemplate
|
||||
.execute((RedisCallback<Object>) connection -> connection.info("commandstats"));
|
||||
Object dbSize = redisTemplate.execute((RedisCallback<Object>) RedisServerCommands::dbSize);
|
||||
|
||||
if (commandStats == null) {
|
||||
return R.failed("获取异常");
|
||||
}
|
||||
|
||||
Map<String, Object> result = new HashMap<>(3);
|
||||
result.put("info", info);
|
||||
result.put("dbSize", dbSize);
|
||||
|
||||
List<Map<String, String>> pieList = new ArrayList<>();
|
||||
commandStats.stringPropertyNames().forEach(key -> {
|
||||
Map<String, String> data = new HashMap<>(2);
|
||||
String property = commandStats.getProperty(key);
|
||||
data.put("name", StringUtils.removeStart(key, "cmdstat_"));
|
||||
data.put("value", StringUtils.substringBetween(property, "calls=", ",usec"));
|
||||
pieList.add(data);
|
||||
});
|
||||
|
||||
result.put("commandStats", pieList);
|
||||
return R.ok(result);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user