diff --git a/locales/en.yaml b/locales/en.yaml index 9b1ce67..defdf2f 100644 --- a/locales/en.yaml +++ b/locales/en.yaml @@ -37,6 +37,7 @@ buttons:UploadAvatar: Upload Avatar buttons:ResetPassword: Reset Password buttons:RoleAllocation: Role Allocation buttons:PermissionDetails: Permission Details +buttons:ForceToExit: Force Exit search:Total: Total search:History: History search:Collect: Collect @@ -88,10 +89,13 @@ menus:SystemDepartment: Department Manage menus:SystemI18n: i18n Manage menus:SystemI18nLocale: Locale Manage menus:SystemI18nLanguage: Language Manage -menus:SysMonitor: System Monitor +menus:SystemMonitor: System Monitor menus:OnlineUser: Online User menus:LoginLog: Login Log menus:OperationLog: Operation Log +menus:CacheMonitor: Cache Monitor +menus:CacheList: Cache List +menus:ServerMonitor: Server Monitor menus:Abnormal: Abnormal Page menus:FourZeroFour: "404" menus:FourZeroOne: "403" diff --git a/locales/zh-CN.yaml b/locales/zh-CN.yaml index ce4cb9a..43e56dd 100644 --- a/locales/zh-CN.yaml +++ b/locales/zh-CN.yaml @@ -37,6 +37,7 @@ buttons:UploadAvatar: 上传头像 buttons:ResetPassword: 重置密码 buttons:RoleAllocation: 角色分配 buttons:PermissionDetails: 权限详情 +buttons:ForceToExit: 强制退出 search:Total: 共 search:History: 搜索历史 search:Collect: 收藏 @@ -88,10 +89,13 @@ menus:SystemDepartment: 部门管理 menus:SystemI18n: 国际化管理 menus:SystemI18nLocale: 类型管理 menus:SystemI18nLanguage: 语言管理 -menus:SysMonitor: 系统监控 +menus:SystemMonitor: 系统监控 menus:OnlineUser: 在线用户 menus:LoginLog: 登录日志 menus:OperationLog: 操作日志 +menus:CacheMonitor: 缓存监控 +menus:CacheList: 缓存列表 +menus:ServerMonitor: 服务监控 menus:Abnormal: 异常页面 menus:FourZeroFour: "404" menus:FourZeroOne: "403" diff --git a/src/api/monitor.ts b/src/api/monitor.ts new file mode 100644 index 0000000..a8fd85f --- /dev/null +++ b/src/api/monitor.ts @@ -0,0 +1,30 @@ +import { http } from "@/utils/http"; +import type { UserLoginLogInfo } from "types/monitor"; +import { filterEmptyObject } from "./utils"; + +// --------------------------登录日志相关-------------------------------------- +/** + * 用户获取登录日志 + */ + +export const getUserLoginLogAPI = (params: { + page: number; + pageSize: number; +}) => { + return http.request>( + "get", + "/api/log/login", + { + params: filterEmptyObject(params) + } + ); +}; + +/** + * 用户强退 + * @param id + * @returns + */ +export const deleteUserOnlineAPI = (id: string) => { + return http.request("delete", `/api/log/logout/${id}`); +}; diff --git a/src/utils/http/index.ts b/src/utils/http/index.ts index d36c800..8b77de0 100644 --- a/src/utils/http/index.ts +++ b/src/utils/http/index.ts @@ -76,7 +76,7 @@ class Http { "/api/refreshToken", "/api/login" ]; - return whiteList.some(url => config.url.endsWith(url)) + return whiteList.includes(config.url) ? config : new Promise(resolve => { const data = getTokenInfo(); diff --git a/src/views/monitor/login/index.vue b/src/views/monitor/login/index.vue new file mode 100644 index 0000000..f9b7a53 --- /dev/null +++ b/src/views/monitor/login/index.vue @@ -0,0 +1,183 @@ + + + + + diff --git a/src/views/monitor/login/utils/hook.tsx b/src/views/monitor/login/utils/hook.tsx new file mode 100644 index 0000000..99e0256 --- /dev/null +++ b/src/views/monitor/login/utils/hook.tsx @@ -0,0 +1,225 @@ +import dayjs from "dayjs"; +import { message } from "@/utils/message"; +import { getKeyList } from "@pureadmin/utils"; +import { deleteUserOnlineAPI, getUserLoginLogAPI } from "@/api/monitor"; +import { usePublicHooks } from "@/views/system/hooks"; +import type { PaginationProps } from "@pureadmin/table"; +import { type Ref, reactive, ref, onMounted } from "vue"; +import type { UserLoginLogInfo } from "types/monitor"; + +export const useLogin = (tableRef: Ref) => { + const form = reactive({ + username: "", + status: "", + loginTime: "" + }); + /** + * 表格数据 + */ + const dataList = ref([]); + /** + * 表格加载状态 + */ + const loading = ref(true); + /** + * 已选数量 + */ + const selectedNum = ref(0); + const { tagStyle } = usePublicHooks(); + /** + * 分页参数 + */ + const pagination = reactive({ + total: 0, + pageSize: 10, + currentPage: 1, + background: true + }); + const columns: TableColumnList = [ + { + label: "勾选列", // 如果需要表格多选,此处label必须设置 + type: "selection", + fixed: "left", + reserveSelection: true // 数据刷新后保留选项 + }, + { + label: "会话ID", + prop: "session_id", + minWidth: 100 + }, + { + label: "用户账号", + prop: "username", + minWidth: 100 + }, + { + label: "用户昵称", + prop: "user_nickname", + minWidth: 100 + }, + { + label: "所属部门", + prop: "department_name", + minWidth: 100 + }, + { + label: "登录 IP", + prop: "login_ip", + minWidth: 140 + }, + { + label: "登录地点", + prop: "login_location", + minWidth: 140 + }, + { + label: "操作系统", + prop: "os", + minWidth: 100 + }, + { + label: "浏览器类型", + prop: "browser", + minWidth: 100 + }, + { + label: "登录状态", + prop: "status", + minWidth: 100, + cellRenderer: ({ row, props }) => ( + + {row.status === 1 ? "成功" : "失败"} + + ) + }, + { + label: "登录时间", + prop: "login_time", + minWidth: 180, + formatter: ({ login_time }) => + dayjs(login_time).format("YYYY-MM-DD HH:mm:ss") + }, + { + label: "操作", + fixed: "right", + slot: "operation" + } + ]; + + /** + * 当前页变化 + * @param val + */ + const handleCurrentChange = async (val: number) => { + const res = await getUserLoginLogAPI({ + page: val, + pageSize: pagination.pageSize + }); + if (res.success) { + dataList.value = res.data.result; + pagination.total = res.data.total; + pagination.currentPage = res.data.page; + } + }; + + /**处理页码变化 */ + const handleSizeChange = async (val: number) => { + const res = await getUserLoginLogAPI({ + page: pagination.currentPage, + pageSize: val + }); + if (res.success) { + dataList.value = res.data.result; + pagination.total = res.data.total; + pagination.currentPage = res.data.page; + } + }; + + /** 当CheckBox选择项发生变化时会触发该事件 */ + const handleSelectionChange = val => { + selectedNum.value = val.length; + // 重置表格高度 + tableRef.value.setAdaptive(); + }; + + /** 取消选择 */ + const onSelectionCancel = () => { + selectedNum.value = 0; + // 用于多选表格,清空用户的选择 + tableRef.value.getTableRef().clearSelection(); + }; + + /** 批量删除 */ + const onbatchDel = () => { + // 返回当前选中的行 + const curSelected = tableRef.value.getTableRef().getSelectionRows(); + // 接下来根据实际业务,通过选中行的某项数据,比如下面的id,调用接口进行批量删除 + message(`已删除序号为 ${getKeyList(curSelected, "id")} 的数据`, { + type: "success" + }); + tableRef.value.getTableRef().clearSelection(); + onSearch(); + }; + + /** 清空日志 */ + const clearAll = async () => { + // 根据实际业务,调用接口删除所有日志数据 + message("已删除所有日志数据", { + type: "success" + }); + await onSearch(); + }; + + const onSearch = async () => { + loading.value = true; + const res = await getUserLoginLogAPI({ + page: pagination.currentPage, + pageSize: pagination.pageSize + }); + if (res.success) { + dataList.value = res.data.result; + pagination.total = res.data.total; + pagination.currentPage = res.data.page; + } + setTimeout(() => { + loading.value = false; + }, 500); + }; + + const resetForm = formEl => { + if (!formEl) return; + formEl.resetFields(); + onSearch(); + }; + const deleteUserHandle = async (id: string) => { + const res = await deleteUserOnlineAPI(id); + if (res.success) { + message("账号强退成功!", { + type: "success" + }); + onSearch(); + } + }; + + onMounted(() => { + onSearch(); + }); + + return { + form, + loading, + columns, + dataList, + pagination, + selectedNum, + onSearch, + clearAll, + resetForm, + onbatchDel, + deleteUserHandle, + onSelectionCancel, + handleCurrentChange, + handleSizeChange, + handleSelectionChange + }; +}; diff --git a/src/views/monitor/utils.ts b/src/views/monitor/utils.ts new file mode 100644 index 0000000..1350606 --- /dev/null +++ b/src/views/monitor/utils.ts @@ -0,0 +1,129 @@ +/** 日期、时间选择器快捷选项,常搭配 [DatePicker](https://element-plus.org/zh-CN/component/date-picker.html) 和 [DateTimePicker](https://element-plus.org/zh-CN/component/datetime-picker.html) 的`shortcuts`属性使用 */ +export const getPickerShortcuts = (): Array<{ + text: string; + value: Date | Function; +}> => { + return [ + { + text: "今天", + value: () => { + const today = new Date(); + today.setHours(0, 0, 0, 0); + const todayEnd = new Date(); + todayEnd.setHours(23, 59, 59, 999); + return [today, todayEnd]; + } + }, + { + text: "昨天", + value: () => { + const yesterday = new Date(); + yesterday.setDate(yesterday.getDate() - 1); + yesterday.setHours(0, 0, 0, 0); + const yesterdayEnd = new Date(); + yesterdayEnd.setDate(yesterdayEnd.getDate() - 1); + yesterdayEnd.setHours(23, 59, 59, 999); + return [yesterday, yesterdayEnd]; + } + }, + { + text: "前天", + value: () => { + const beforeYesterday = new Date(); + beforeYesterday.setDate(beforeYesterday.getDate() - 2); + beforeYesterday.setHours(0, 0, 0, 0); + const beforeYesterdayEnd = new Date(); + beforeYesterdayEnd.setDate(beforeYesterdayEnd.getDate() - 2); + beforeYesterdayEnd.setHours(23, 59, 59, 999); + return [beforeYesterday, beforeYesterdayEnd]; + } + }, + { + text: "本周", + value: () => { + const today = new Date(); + const startOfWeek = new Date( + today.getFullYear(), + today.getMonth(), + today.getDate() - today.getDay() + (today.getDay() === 0 ? -6 : 1) + ); + startOfWeek.setHours(0, 0, 0, 0); + const endOfWeek = new Date( + startOfWeek.getTime() + + 6 * 24 * 60 * 60 * 1000 + + 23 * 60 * 60 * 1000 + + 59 * 60 * 1000 + + 59 * 1000 + + 999 + ); + return [startOfWeek, endOfWeek]; + } + }, + { + text: "上周", + value: () => { + const today = new Date(); + const startOfLastWeek = new Date( + today.getFullYear(), + today.getMonth(), + today.getDate() - today.getDay() - 7 + (today.getDay() === 0 ? -6 : 1) + ); + startOfLastWeek.setHours(0, 0, 0, 0); + const endOfLastWeek = new Date( + startOfLastWeek.getTime() + + 6 * 24 * 60 * 60 * 1000 + + 23 * 60 * 60 * 1000 + + 59 * 60 * 1000 + + 59 * 1000 + + 999 + ); + return [startOfLastWeek, endOfLastWeek]; + } + }, + { + text: "本月", + value: () => { + const today = new Date(); + const startOfMonth = new Date(today.getFullYear(), today.getMonth(), 1); + startOfMonth.setHours(0, 0, 0, 0); + const endOfMonth = new Date( + today.getFullYear(), + today.getMonth() + 1, + 0 + ); + endOfMonth.setHours(23, 59, 59, 999); + return [startOfMonth, endOfMonth]; + } + }, + { + text: "上个月", + value: () => { + const today = new Date(); + const startOfLastMonth = new Date( + today.getFullYear(), + today.getMonth() - 1, + 1 + ); + startOfLastMonth.setHours(0, 0, 0, 0); + const endOfLastMonth = new Date( + today.getFullYear(), + today.getMonth(), + 0 + ); + endOfLastMonth.setHours(23, 59, 59, 999); + return [startOfLastMonth, endOfLastMonth]; + } + }, + { + text: "本年", + value: () => { + const today = new Date(); + const startOfYear = new Date(today.getFullYear(), 0, 1); + startOfYear.setHours(0, 0, 0, 0); + const endOfYear = new Date(today.getFullYear(), 11, 31); + endOfYear.setHours(23, 59, 59, 999); + return [startOfYear, endOfYear]; + } + } + ]; +}; diff --git a/types/monitor.d.ts b/types/monitor.d.ts new file mode 100644 index 0000000..4d36c10 --- /dev/null +++ b/types/monitor.d.ts @@ -0,0 +1,460 @@ +/** 操作日志类型 */ +export type OperationLogInfo = { + /** 操作ID */ + id: string; + /** 操作名称 */ + operation_name: string; + /** 操作类型 */ + operation_type: number; + /** 请求路径 */ + request_path: string; + /** 请求方法 */ + request_method: string; + /** 请求参数 */ + request_params: string; + /** 响应结果 */ + response_result: string; + /** 主机 */ + host: string; + /** 位置 */ + location: string; + /** 浏览器 */ + browser: string; + /** 操作系统 */ + os: string; + /** 用户代理 */ + user_agent: string; + /** 操作员ID */ + operator_id: string; + /** 操作员名称 */ + operator_name: string; + /** 操作员昵称 */ + operator_nickname: string; + /** 部门ID */ + department_id: string; + /** 部门名称 */ + department_name: string; + /** 操作状态 */ + status: number; + /** 操作时间 */ + operation_time: string; + /** 操作消耗时间 */ + cost_time: number; +}; + +/** 用户登录信息类型 */ +export type UserLoginLogInfo = { + /** 登录记录ID */ + id: string; + /** 用户ID */ + user_id: string; + /** 用户名 */ + username: string; + /** 用户昵称 */ + user_nickname: string; + /** 部门ID */ + department_id: string; + /** 部门名称 */ + department_name: string; + /** 登录IP地址 */ + login_ip: string; + /** 登录位置 */ + login_location: string; + /** 浏览器 */ + browser: string; + /** 操作系统 */ + os: string; + /** 状态 */ + status: number; + /** 登录时间 */ + login_time: string; + /** 会话ID */ + session_id: string; + /**在线状态 */ + online: boolean; + /** 创建时间 */ + create_time: string; + /** 修改时间 */ + update_time: string; +}; + +/** CPU 信息类型 */ +export type CpuInfo = { + /** CPU 核心数 */ + cpuNum: number; + /** CPU 使用率 */ + used: number; + /** 系统使用率 */ + sys: number; + /** CPU 空闲率 */ + free: number; +}; + +/** Python 进程信息类型 */ +export type PythonInfo = { + /** 总内存 */ + total: string; + /** 已用内存 */ + used: string; + /** 空闲内存 */ + free: string; + /** 内存使用率 */ + usage: number; + /** 进程名称 */ + name: string; + /** Python 版本 */ + version: string; + /** 启动时间 */ + startTime: string; + /** 运行时间 */ + runTime: string; + /** Python 可执行文件路径 */ + home: string; +}; + +/** 内存信息类型 */ +export type MemoryInfo = { + /** 总内存 */ + total: string; + /** 已用内存 */ + used: string; + /** 空闲内存 */ + free: string; + /** 内存使用率 */ + usage: number; +}; + +/** 系统信息类型 */ +export type SystemInfo = { + /** 计算机 IP 地址 */ + computerIp: string; + /** 计算机名称 */ + computerName: string; + /** 操作系统架构 */ + osArch: string; + /** 操作系统名称 */ + osName: string; + /** 用户目录 */ + userDir: string; +}; + +/** 系统文件信息类型 */ +export type SystemFileInfo = { + /** 目录名称 */ + dirName: string; + /** 文件系统类型 */ + sysTypeName: string; + /** 磁盘类型名称 */ + typeName: string; + /** 总空间 */ + total: string; + /** 已用空间 */ + used: string; + /** 空闲空间 */ + free: string; + /** 空间使用率 */ + usage: string; +}; + +/** 系统监控信息类型 */ +export type SystemMonitorInfo = { + /** CPU 信息 */ + cpu: CpuInfo; + /** Python 进程信息 */ + python: PythonInfo; + /** 内存信息 */ + memory: MemoryInfo; + /** 系统信息 */ + system: SystemInfo; + /** 系统文件信息列表 */ + systemFiles: SystemFileInfo[]; +}; + +/** 命令统计信息类型 */ +export type CommandStat = { + /** 命令名称 */ + name: string; + /** 命令调用次数 */ + value: string; +}; + +/** Redis 数据库信息类型 */ +export type RedisDbInfo = { + /** 键数量 */ + keys: number; + /** 过期键数量 */ + expires: number; + /** 平均 TTL(生存时间) */ + avg_ttl: number; +}; + +/** Redis 信息类型 */ +export type RedisInfo = { + /** Redis 版本 */ + redis_version: string; + /** Git SHA1 */ + redis_git_sha1: string; + /** Git 脏标记 */ + redis_git_dirty: number; + /** 构建 ID */ + redis_build_id: string; + /** 运行模式 */ + redis_mode: string; + /** 操作系统 */ + os: string; + /** 架构位数 */ + arch_bits: number; + /** 多路复用 API */ + multiplexing_api: string; + /** 原子变量 API */ + atomicvar_api: string; + /** 进程 ID */ + process_id: number; + /** 运行 ID */ + run_id: string; + /** TCP 端口 */ + tcp_port: number; + /** 运行时间(秒) */ + uptime_in_seconds: number; + /** 运行时间(天) */ + uptime_in_days: number; + /** 频率 */ + hz: number; + /** 配置频率 */ + configured_hz: number; + /** LRU 时钟 */ + lru_clock: number; + /** 可执行文件路径 */ + executable: string; + /** 配置文件路径 */ + config_file: string; + /** 已连接客户端数量 */ + connected_clients: number; + /** 客户端最大输入缓冲区 */ + client_recent_max_input_buffer: number; + /** 客户端最大输出缓冲区 */ + client_recent_max_output_buffer: number; + /** 阻塞客户端数量 */ + blocked_clients: number; + /** 已用内存 */ + used_memory: number; + /** 已用内存(人类可读格式) */ + used_memory_human: string; + /** 已用内存 RSS */ + used_memory_rss: number; + /** 已用内存 RSS(人类可读格式) */ + used_memory_rss_human: string; + /** 内存使用峰值 */ + used_memory_peak: number; + /** 内存使用峰值(人类可读格式) */ + used_memory_peak_human: string; + /** 内存使用峰值百分比 */ + used_memory_peak_perc: string; + /** 内存开销 */ + used_memory_overhead: number; + /** 启动时内存使用 */ + used_memory_startup: number; + /** 数据集内存使用 */ + used_memory_dataset: number; + /** 数据集内存使用百分比 */ + used_memory_dataset_perc: string; + /** 分配器已分配内存 */ + allocator_allocated: number; + /** 分配器活跃内存 */ + allocator_active: number; + /** 分配器常驻内存 */ + allocator_resident: number; + /** 系统总内存 */ + total_system_memory: number; + /** 系统总内存(人类可读格式) */ + total_system_memory_human: string; + /** Lua 引擎内存使用 */ + used_memory_lua: number; + /** Lua 引擎内存使用(人类可读格式) */ + used_memory_lua_human: string; + /** 脚本内存使用 */ + used_memory_scripts: number; + /** 脚本内存使用(人类可读格式) */ + used_memory_scripts_human: string; + /** 缓存脚本数量 */ + number_of_cached_scripts: number; + /** 最大内存限制 */ + maxmemory: number; + /** 最大内存限制(人类可读格式) */ + maxmemory_human: string; + /** 内存淘汰策略 */ + maxmemory_policy: string; + /** 分配器碎片比率 */ + allocator_frag_ratio: number; + /** 分配器碎片字节数 */ + allocator_frag_bytes: number; + /** 分配器 RSS 比率 */ + allocator_rss_ratio: number; + /** 分配器 RSS 字节数 */ + allocator_rss_bytes: number; + /** RSS 开销比率 */ + rss_overhead_ratio: number; + /** RSS 开销字节数 */ + rss_overhead_bytes: number; + /** 内存碎片比率 */ + mem_fragmentation_ratio: number; + /** 内存碎片字节数 */ + mem_fragmentation_bytes: number; + /** 未计入淘汰的内存 */ + mem_not_counted_for_evict: number; + /** 复制积压内存 */ + mem_replication_backlog: number; + /** 从节点客户端内存 */ + mem_clients_slaves: number; + /** 普通客户端内存 */ + mem_clients_normal: number; + /** AOF 缓冲区内存 */ + mem_aof_buffer: number; + /** 内存分配器 */ + mem_allocator: string; + /** 活跃碎片整理是否运行 */ + active_defrag_running: number; + /** 延迟释放对象数量 */ + lazyfree_pending_objects: number; + /** 是否正在加载 */ + loading: number; + /** 上次保存后的更改次数 */ + rdb_changes_since_last_save: number; + /** 是否正在进行 RDB 保存 */ + rdb_bgsave_in_progress: number; + /** 上次 RDB 保存时间 */ + rdb_last_save_time: number; + /** 上次 RDB 保存状态 */ + rdb_last_bgsave_status: string; + /** 上次 RDB 保存耗时(秒) */ + rdb_last_bgsave_time_sec: number; + /** 当前 RDB 保存耗时(秒) */ + rdb_current_bgsave_time_sec: number; + /** 上次 RDB 保存的写时复制大小 */ + rdb_last_cow_size: number; + /** AOF 是否启用 */ + aof_enabled: number; + /** 是否正在进行 AOF 重写 */ + aof_rewrite_in_progress: number; + /** 是否计划进行 AOF 重写 */ + aof_rewrite_scheduled: number; + /** 上次 AOF 重写耗时(秒) */ + aof_last_rewrite_time_sec: number; + /** 当前 AOF 重写耗时(秒) */ + aof_current_rewrite_time_sec: number; + /** 上次 AOF 重写状态 */ + aof_last_bgrewrite_status: string; + /** 上次 AOF 写入状态 */ + aof_last_write_status: string; + /** 上次 AOF 写时复制大小 */ + aof_last_cow_size: number; + /** 总连接数 */ + total_connections_received: number; + /** 总命令处理数 */ + total_commands_processed: number; + /** 每秒操作数 */ + instantaneous_ops_per_sec: number; + /** 总网络输入字节数 */ + total_net_input_bytes: number; + /** 总网络输出字节数 */ + total_net_output_bytes: number; + /** 瞬时输入带宽(KB/s) */ + instantaneous_input_kbps: number; + /** 瞬时输出带宽(KB/s) */ + instantaneous_output_kbps: number; + /** 拒绝连接数 */ + rejected_connections: number; + /** 完全同步次数 */ + sync_full: number; + /** 部分同步成功次数 */ + sync_partial_ok: number; + /** 部分同步失败次数 */ + sync_partial_err: number; + /** 过期键数量 */ + expired_keys: number; + /** 过期键百分比 */ + expired_stale_perc: number; + /** 达到时间上限的过期键数量 */ + expired_time_cap_reached_count: number; + /** 淘汰键数量 */ + evicted_keys: number; + /** 键空间命中数 */ + keyspace_hits: number; + /** 键空间未命中数 */ + keyspace_misses: number; + /** 发布订阅频道数 */ + pubsub_channels: number; + /** 发布订阅模式数 */ + pubsub_patterns: number; + /** 上次 fork 耗时(微秒) */ + latest_fork_usec: number; + /** 迁移缓存套接字数 */ + migrate_cached_sockets: number; + /** 从节点跟踪的过期键数量 */ + slave_expires_tracked_keys: number; + /** 活跃碎片整理命中数 */ + active_defrag_hits: number; + /** 活跃碎片整理未命中数 */ + active_defrag_misses: number; + /** 活跃碎片整理键命中数 */ + active_defrag_key_hits: number; + /** 活跃碎片整理键未命中数 */ + active_defrag_key_misses: number; + /** 角色(主/从) */ + role: string; + /** 已连接从节点数量 */ + connected_slaves: number; + /** 主节点复制 ID */ + master_replid: string; + /** 主节点复制 ID2 */ + master_replid2: string; + /** 主节点复制偏移量 */ + master_repl_offset: number; + /** 第二复制偏移量 */ + second_repl_offset: number; + /** 复制积压是否激活 */ + repl_backlog_active: number; + /** 复制积压大小 */ + repl_backlog_size: number; + /** 复制积压第一个字节偏移量 */ + repl_backlog_first_byte_offset: number; + /** 复制积压历史长度 */ + repl_backlog_histlen: number; + /** 系统 CPU 使用时间 */ + used_cpu_sys: number; + /** 用户 CPU 使用时间 */ + used_cpu_user: number; + /** 子进程系统 CPU 使用时间 */ + used_cpu_sys_children: number; + /** 子进程用户 CPU 使用时间 */ + used_cpu_user_children: number; + /** 是否启用集群 */ + cluster_enabled: number; + /** 数据库信息 */ + db2: RedisDbInfo; +}; + +/** Redis 监控信息类型 */ +export type RedisMonitorInfo = { + /** 命令统计信息 */ + commandStats: CommandStat[]; + /** 数据库大小 */ + dbSize: number; + /** Redis 详细信息 */ + info: RedisInfo; +}; + +/** 缓存项信息类型 */ +export type CacheItem = { + /** 缓存键 */ + cacheKey: string; + /** 缓存名称 */ + cacheName: string; + /** 缓存值 */ + cacheValue: string; + /** 备注 */ + remark: string; +}; + +/** 缓存列表类型 */ +export type CacheList = CacheItem[];