# 系统监控模块

系统监控（企业级：JVM / 服务器 / MySQL / Redis / 请求统计 / 运行历史） 全部使用 JDK 标准 API，跨 Windows/Linux；每个指标独立 try/catch，单点失败不影响整体。

**类路径**：`SystemMonitorController`
**前缀**：`/systemMonitor`

## 1. jvm

**接口路径**：`GET/POST /systemMonitor/jvm`

**权限**：需要超级管理员权限

**接口说明**：JVM 运行情况

**请求参数**：

无请求参数

**响应说明**：
```json
{
  "code": 1,
  "msg": "",
  "data": ...
}
```

---

## 2. server

**接口路径**：`GET/POST /systemMonitor/server`

**权限**：需要超级管理员权限

**接口说明**：服务器资源（系统CPU/物理内存/交换分区/磁盘，跨平台）

**请求参数**：

无请求参数

**响应说明**：
```json
{
  "code": 1,
  "msg": "",
  "data": ...
}
```

---

## 3. mysql

**接口路径**：`GET/POST /systemMonitor/mysql`

**权限**：需要超级管理员权限

**接口说明**：MySQL 运行状态

**请求参数**：

无请求参数

**响应说明**：
```json
{
  "code": 1,
  "msg": "",
  "data": ...
}
```

---

## 4. redis

**接口路径**：`GET/POST /systemMonitor/redis`

**权限**：需要超级管理员权限

**接口说明**：Redis 运行状态

**请求参数**：

无请求参数

**响应说明**：
```json
{
  "code": 1,
  "msg": "",
  "data": ...
}
```

---

## 5. requestStats

**接口路径**：`GET/POST /systemMonitor/requestStats`

**权限**：需要超级管理员权限

**接口说明**：接口请求统计（QPS/平均耗时/错误率/Top慢接口）

**请求参数**：

| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|--------|------|------|--------|------|
| top | Integer | 否 | 20 |  |

**响应说明**：
```json
{
  "code": 1,
  "msg": "",
  "data": ...
}
```

---

## 6. history

**接口路径**：`GET/POST /systemMonitor/history`

**权限**：需要超级管理员权限

**接口说明**：系统运行历史趋势（复用 statistics 表 sys_* 键；表不存在时优雅降级返回空）

**请求参数**：

| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|--------|------|------|--------|------|
| days | Integer | 否 | 30 |  |

**响应说明**：
```json
{
  "code": 1,
  "msg": "",
  "data": ...
}
```

---
