Files
monitor/backend/static_backup/static/index.html
2025-12-02 23:20:10 +08:00

484 lines
29 KiB
HTML

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>监控系统仪表盘</title>
<!-- Tailwind CSS -->
<script src="https://cdn.tailwindcss.com"></script>
<!-- Chart.js -->
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<!-- Font Awesome -->
<link href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css" rel="stylesheet">
<!-- 自定义样式 -->
<style>
body {
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.chart-container {
position: relative;
height: 300px;
width: 100%;
}
.status-card {
transition: all 0.3s ease;
}
.status-card:hover {
transform: translateY(-2px);
box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}
.metric-value {
font-feature-settings: "tnum";
font-variant-numeric: tabular-nums;
}
</style>
</head>
<body class="bg-gray-50">
<!-- 顶部导航栏 -->
<header class="bg-white shadow-lg border-b border-gray-200">
<div class="container mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex items-center justify-between h-16">
<div class="flex items-center">
<h1 class="text-2xl font-bold text-gray-900">监控系统</h1>
</div>
<!-- 导航菜单 -->
<nav class="flex items-center space-x-4">
<a href="#home" class="px-4 py-2 text-sm font-medium text-white bg-blue-600 rounded-lg hover:bg-blue-700 transition-all duration-200 shadow-sm hover:shadow-md">首页</a>
<a href="#servers" class="px-4 py-2 text-sm font-medium text-gray-700 bg-gray-100 rounded-lg hover:bg-gray-200 transition-all duration-200 shadow-sm hover:shadow-md">所有服务器</a>
<a href="#devices" class="px-4 py-2 text-sm font-medium text-gray-700 bg-gray-100 rounded-lg hover:bg-gray-200 transition-all duration-200 shadow-sm hover:shadow-md">设备管理</a>
</nav>
</div>
</div>
</header>
<!-- 主要内容区域 -->
<main class="container mx-auto px-4 py-6">
<!-- 首页内容 -->
<div id="homeContent">
<!-- 监控资源概览 -->
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-6">
<!-- 业务系统 -->
<div class="status-card bg-white rounded-xl shadow-lg p-6 transition-all duration-300 hover:shadow-xl hover:-translate-y-1">
<div class="flex justify-between items-start">
<div>
<p class="text-gray-500 text-sm font-medium">业务系统</p>
<h3 class="text-3xl font-bold text-gray-900 metric-value">355</h3>
</div>
<div class="p-3 bg-blue-100 rounded-full">
<i class="fa fa-building-o text-blue-600 text-xl"></i>
</div>
</div>
</div>
<!-- 数据库 -->
<div class="status-card bg-white rounded-xl shadow-lg p-6 transition-all duration-300 hover:shadow-xl hover:-translate-y-1">
<div class="flex justify-between items-start">
<div>
<p class="text-gray-500 text-sm font-medium">数据库</p>
<h3 class="text-3xl font-bold text-gray-900 metric-value">59</h3>
</div>
<div class="p-3 bg-yellow-100 rounded-full">
<i class="fa fa-database text-yellow-600 text-xl"></i>
</div>
</div>
</div>
<!-- 服务器 -->
<div id="serverCard" class="status-card bg-white rounded-xl shadow-lg p-6 cursor-pointer transition-all duration-300 hover:shadow-xl hover:-translate-y-1" onclick="window.location.hash='#servers'">
<div class="flex justify-between items-start">
<div>
<p class="text-gray-500 text-sm font-medium">服务器</p>
<h3 id="serverCount" class="text-3xl font-bold text-gray-900 metric-value">2</h3>
<div class="flex items-center gap-4 mt-2">
<div class="flex items-center">
<span class="text-red-600 font-bold text-lg">12</span>
<span class="text-gray-500 text-xs ml-1">警告</span>
</div>
<div class="flex items-center">
<span class="text-yellow-600 font-bold text-lg">8</span>
<span class="text-gray-500 text-xs ml-1">提醒</span>
</div>
<div class="flex items-center">
<span class="text-green-600 font-bold text-lg">25</span>
<span class="text-gray-500 text-xs ml-1">正常</span>
</div>
</div>
</div>
<div class="p-3 bg-green-100 rounded-full">
<i class="fa fa-server text-green-600 text-xl"></i>
</div>
</div>
</div>
</div>
<!-- 告警统计和趋势图 -->
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6 mb-6">
<!-- 告警统计 -->
<div class="grid grid-cols-1 sm:grid-cols-2 gap-6">
<!-- 当前告警 -->
<div class="status-card bg-white rounded-xl shadow-lg p-6 transition-all duration-300 hover:shadow-xl hover:-translate-y-1">
<div class="flex justify-between items-start">
<div>
<p class="text-gray-500 text-sm font-medium">当前告警</p>
<h3 class="text-3xl font-bold text-red-600 metric-value">112</h3>
</div>
<div class="p-3 bg-red-100 rounded-full">
<i class="fa fa-exclamation-circle text-red-600 text-xl"></i>
</div>
</div>
</div>
<!-- 当前提醒 -->
<div class="status-card bg-white rounded-xl shadow-lg p-6 transition-all duration-300 hover:shadow-xl hover:-translate-y-1">
<div class="flex justify-between items-start">
<div>
<p class="text-gray-500 text-sm font-medium">当前提醒</p>
<h3 class="text-3xl font-bold text-yellow-600 metric-value">38</h3>
</div>
<div class="p-3 bg-yellow-100 rounded-full">
<i class="fa fa-warning text-yellow-600 text-xl"></i>
</div>
</div>
</div>
<!-- 超时未跟进 -->
<div class="status-card bg-white rounded-xl shadow-lg p-6 transition-all duration-300 hover:shadow-xl hover:-translate-y-1">
<div class="flex justify-between items-start">
<div>
<p class="text-gray-500 text-sm font-medium">超时未跟进</p>
<h3 class="text-3xl font-bold text-orange-600 metric-value">100</h3>
</div>
<div class="p-3 bg-orange-100 rounded-full">
<i class="fa fa-clock-o text-orange-600 text-xl"></i>
</div>
</div>
</div>
<!-- 超时未处置 -->
<div class="status-card bg-white rounded-xl shadow-lg p-6 transition-all duration-300 hover:shadow-xl hover:-translate-y-1">
<div class="flex justify-between items-start">
<div>
<p class="text-gray-500 text-sm font-medium">超时未处置</p>
<h3 class="text-3xl font-bold text-pink-600 metric-value">144</h3>
</div>
<div class="p-3 bg-pink-100 rounded-full">
<i class="fa fa-times-circle text-pink-600 text-xl"></i>
</div>
</div>
</div>
</div>
<!-- 近一周告警/跟进走势 -->
<div class="status-card bg-white rounded-xl shadow-lg p-6 lg:col-span-2 transition-all duration-300 hover:shadow-xl">
<div class="flex justify-between items-center mb-4">
<h2 class="text-lg font-semibold text-gray-900">近一周告警/跟进走势</h2>
<div class="flex items-center gap-4">
<span class="text-xs text-red-600 flex items-center gap-1">
<div class="w-2 h-2 bg-red-600 rounded-full"></div>
报警
</span>
<span class="text-xs text-orange-600 flex items-center gap-1">
<div class="w-2 h-2 bg-orange-600 rounded-full"></div>
提醒
</span>
<span class="text-xs text-yellow-600 flex items-center gap-1">
<div class="w-2 h-2 bg-yellow-600 rounded-full"></div>
登记
</span>
</div>
</div>
<div class="chart-container h-80">
<canvas id="alarmTrendChart"></canvas>
</div>
</div>
</div>
<!-- 业务视图和告警列表 -->
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
<!-- 业务视图 -->
<div class="status-card bg-white rounded-xl shadow-lg p-6 lg:col-span-2 transition-all duration-300 hover:shadow-xl">
<div class="flex flex-wrap items-center justify-between mb-6 gap-4">
<h2 class="text-lg font-semibold text-gray-900">业务视图</h2>
<div class="flex flex-wrap items-center gap-3">
<select class="text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg shadow-sm px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-all duration-200">
<option>全部分组</option>
</select>
<select class="text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg shadow-sm px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-all duration-200">
<option>全部级别</option>
</select>
<select class="text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg shadow-sm px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-all duration-200">
<option>全部标识</option>
</select>
<div class="relative">
<input type="text" placeholder="输入关键字查询" class="text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg shadow-sm pl-10 pr-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-all duration-200">
<i class="fa fa-search text-gray-400 absolute left-3 top-1/2 transform -translate-y-1/2"></i>
</div>
</div>
</div>
<div class="overflow-x-auto rounded-lg border border-gray-200">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">业务名称</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">IP地址</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">操作系统</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">重要标识</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">状态</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">CPU告警</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200" id="businessViewTableBody">
<!-- 业务视图数据将通过JavaScript动态添加 -->
</tbody>
</table>
</div>
</div>
<!-- 告警列表 -->
<div class="status-card bg-white rounded-xl shadow-lg p-6 transition-all duration-300 hover:shadow-xl">
<div class="flex justify-between items-center mb-4">
<h2 class="text-lg font-semibold text-gray-900">告警列表</h2>
<div class="flex items-center gap-3">
<span class="text-xs font-medium text-red-600">112</span>
<span class="text-xs font-medium text-orange-600">38</span>
</div>
</div>
<div class="space-y-4" id="alarmList">
<!-- 告警列表数据将通过JavaScript动态添加 -->
</div>
</div>
</div>
</div>
<!-- 所有服务器列表 -->
<div id="serversContent" class="hidden">
<div class="bg-white rounded-xl shadow-lg p-6 mb-6">
<h2 class="text-xl font-bold text-gray-900 mb-6">所有服务器</h2>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6" id="serversGrid">
<!-- 服务器卡片将通过JavaScript动态添加 -->
</div>
</div>
</div>
<!-- 服务器监控界面 -->
<div id="serverMonitorContent" class="hidden">
<!-- 导航栏下方的操作栏 -->
<div id="dashboardActions" class="bg-white shadow-sm border-b border-gray-200 mb-6">
<div class="container mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex flex-wrap items-center gap-4 py-3">
<!-- 设备选择 -->
<div class="relative flex-1 min-w-[200px]">
<select id="deviceSelect" class="w-full px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-all duration-200">
<!-- 设备选项将通过JavaScript动态加载 -->
</select>
</div>
<!-- 时间设置选择器 -->
<div class="relative flex-1 min-w-[200px]">
<select id="timeSettings" class="w-full px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-all duration-200">
<!-- 时间区间选项 -->
<option value="5s">5s</option>
<option value="10s">10s</option>
<option value="15s">15s</option>
<option value="30s" selected>30s</option>
<option value="1h">1h</option>
<option value="3h">3h</option>
<option value="5h">5h</option>
<option value="24h">24h</option>
<option value="1d">1d</option>
<option value="3d">3d</option>
<option value="5d">5d</option>
<option value="custom">自定义</option>
</select>
</div>
<!-- 自定义时间范围 -->
<div id="customTimeRange" class="hidden flex flex-wrap items-center gap-2 flex-1 min-w-[200px]">
<input type="datetime-local" id="startTime" class="flex-1 min-w-[150px] px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-all duration-200">
<span class="text-gray-500"></span>
<input type="datetime-local" id="endTime" class="flex-1 min-w-[150px] px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-all duration-200">
<button id="applyCustomRange" class="px-4 py-2 text-sm font-medium text-white bg-blue-600 rounded-lg hover:bg-blue-700 transition-all duration-200 shadow-sm hover:shadow-md">应用</button>
</div>
<!-- 刷新按钮 -->
<button id="refreshBtn" class="flex items-center gap-2 px-4 py-2 text-sm font-medium text-gray-700 bg-gray-100 rounded-lg hover:bg-gray-200 transition-all duration-200 shadow-sm hover:shadow-md">
<i class="fa fa-refresh"></i>
刷新
</button>
</div>
</div>
</div>
<!-- 状态卡片 -->
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-6 mb-6">
<!-- CPU 状态卡片 -->
<div id="cpuCard" class="status-card bg-white rounded-xl shadow-lg p-6 transition-all duration-300 hover:shadow-xl hover:-translate-y-1">
<div class="flex justify-between items-start">
<div>
<p class="text-gray-500 text-sm font-medium">CPU 使用率</p>
<h3 id="cpuValue" class="text-3xl font-bold text-gray-900 metric-value">0.0%</h3>
<p id="cpuTrend" class="text-xs mt-1 text-green-600">
<i class="fa fa-arrow-up"></i>
较上次 +0.0%
</p>
</div>
<div class="p-3 bg-blue-100 rounded-full">
<i class="fa fa-microchip text-blue-600 text-xl"></i>
</div>
</div>
</div>
<!-- 内存 状态卡片 -->
<div id="memoryCard" class="status-card bg-white rounded-xl shadow-lg p-6 transition-all duration-300 hover:shadow-xl hover:-translate-y-1">
<div class="flex justify-between items-start">
<div>
<p class="text-gray-500 text-sm font-medium">内存使用率</p>
<h3 id="memoryValue" class="text-3xl font-bold text-gray-900 metric-value">0.0%</h3>
<p id="memoryTrend" class="text-xs mt-1 text-green-600">
<i class="fa fa-arrow-up"></i>
较上次 +0.0%
</p>
</div>
<div class="p-3 bg-green-100 rounded-full">
<i class="fa fa-memory text-green-600 text-xl"></i>
</div>
</div>
</div>
<!-- 磁盘 状态卡片 -->
<div id="diskCard" class="status-card bg-white rounded-xl shadow-lg p-6 transition-all duration-300 hover:shadow-xl hover:-translate-y-1">
<div class="flex justify-between items-start">
<div>
<p class="text-gray-500 text-sm font-medium">磁盘使用率</p>
<h3 id="diskValue" class="text-3xl font-bold text-gray-900 metric-value">0.0%</h3>
<p id="diskTrend" class="text-xs mt-1 text-green-600">
<i class="fa fa-arrow-up"></i>
较上次 +0.0%
</p>
</div>
<div class="p-3 bg-yellow-100 rounded-full">
<i class="fa fa-hdd-o text-yellow-600 text-xl"></i>
</div>
</div>
</div>
<!-- 网络 状态卡片 -->
<div id="networkCard" class="status-card bg-white rounded-xl shadow-lg p-6 transition-all duration-300 hover:shadow-xl hover:-translate-y-1">
<div class="flex justify-between items-start">
<div>
<p class="text-gray-500 text-sm font-medium">网络流量</p>
<h3 id="networkValue" class="text-3xl font-bold text-gray-900 metric-value">0.0 MB/s</h3>
<p class="text-xs mt-1 text-gray-600">
发送: <span id="networkSent">0.0</span> MB/s | 接收: <span id="networkReceived">0.0</span> MB/s
</p>
</div>
<div class="p-3 bg-purple-100 rounded-full">
<i class="fa fa-exchange text-purple-600 text-xl"></i>
</div>
</div>
</div>
</div>
<!-- 图表区域 -->
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6 mb-6">
<!-- CPU 图表 -->
<div class="bg-white rounded-xl shadow-lg p-6 transition-all duration-300 hover:shadow-xl">
<div class="flex justify-between items-center mb-4">
<h2 class="text-lg font-semibold text-gray-900">CPU 使用率趋势</h2>
<span class="text-sm text-gray-600">过去24小时</span>
</div>
<div class="chart-container h-80">
<canvas id="cpuChart"></canvas>
</div>
</div>
<!-- 内存 图表 -->
<div class="bg-white rounded-xl shadow-lg p-6 transition-all duration-300 hover:shadow-xl">
<div class="flex justify-between items-center mb-4">
<h2 class="text-lg font-semibold text-gray-900">内存 使用率趋势</h2>
<span class="text-sm text-gray-600">过去24小时</span>
</div>
<div class="chart-container h-80">
<canvas id="memoryChart"></canvas>
</div>
</div>
<!-- 磁盘 图表 -->
<div class="bg-white rounded-xl shadow-lg p-6 transition-all duration-300 hover:shadow-xl">
<div class="flex justify-between items-center mb-4">
<h2 class="text-lg font-semibold text-gray-900">磁盘 使用率趋势</h2>
<span class="text-sm text-gray-600">过去24小时</span>
</div>
<div class="chart-container h-80">
<canvas id="diskChart"></canvas>
</div>
</div>
<!-- 网络 流量趋势图表 -->
<div class="bg-white rounded-xl shadow-lg p-6 transition-all duration-300 hover:shadow-xl">
<div class="flex justify-between items-center mb-4">
<h2 class="text-lg font-semibold text-gray-900">网络 流量趋势</h2>
<span class="text-sm text-gray-600">过去24小时</span>
</div>
<div class="chart-container h-80">
<canvas id="networkChart"></canvas>
</div>
</div>
</div>
</div>
<!-- 设备管理页面 -->
<div id="devicesContent" class="hidden">
<div class="bg-white rounded-xl shadow-lg p-6 mb-6">
<div class="flex justify-between items-center mb-6">
<h2 class="text-xl font-bold text-gray-900">设备管理</h2>
<button id="addDeviceBtn" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg text-sm font-medium transition-all duration-200 shadow-sm hover:shadow-md">
添加设备
</button>
</div>
<!-- 设备过滤 -->
<div class="flex flex-wrap gap-6 mb-6">
<div class="flex-1 min-w-[200px]">
<label for="statusFilter" class="block text-sm font-medium text-gray-700 mb-2">状态过滤</label>
<select id="statusFilter" class="w-full text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg shadow-sm px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-all duration-200">
<option value="all">全部状态</option>
<option value="active">活跃</option>
<option value="inactive">非活跃</option>
<option value="offline">离线</option>
</select>
</div>
<div class="flex-1 min-w-[200px]">
<label for="searchDevice" class="block text-sm font-medium text-gray-700 mb-2">搜索设备</label>
<input type="text" id="searchDevice" placeholder="输入设备名称或ID" class="w-full text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg shadow-sm px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-all duration-200">
</div>
</div>
<!-- 设备列表 -->
<div class="overflow-x-auto rounded-lg border border-gray-200">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">设备名称</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">设备ID</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">IP地址</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">认证令牌</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">状态</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">创建时间</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">操作</th>
</tr>
</thead>
<tbody id="deviceManagementTableBody" class="bg-white divide-y divide-gray-200">
<!-- 设备列表将通过JavaScript动态添加 -->
</tbody>
</table>
</div>
</div>
</div>
</main>
<!-- JavaScript 文件 -->
<script src="js/app.js"></script>
</body>
</html>