{
  "uid": "gpu-vllm",
  "title": "GPU 与 vLLM",
  "timezone": "browser",
  "schemaVersion": 39,
  "refresh": "15s",
  "time": { "from": "now-1h", "to": "now" },
  "panels": [
    {
      "id": 1,
      "type": "stat",
      "title": "GPU 利用率",
      "gridPos": { "h": 4, "w": 6, "x": 0, "y": 0 },
      "datasource": { "type": "prometheus", "uid": "prometheus" },
      "fieldConfig": { "defaults": { "unit": "percent", "min": 0, "max": 100 } },
      "targets": [{ "expr": "DCGM_FI_DEV_GPU_UTIL", "refId": "A" }]
    },
    {
      "id": 2,
      "type": "stat",
      "title": "显存已用",
      "gridPos": { "h": 4, "w": 6, "x": 6, "y": 0 },
      "datasource": { "type": "prometheus", "uid": "prometheus" },
      "fieldConfig": { "defaults": { "unit": "decmbytes" } },
      "targets": [{ "expr": "DCGM_FI_DEV_FB_USED", "refId": "A" }]
    },
    {
      "id": 3,
      "type": "stat",
      "title": "显存空闲",
      "gridPos": { "h": 4, "w": 6, "x": 12, "y": 0 },
      "datasource": { "type": "prometheus", "uid": "prometheus" },
      "fieldConfig": { "defaults": { "unit": "decmbytes" } },
      "targets": [{ "expr": "DCGM_FI_DEV_FB_FREE", "refId": "A" }]
    },
    {
      "id": 4,
      "type": "stat",
      "title": "GPU 温度",
      "gridPos": { "h": 4, "w": 6, "x": 18, "y": 0 },
      "datasource": { "type": "prometheus", "uid": "prometheus" },
      "fieldConfig": { "defaults": { "unit": "celsius" } },
      "targets": [{ "expr": "DCGM_FI_DEV_GPU_TEMP", "refId": "A" }]
    },
    {
      "id": 5,
      "type": "timeseries",
      "title": "GPU 利用率",
      "gridPos": { "h": 8, "w": 12, "x": 0, "y": 4 },
      "datasource": { "type": "prometheus", "uid": "prometheus" },
      "fieldConfig": { "defaults": { "unit": "percent", "min": 0, "max": 100 } },
      "targets": [{ "expr": "DCGM_FI_DEV_GPU_UTIL", "legendFormat": "GPU {{gpu}}", "refId": "A" }]
    },
    {
      "id": 6,
      "type": "timeseries",
      "title": "显存占用",
      "gridPos": { "h": 8, "w": 12, "x": 12, "y": 4 },
      "datasource": { "type": "prometheus", "uid": "prometheus" },
      "fieldConfig": { "defaults": { "unit": "decmbytes" } },
      "targets": [
        { "expr": "DCGM_FI_DEV_FB_USED", "legendFormat": "已用 {{gpu}}", "refId": "A" },
        { "expr": "DCGM_FI_DEV_FB_FREE", "legendFormat": "空闲 {{gpu}}", "refId": "B" }
      ]
    },
    {
      "id": 7,
      "type": "timeseries",
      "title": "温度与显存带宽利用率",
      "gridPos": { "h": 8, "w": 12, "x": 0, "y": 12 },
      "datasource": { "type": "prometheus", "uid": "prometheus" },
      "fieldConfig": { "defaults": { "unit": "short" } },
      "targets": [
        { "expr": "DCGM_FI_DEV_GPU_TEMP", "legendFormat": "温度 {{gpu}}", "refId": "A" },
        { "expr": "DCGM_FI_DEV_MEM_COPY_UTIL", "legendFormat": "显存带宽 {{gpu}}", "refId": "B" }
      ]
    },
    {
      "id": 8,
      "type": "timeseries",
      "title": "vLLM 请求与 KV 占用",
      "gridPos": { "h": 8, "w": 12, "x": 12, "y": 12 },
      "datasource": { "type": "prometheus", "uid": "prometheus" },
      "fieldConfig": { "defaults": { "unit": "short" } },
      "targets": [
        { "expr": "vllm:num_requests_running", "legendFormat": "运行中", "refId": "A" },
        { "expr": "vllm:num_requests_waiting", "legendFormat": "排队", "refId": "B" },
        { "expr": "vllm:kv_cache_usage_perc", "legendFormat": "KV 占用", "refId": "C" }
      ]
    }
  ]
}
