## 🖥️ 基础环境
| 组件 | 规格/版本 |
| ------------- | ------------------------------------------ |
| **操作系统** | UOS V25 服务器操作系统 |
| **服务器型号** | 浪潮 AI 服务器 (NF5468m6) |
| **AI 加速卡** | 海光 K100_AI |
| **驱动版本** | `rock-6.3.13-V1.12.0.run` |
| **SDK 版本** | `DTK-25.04.1-openEuler22.03-x86_64.tar.gz` |
| **Docker 版本** | `v24.0.9` |
## 📦 驱动和 SDK 安装
#### 1. ROCm 驱动安装
```bash
# 修改驱动安装文件权限
chmod +x rock-6.3.13-V1.12.0.run
# 执行驱动安装
./rock-6.3.13-V1.12.0.run
# 安装完成后重启主机
reboot
```
#### 2. DTK 安装
```bash
# 解压缩到 /opt 目录
tar -zxf /opt/dcu/DTK-25.04.1-openEuler22.03-x86_64.tar.gz -C /opt
mv dtk-25.04.1 dtk
# 配置环境变量
cat >> /etc/profile << 'EOF'
export LIBRARY_PATH=/opt/dtk/lib:$LIBRARY_PATH
source /opt/dtk/env.sh
source /opt/hyhal/env.sh
EOF
cat >> ~/.bashrc << 'EOF'
export LIBRARY_PATH=/opt/dtk/lib:$LIBRARY_PATH
source /opt/dtk/env.sh
source /opt/hyhal/env.sh
EOF
source /etc/profile
source ~/.bashrc
# 验证 K100 卡信息
rocm-smi
```
成功查看 K100 卡信息的输出示例:

## dcu-exporter 安装部署
### 1. 安装 dcu-exporter
```bash
# 修改二进制文件权限
chmod +x dcu-exporter-v2.3.1.run
# 执行安装
./dcu-exporter-v2.3.1.run
```
安装成功后,会在 `/opt` 目录下生成 `dcu-exporter` 目录。进入安装目录并启动服务(默认端口 16080):
```bash
cd /opt/dcu-exporter
./dcu-exporter
```
### 2. 验证 dcu-exporter 数据抓取
在浏览器访问以下地址,或使用 `curl` 命令获取指标数据:
```
http://<主机IP>:<主机端口>/metrics
```
示例:`http://10.10.13.109:16080/metrics`
## Prometheus 配置与容器化部署
### 1. 编写配置文件
#### vLLM 监控配置(prometheus.yml)
```yaml
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_timeout: 10s
scrape_configs:
- job_name: 'vllm-monitoring'
static_configs:
- targets:
- '10.10.13.109:8000' # vLLM 服务地址和端口
- job_name: 'gpu-monitoring'
static_configs:
- targets:
- '10.10.13.109:16080' # dcu-exporter 默认监听端口
```
#### SGLang 监控配置(prometheus.yml)
```yaml
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_timeout: 10s
scrape_configs:
- job_name: 'sglang-monitoring'
static_configs:
- targets:
- '10.10.75.30:30000' # SGLang 服务地址和端口
- job_name: 'gpu-monitoring'
static_configs:
- targets:
- '10.10.13.109:16080' # dcu-exporter 默认监听端口
```
### 2. 部署 Prometheus(容器化)
创建必要的目录和配置文件:
```bash
mkdir -p /data/prometheus/data
touch /data/prometheus/prometheus.yml
chmod -R 777 /data/prometheus
```
启动 Prometheus 容器:
```bash
docker run -d \
--name prometheus \
-p 9090:9090 \
-v /data/prometheus/data:/prometheus \
-v /data/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml \
registry.uniontech.com/uos-ai/uos-server-20-prometheus:2.32.1
```
服务启动后,访问地址为 `http://<服务器IP>:9090`,可在 **Status > Targets** 中查看指标采集状态。
## Grafana 配置与仪表盘导入
### 容器化部署 Grafana
使用以下命令快速启动 Grafana 服务(默认端口 3000,首次登录账号密码为 `admin/admin`):
```bash
docker run -d \
--name grafana \
-p 3000:3000 \
registry.uniontech.com/uos-ai/grafana:v13.0.1
```
### 创建数据源
1. 登录 Grafana,进入 **Connections > Data Sources**;
2. 选择 **Prometheus**,输入 Prometheus 访问地址 `http://<服务器IP>:9090`;
3. 点击 **Save & Test** 保存配置并验证连接是否可用。
### 导入仪表盘
1. 登录 Grafana,点击左侧 **Dashboards > Import**;
2. 上传仪表盘 JSON 文件(如 `dcu-exporter-dashboard.json`,DCU 专用仪表盘文件由海光提供);
3. 选择已创建的 Prometheus 数据源,点击 **Import** 完成导入。
对于 vLLM 相关监控,可使用 `vllm-dashboard.json` 文件导入;对于 SGLang 相关监控,可使用 `sglang-dashboard.json` 文件导入。导入步骤与上述流程相同。
### 附件:
[dcu-exporter-dashboard.json](https://docs.qq.com/document/DWEZhYW5XZGpDRG1a)
[sglang-dashboard.json](https://docs.qq.com/document/DWG9Wd2hIWVRxTUdJ)
[vllm-dashboard.json](https://docs.qq.com/document/DWExFcGhIcmNERUVD)