¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.web.controller.monitor;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | | import java.util.Properties;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.data.redis.core.RedisCallback;
|
| | | import org.springframework.data.redis.core.RedisTemplate;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | import org.springframework.web.bind.annotation.GetMapping;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RestController;
|
| | | import com.ruoyi.common.core.domain.AjaxResult;
|
| | | import com.ruoyi.common.utils.StringUtils;
|
| | |
|
| | | /**
|
| | | * ç¼åçæ§
|
| | | * |
| | | * @author ruoyi
|
| | | */
|
| | | @RestController
|
| | | @RequestMapping("/monitor/cache")
|
| | | public class CacheController
|
| | | {
|
| | | @Autowired
|
| | | private RedisTemplate<String, String> redisTemplate;
|
| | |
|
| | | @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
| | | @GetMapping()
|
| | | public AjaxResult getInfo() throws Exception
|
| | | {
|
| | | Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info());
|
| | | Properties commandStats = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info("commandstats"));
|
| | | Object dbSize = redisTemplate.execute((RedisCallback<Object>) connection -> connection.dbSize());
|
| | |
|
| | | 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 AjaxResult.success(result);
|
| | | }
|
| | | }
|
| | |
| | | import org.springframework.web.bind.annotation.GetMapping;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RestController;
|
| | | import com.ruoyi.common.core.controller.BaseController;
|
| | | import com.ruoyi.common.core.domain.AjaxResult;
|
| | | import com.ruoyi.framework.web.domain.Server;
|
| | |
|
| | |
| | | */
|
| | | @RestController
|
| | | @RequestMapping("/monitor/server")
|
| | | public class ServerController extends BaseController
|
| | | public class ServerController
|
| | | {
|
| | | @PreAuthorize("@ss.hasPermi('monitor:server:list')")
|
| | | @GetMapping()
|
¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from '@/utils/request'
|
| | |
|
| | | // æ¥è¯¢ç¼å详ç»
|
| | | export function getCache() {
|
| | | return request({
|
| | | url: '/monitor/cache',
|
| | | method: 'get'
|
| | | })
|
| | | }
|
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1605865043777" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="856" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M1023.786667 611.84c-0.426667 9.770667-13.354667 20.693333-39.893334 34.56-54.613333 28.458667-337.749333 144.896-397.994666 176.298667-60.288 31.402667-93.738667 31.104-141.354667 8.32-47.616-22.741333-348.842667-144.469333-403.114667-170.368-27.093333-12.970667-40.917333-23.893333-41.386666-34.218667v103.509333c0 10.325333 14.250667 21.290667 41.386666 34.261334 54.272 25.941333 355.541333 147.626667 403.114667 170.368 47.616 22.784 81.066667 23.082667 141.354667-8.362667 60.245333-31.402667 343.338667-147.797333 397.994666-176.298667 27.776-14.464 40.106667-25.728 40.106667-35.925333v-102.058667l-0.213333-0.085333z m0-168.746667c-0.512 9.770667-13.397333 20.650667-39.893334 34.517334-54.613333 28.458667-337.749333 144.896-397.994666 176.298666-60.288 31.402667-93.738667 31.104-141.354667 8.362667-47.616-22.741333-348.842667-144.469333-403.114667-170.410667-27.093333-12.928-40.917333-23.893333-41.386666-34.176v103.509334c0 10.325333 14.250667 21.248 41.386666 34.218666 54.272 25.941333 355.498667 147.626667 403.114667 170.368 47.616 22.784 81.066667 23.082667 141.354667-8.32 60.245333-31.402667 343.338667-147.84 397.994666-176.298666 27.776-14.506667 40.106667-25.770667 40.106667-35.968v-102.058667l-0.256-0.042667z m0-175.018666c0.469333-10.410667-13.141333-19.541333-40.533334-29.610667-53.248-19.498667-334.634667-131.498667-388.522666-151.253333-53.888-19.712-75.818667-18.901333-139.093334 3.84C392.234667 113.706667 92.629333 231.253333 39.338667 252.074667c-26.666667 10.496-39.68 20.181333-39.253334 30.506666V386.133333c0 10.325333 14.250667 21.248 41.386667 34.218667 54.272 25.941333 355.498667 147.669333 403.114667 170.410667 47.616 22.741333 81.066667 23.04 141.354666-8.362667 60.245333-31.402667 343.338667-147.84 397.994667-176.298667 27.776-14.506667 40.106667-25.770667 40.106667-35.968V268.074667h-0.341334zM366.677333 366.08l237.269334-36.437333-71.68 105.088-165.546667-68.650667z m524.8-94.634667l-140.330666 55.466667-15.232 5.973333-140.245334-55.466666 155.392-61.44 140.373334 55.466666z m-411.989333-101.674666l-22.954667-42.325334 71.594667 27.989334 67.498667-22.101334-18.261334 43.733334 68.778667 25.770666-88.704 9.216-19.882667 47.786667-32.085333-53.290667-102.4-9.216 76.416-27.562666z m-176.768 59.733333c70.058667 0 126.805333 21.973333 126.805333 49.109333s-56.746667 49.152-126.805333 49.152-126.848-22.058667-126.848-49.152c0-27.136 56.789333-49.152 126.848-49.152z" p-id="857"></path></svg> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template>
|
| | | <div class="app-container">
|
| | | <el-row>
|
| | | <el-col :span="24" class="card-box">
|
| | | <el-card>
|
| | | <div slot="header"><span>åºæ¬ä¿¡æ¯</span></div>
|
| | | <div class="el-table el-table--enable-row-hover el-table--medium">
|
| | | <table cellspacing="0" style="width: 100%">
|
| | | <tbody>
|
| | | <tr>
|
| | | <td><div class="cell">Redisçæ¬</div></td>
|
| | | <td><div class="cell" v-if="cache.info">{{ cache.info.redis_version }}</div></td>
|
| | | <td><div class="cell">è¿è¡æ¨¡å¼</div></td>
|
| | | <td><div class="cell" v-if="cache.info">{{ cache.info.redis_mode == "standalone" ? "åæº" : "é群" }}</div></td>
|
| | | <td><div class="cell">端å£</div></td>
|
| | | <td><div class="cell" v-if="cache.info">{{ cache.info.tcp_port }}</div></td>
|
| | | <td><div class="cell">客æ·ç«¯æ°</div></td>
|
| | | <td><div class="cell" v-if="cache.info">{{ cache.info.connected_clients }}</div></td>
|
| | | </tr>
|
| | | <tr>
|
| | | <td><div class="cell">è¿è¡æ¶é´(天)</div></td>
|
| | | <td><div class="cell" v-if="cache.info">{{ cache.info.uptime_in_days }}</div></td>
|
| | | <td><div class="cell">使ç¨å
å</div></td>
|
| | | <td><div class="cell" v-if="cache.info">{{ cache.info.used_memory_human }}</div></td>
|
| | | <td><div class="cell">使ç¨CPU</div></td>
|
| | | <td><div class="cell" v-if="cache.info">{{ parseFloat(cache.info.used_cpu_user_children).toFixed(2) }}</div></td>
|
| | | <td><div class="cell">å
åé
ç½®</div></td>
|
| | | <td><div class="cell" v-if="cache.info">{{ cache.info.maxmemory_human }}</div></td>
|
| | | </tr>
|
| | | <tr>
|
| | | <td><div class="cell">AOFæ¯å¦å¼å¯</div></td>
|
| | | <td><div class="cell" v-if="cache.info">{{ cache.info.aof_enabled == "0" ? "å¦" : "æ¯" }}</div></td>
|
| | | <td><div class="cell">RDBæ¯å¦æå</div></td>
|
| | | <td><div class="cell" v-if="cache.info">{{ cache.info.rdb_last_bgsave_status }}</div></td>
|
| | | <td><div class="cell">Keyæ°é</div></td>
|
| | | <td><div class="cell" v-if="cache.dbSize">{{ cache.dbSize }} </div></td>
|
| | | <td><div class="cell">ç½ç»å
¥å£/åºå£</div></td>
|
| | | <td><div class="cell" v-if="cache.info">{{ cache.info.instantaneous_input_kbps }}kps/{{cache.info.instantaneous_output_kbps}}kps</div></td>
|
| | | </tr>
|
| | | </tbody>
|
| | | </table>
|
| | | </div>
|
| | | </el-card>
|
| | | </el-col>
|
| | |
|
| | | <el-col :span="12" class="card-box">
|
| | | <el-card>
|
| | | <div slot="header"><span>å½ä»¤ç»è®¡</span></div>
|
| | | <div class="el-table el-table--enable-row-hover el-table--medium">
|
| | | <div ref="commandstats" style="height: 420px" />
|
| | | </div>
|
| | | </el-card>
|
| | | </el-col>
|
| | |
|
| | | <el-col :span="12" class="card-box">
|
| | | <el-card>
|
| | | <div slot="header">
|
| | | <span>å
åä¿¡æ¯</span>
|
| | | </div>
|
| | | <div class="el-table el-table--enable-row-hover el-table--medium">
|
| | | <div ref="usedmemory" style="height: 420px" />
|
| | | </div>
|
| | | </el-card>
|
| | | </el-col>
|
| | | </el-row>
|
| | | </div>
|
| | | </template>
|
| | |
|
| | | <script>
|
| | | import { getCache } from "@/api/monitor/cache";
|
| | | import echarts from "echarts";
|
| | |
|
| | | export default {
|
| | | name: "Server",
|
| | | data() {
|
| | | return {
|
| | | // å è½½å±ä¿¡æ¯
|
| | | loading: [],
|
| | | // ç»è®¡å½ä»¤ä¿¡æ¯
|
| | | commandstats: null,
|
| | | // 使ç¨å
å
|
| | | usedmemory: null,
|
| | | // cacheä¿¡æ¯
|
| | | cache: [],
|
| | | };
|
| | | },
|
| | | created() {
|
| | | this.getList();
|
| | | this.openLoading();
|
| | | },
|
| | | methods: {
|
| | | /** æ¥ç¼åè¯¢ä¿¡æ¯ */
|
| | | getList() {
|
| | | getCache().then((response) => {
|
| | | this.cache = response.data;
|
| | | this.loading.close();
|
| | |
|
| | | this.commandstats = echarts.init(this.$refs.commandstats, "macarons");
|
| | | this.commandstats.setOption({
|
| | | tooltip: {
|
| | | trigger: "item",
|
| | | formatter: "{a} <br/>{b} : {c} ({d}%)",
|
| | | },
|
| | | series: [
|
| | | {
|
| | | name: "å½ä»¤",
|
| | | type: "pie",
|
| | | roseType: "radius",
|
| | | radius: [15, 95],
|
| | | center: ["50%", "38%"],
|
| | | data: response.data.commandStats,
|
| | | animationEasing: "cubicInOut",
|
| | | animationDuration: 1000,
|
| | | },
|
| | | ],
|
| | | });
|
| | | this.usedmemory = echarts.init(this.$refs.usedmemory, "macarons");
|
| | | this.usedmemory.setOption({
|
| | | tooltip: {
|
| | | formatter: "{b} <br/>{a} : {c}M",
|
| | | },
|
| | | series: [
|
| | | {
|
| | | name: "å³°å¼",
|
| | | type: "gauge",
|
| | | detail: {
|
| | | formatter: "{value}M",
|
| | | },
|
| | | data: [
|
| | | {
|
| | | value: parseFloat(this.cache.info.used_memory_human),
|
| | | name: "å
åæ¶è",
|
| | | },
|
| | | ],
|
| | | },
|
| | | ],
|
| | | });
|
| | | });
|
| | | },
|
| | | // æå¼å è½½å±
|
| | | openLoading() {
|
| | | this.loading = this.$loading({
|
| | | lock: true,
|
| | | text: "æ¼å½è¯»åä¸",
|
| | | spinner: "el-icon-loading",
|
| | | background: "rgba(0, 0, 0, 0.7)",
|
| | | });
|
| | | },
|
| | | },
|
| | | };
|
| | | </script>
|
ÎļþÃû´Ó sql/ry_20201021.sql ÐÞ¸Ä |
| | |
| | | insert into sys_menu values('110', '宿¶ä»»å¡', '2', '2', 'job', 'monitor/job/index', 1, 0, 'C', '0', '0', 'monitor:job:list', 'job', 'admin', sysdate(), '', null, '宿¶ä»»å¡èå');
|
| | | insert into sys_menu values('111', 'æ°æ®çæ§', '2', '3', 'druid', 'monitor/druid/index', 1, 0, 'C', '0', '0', 'monitor:druid:list', 'druid', 'admin', sysdate(), '', null, 'æ°æ®çæ§èå');
|
| | | insert into sys_menu values('112', 'æå¡çæ§', '2', '4', 'server', 'monitor/server/index', 1, 0, 'C', '0', '0', 'monitor:server:list', 'server', 'admin', sysdate(), '', null, 'æå¡çæ§èå');
|
| | | insert into sys_menu values('113', '表åæå»º', '3', '1', 'build', 'tool/build/index', 1, 0, 'C', '0', '0', 'tool:build:list', 'build', 'admin', sysdate(), '', null, '表åæå»ºèå');
|
| | | insert into sys_menu values('114', '代ç çæ', '3', '2', 'gen', 'tool/gen/index', 1, 0, 'C', '0', '0', 'tool:gen:list', 'code', 'admin', sysdate(), '', null, '代ç çæèå');
|
| | | insert into sys_menu values('115', 'ç³»ç»æ¥å£', '3', '3', 'swagger', 'tool/swagger/index', 1, 0, 'C', '0', '0', 'tool:swagger:list', 'swagger', 'admin', sysdate(), '', null, 'ç³»ç»æ¥å£èå');
|
| | | insert into sys_menu values('113', 'ç¼åçæ§', '2', '5', 'cache', 'monitor/cache/index', 1, 0, 'C', '0', '0', 'monitor:cache:list', 'redis', 'admin', sysdate(), '', null, 'ç¼åçæ§èå');
|
| | | insert into sys_menu values('114', '表åæå»º', '3', '1', 'build', 'tool/build/index', 1, 0, 'C', '0', '0', 'tool:build:list', 'build', 'admin', sysdate(), '', null, '表åæå»ºèå');
|
| | | insert into sys_menu values('115', '代ç çæ', '3', '2', 'gen', 'tool/gen/index', 1, 0, 'C', '0', '0', 'tool:gen:list', 'code', 'admin', sysdate(), '', null, '代ç çæèå');
|
| | | insert into sys_menu values('116', 'ç³»ç»æ¥å£', '3', '3', 'swagger', 'tool/swagger/index', 1, 0, 'C', '0', '0', 'tool:swagger:list', 'swagger', 'admin', sysdate(), '', null, 'ç³»ç»æ¥å£èå');
|
| | | -- ä¸çº§èå
|
| | | insert into sys_menu values('500', 'æä½æ¥å¿', '108', '1', 'operlog', 'monitor/operlog/index', 1, 0, 'C', '0', '0', 'monitor:operlog:list', 'form', 'admin', sysdate(), '', null, 'æä½æ¥å¿èå');
|
| | | insert into sys_menu values('501', 'ç»å½æ¥å¿', '108', '2', 'logininfor', 'monitor/logininfor/index', 1, 0, 'C', '0', '0', 'monitor:logininfor:list', 'logininfor', 'admin', sysdate(), '', null, 'ç»å½æ¥å¿èå');
|
| | |
| | | insert into sys_menu values('1053', 'ç¶æä¿®æ¹', '110', '5', '#', '', 1, 0, 'F', '0', '0', 'monitor:job:changeStatus', '#', 'admin', sysdate(), '', null, '');
|
| | | insert into sys_menu values('1054', 'ä»»å¡å¯¼åº', '110', '7', '#', '', 1, 0, 'F', '0', '0', 'monitor:job:export', '#', 'admin', sysdate(), '', null, '');
|
| | | -- 代ç çææé®
|
| | | insert into sys_menu values('1055', 'çææ¥è¯¢', '114', '1', '#', '', 1, 0, 'F', '0', '0', 'tool:gen:query', '#', 'admin', sysdate(), '', null, '');
|
| | | insert into sys_menu values('1056', 'çæä¿®æ¹', '114', '2', '#', '', 1, 0, 'F', '0', '0', 'tool:gen:edit', '#', 'admin', sysdate(), '', null, '');
|
| | | insert into sys_menu values('1057', 'çæå é¤', '114', '3', '#', '', 1, 0, 'F', '0', '0', 'tool:gen:remove', '#', 'admin', sysdate(), '', null, '');
|
| | | insert into sys_menu values('1058', '导å
¥ä»£ç ', '114', '2', '#', '', 1, 0, 'F', '0', '0', 'tool:gen:import', '#', 'admin', sysdate(), '', null, '');
|
| | | insert into sys_menu values('1059', 'é¢è§ä»£ç ', '114', '4', '#', '', 1, 0, 'F', '0', '0', 'tool:gen:preview', '#', 'admin', sysdate(), '', null, '');
|
| | | insert into sys_menu values('1060', 'çæä»£ç ', '114', '5', '#', '', 1, 0, 'F', '0', '0', 'tool:gen:code', '#', 'admin', sysdate(), '', null, '');
|
| | | insert into sys_menu values('1055', 'çææ¥è¯¢', '115', '1', '#', '', 1, 0, 'F', '0', '0', 'tool:gen:query', '#', 'admin', sysdate(), '', null, '');
|
| | | insert into sys_menu values('1056', 'çæä¿®æ¹', '115', '2', '#', '', 1, 0, 'F', '0', '0', 'tool:gen:edit', '#', 'admin', sysdate(), '', null, '');
|
| | | insert into sys_menu values('1057', 'çæå é¤', '115', '3', '#', '', 1, 0, 'F', '0', '0', 'tool:gen:remove', '#', 'admin', sysdate(), '', null, '');
|
| | | insert into sys_menu values('1058', '导å
¥ä»£ç ', '115', '2', '#', '', 1, 0, 'F', '0', '0', 'tool:gen:import', '#', 'admin', sysdate(), '', null, '');
|
| | | insert into sys_menu values('1059', 'é¢è§ä»£ç ', '115', '4', '#', '', 1, 0, 'F', '0', '0', 'tool:gen:preview', '#', 'admin', sysdate(), '', null, '');
|
| | | insert into sys_menu values('1060', 'çæä»£ç ', '115', '5', '#', '', 1, 0, 'F', '0', '0', 'tool:gen:code', '#', 'admin', sysdate(), '', null, '');
|
| | |
|
| | |
|
| | | -- ----------------------------
|
| | |
| | | insert into sys_role_menu values ('2', '113');
|
| | | insert into sys_role_menu values ('2', '114');
|
| | | insert into sys_role_menu values ('2', '115');
|
| | | insert into sys_role_menu values ('2', '116');
|
| | | insert into sys_role_menu values ('2', '500');
|
| | | insert into sys_role_menu values ('2', '501');
|
| | | insert into sys_role_menu values ('2', '1000');
|