"use client" import { useState, useEffect } from "react" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" import { Button } from "@/components/ui/button" import { Badge } from "@/components/ui/badge" import { Progress } from "@/components/ui/progress" import { ArrowLeft, Server, CheckCircle2, AlertTriangle, RefreshCw, Clock } from "lucide-react" import Link from "next/link" import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer } from "recharts" const performanceData = [ { time: "5m", p50: 32, p95: 85, p99: 120 }, { time: "10m", p50: 35, p95: 88, p99: 125 }, { time: "15m", p50: 30, p95: 82, p99: 115 }, { time: "20m", p50: 38, p95: 92, p99: 135 }, { time: "25m", p50: 33, p95: 86, p99: 122 }, { time: "30m", p50: 31, p95: 84, p99: 118 }, ] const healthChecks = [ { name: "数据库连接池", status: "healthy", value: "48/50", description: "活跃连接数" }, { name: "Redis缓存", status: "healthy", value: "99.9%", description: "命中率" }, { name: "消息队列", status: "healthy", value: "0", description: "积压消息" }, { name: "定时任务", status: "healthy", value: "12/12", description: "运行中任务" }, { name: "外部API", status: "degraded", value: "95.2%", description: "成功率" }, { name: "文件存储", status: "healthy", value: "1.6TB", description: "已使用" }, ] const nodeStatus = [ { id: 1, name: "node-01", role: "Master", cpu: 62, memory: 68, status: "healthy" }, { id: 2, name: "node-02", role: "Worker", cpu: 55, memory: 72, status: "healthy" }, { id: 3, name: "node-03", role: "Worker", cpu: 48, memory: 65, status: "healthy" }, { id: 4, name: "node-04", role: "Worker", cpu: 71, memory: 78, status: "degraded" }, ] export default function HealthPage() { const [overallHealth, setOverallHealth] = useState(98.5) useEffect(() => { const interval = setInterval(() => { setOverallHealth((prev) => Math.min(100, Math.max(95, prev + (Math.random() - 0.5) * 1))) }, 5000) return () => clearInterval(interval) }, []) return (
服务状态、性能指标与集群监控
系统整体健康度
{overallHealth.toFixed(1)}%
所有核心服务运行正常
{check.name}
{check.value}
{check.description}
| 节点 | 角色 | CPU | 内存 | 状态 |
|---|---|---|---|---|
|
|
|
{node.cpu}%
|
{node.memory}%
|
{node.status === "healthy" ? (
|