修复日志显示
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -8,6 +8,7 @@
|
||||
<script src="js/vendor/tailwind.js"></script>
|
||||
<!-- Chart.js -->
|
||||
<script src="js/vendor/chart.js"></script>
|
||||
<script src="js/app.js"></script>
|
||||
<!-- Font Awesome -->
|
||||
<link href="css/font-awesome.min.css" rel="stylesheet">
|
||||
|
||||
@@ -612,8 +613,5 @@
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 脚本文件 -->
|
||||
<script src="js/app.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
+66
-14
@@ -1327,6 +1327,12 @@ async function loadMetrics() {
|
||||
|
||||
// 更新刷新状态指示器
|
||||
updateRefreshStatus();
|
||||
|
||||
// 更新进程信息
|
||||
loadProcessInfo();
|
||||
|
||||
// 更新系统日志
|
||||
loadSystemLogs();
|
||||
} catch (error) {
|
||||
console.error('Failed to load metrics:', error);
|
||||
// 显示友好的错误提示
|
||||
@@ -3148,7 +3154,10 @@ let processPagination = {
|
||||
totalItems: 0,
|
||||
totalPages: 0,
|
||||
allProcesses: [],
|
||||
lastDeviceID: '' // 上次请求数据的设备ID
|
||||
lastDeviceID: '', // 上次请求数据的设备ID
|
||||
lastTimeRange: '', // 上次请求数据的时间范围
|
||||
lastCustomStartTime: '', // 上次请求数据的自定义开始时间
|
||||
lastCustomEndTime: '' // 上次请求数据的自定义结束时间
|
||||
};
|
||||
|
||||
// 系统日志分页状态
|
||||
@@ -3158,7 +3167,10 @@ let logPagination = {
|
||||
totalItems: 0,
|
||||
totalPages: 0,
|
||||
allLogs: [],
|
||||
lastDeviceID: '' // 上次请求数据的设备ID
|
||||
lastDeviceID: '', // 上次请求数据的设备ID
|
||||
lastTimeRange: '', // 上次请求数据的时间范围
|
||||
lastCustomStartTime: '', // 上次请求数据的自定义开始时间
|
||||
lastCustomEndTime: '' // 上次请求数据的自定义结束时间
|
||||
};
|
||||
|
||||
// 加载进程信息
|
||||
@@ -3187,16 +3199,32 @@ async function loadProcessInfo(page = 1) {
|
||||
params.append('device_id', state.currentDeviceID);
|
||||
}
|
||||
|
||||
// 检查设备ID是否变化
|
||||
if (processPagination.lastDeviceID !== state.currentDeviceID) {
|
||||
// 设备ID变化,清空旧数据
|
||||
// 设置时间范围参数(与fetchMetric函数保持一致)
|
||||
if (state.customStartTime && state.customEndTime) {
|
||||
// 自定义时间范围
|
||||
params.append('start_time', state.customStartTime);
|
||||
params.append('end_time', state.customEndTime);
|
||||
} else {
|
||||
// 使用状态中的时间范围设置
|
||||
params.append('start_time', `-${state.currentTimeRange}`);
|
||||
params.append('end_time', 'now()');
|
||||
}
|
||||
|
||||
// 检查设备ID或时间范围是否变化
|
||||
const timeRangeChanged =
|
||||
processPagination.lastTimeRange !== state.currentTimeRange ||
|
||||
processPagination.lastCustomStartTime !== state.customStartTime ||
|
||||
processPagination.lastCustomEndTime !== state.customEndTime;
|
||||
|
||||
if (processPagination.lastDeviceID !== state.currentDeviceID || timeRangeChanged) {
|
||||
// 设备ID或时间范围变化,清空旧数据
|
||||
processPagination.allProcesses = [];
|
||||
processPagination.totalItems = 0;
|
||||
processPagination.totalPages = 0;
|
||||
processPagination.currentPage = 1;
|
||||
}
|
||||
|
||||
// 如果是第一次加载或设备ID变化,获取全部数据
|
||||
// 如果是第一次加载或设备ID/时间范围变化,获取全部数据
|
||||
if (processPagination.allProcesses.length === 0) {
|
||||
// 发送请求
|
||||
const response = await fetch(`${API_BASE_URL}/metrics/processes?${params.toString()}`);
|
||||
@@ -3208,8 +3236,11 @@ async function loadProcessInfo(page = 1) {
|
||||
processPagination.allProcesses = data.data || [];
|
||||
processPagination.totalItems = processPagination.allProcesses.length;
|
||||
processPagination.totalPages = Math.ceil(processPagination.totalItems / processPagination.itemsPerPage);
|
||||
// 更新上次请求数据的设备ID
|
||||
// 更新上次请求数据的设备ID和时间范围
|
||||
processPagination.lastDeviceID = state.currentDeviceID;
|
||||
processPagination.lastTimeRange = state.currentTimeRange;
|
||||
processPagination.lastCustomStartTime = state.customStartTime;
|
||||
processPagination.lastCustomEndTime = state.customEndTime;
|
||||
}
|
||||
|
||||
// 更新当前页码
|
||||
@@ -3582,16 +3613,32 @@ async function loadSystemLogs(page = 1) {
|
||||
params.append('device_id', state.currentDeviceID);
|
||||
}
|
||||
|
||||
// 检查设备ID是否变化
|
||||
if (logPagination.lastDeviceID !== state.currentDeviceID) {
|
||||
// 设备ID变化,清空旧数据
|
||||
// 设置时间范围参数(与fetchMetric函数保持一致)
|
||||
if (state.customStartTime && state.customEndTime) {
|
||||
// 自定义时间范围
|
||||
params.append('start_time', state.customStartTime);
|
||||
params.append('end_time', state.customEndTime);
|
||||
} else {
|
||||
// 使用状态中的时间范围设置
|
||||
params.append('start_time', `-${state.currentTimeRange}`);
|
||||
params.append('end_time', 'now()');
|
||||
}
|
||||
|
||||
// 检查设备ID或时间范围是否变化
|
||||
const timeRangeChanged =
|
||||
logPagination.lastTimeRange !== state.currentTimeRange ||
|
||||
logPagination.lastCustomStartTime !== state.customStartTime ||
|
||||
logPagination.lastCustomEndTime !== state.customEndTime;
|
||||
|
||||
if (logPagination.lastDeviceID !== state.currentDeviceID || timeRangeChanged) {
|
||||
// 设备ID或时间范围变化,清空旧数据
|
||||
logPagination.allLogs = [];
|
||||
logPagination.totalItems = 0;
|
||||
logPagination.totalPages = 0;
|
||||
logPagination.currentPage = 1;
|
||||
}
|
||||
|
||||
// 如果是第一次加载或设备ID变化,获取全部数据
|
||||
// 如果是第一次加载或设备ID/时间范围变化,获取全部数据
|
||||
if (logPagination.allLogs.length === 0) {
|
||||
console.log('Fetching logs from:', `${API_BASE_URL}/metrics/logs?${params.toString()}`);
|
||||
// 发送请求
|
||||
@@ -3601,11 +3648,16 @@ async function loadSystemLogs(page = 1) {
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
logPagination.allLogs = data.data || [];
|
||||
logPagination.totalItems = logPagination.allLogs.length;
|
||||
console.log('Logs response data:', data);
|
||||
// 处理后端返回格式,支持两种格式:{"logs": [...]} 和 {"data": [...], "total": ...}
|
||||
logPagination.allLogs = data.data || data.logs || [];
|
||||
logPagination.totalItems = data.total || logPagination.allLogs.length;
|
||||
logPagination.totalPages = Math.ceil(logPagination.totalItems / logPagination.itemsPerPage);
|
||||
// 更新上次请求数据的设备ID
|
||||
// 更新上次请求数据的设备ID和时间范围
|
||||
logPagination.lastDeviceID = state.currentDeviceID;
|
||||
logPagination.lastTimeRange = state.currentTimeRange;
|
||||
logPagination.lastCustomStartTime = state.customStartTime;
|
||||
logPagination.lastCustomEndTime = state.customEndTime;
|
||||
}
|
||||
|
||||
// 更新当前页码
|
||||
|
||||
@@ -1,102 +0,0 @@
|
||||
<!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="js/vendor/tailwind.js"></script>
|
||||
<!-- Chart.js -->
|
||||
<script src="js/vendor/chart.min.js"></script>
|
||||
<!-- 自定义样式 -->
|
||||
<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-md">
|
||||
<div class="container mx-auto px-4 py-4">
|
||||
<div class="flex justify-between items-center">
|
||||
<div class="flex items-center gap-4">
|
||||
<div class="text-blue-600 font-bold text-xl">监控系统</div>
|
||||
<nav class="hidden md:flex space-x-8">
|
||||
<a href="/home.html" class="text-blue-600 font-medium">首页</a>
|
||||
<a href="/" class="text-gray-600 hover:text-blue-600 transition-colors">仪表盘</a>
|
||||
<a href="#" class="text-gray-600 hover:text-blue-600 transition-colors">设备监控</a>
|
||||
<a href="#" class="text-gray-600 hover:text-blue-600 transition-colors">网络监控</a>
|
||||
<a href="#" class="text-gray-600 hover:text-blue-600 transition-colors">关于产品</a>
|
||||
</nav>
|
||||
</div>
|
||||
<div class="flex items-center gap-4">
|
||||
<button class="text-gray-600 hover:text-blue-600 transition-colors">
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path>
|
||||
</svg>
|
||||
</button>
|
||||
<button class="text-gray-600 hover:text-blue-600 transition-colors">
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"></path>
|
||||
</svg>
|
||||
</button>
|
||||
<div class="flex items-center gap-2">
|
||||
<div class="w-8 h-8 bg-blue-100 rounded-full flex items-center justify-center">
|
||||
<span class="text-blue-600 font-medium">A</span>
|
||||
</div>
|
||||
<span class="text-gray-600">管理员</span>
|
||||
<svg class="w-4 h-4 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<!-- 主要内容区域 -->
|
||||
<main class="container mx-auto px-4 py-6">
|
||||
<!-- 监控资源概览 -->
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mb-6">
|
||||
<!-- 业务系统 -->
|
||||
<div class="status-card bg-white rounded-lg shadow-md p-5">
|
||||
<div class="flex justify-between items-start">
|
||||
<div>
|
||||
<p class="text-gray-500 text-sm font-medium">业务系统</p>
|
||||
<h3 class="text-2xl font-bold text-gray-800 metric-value">355</h3>
|
||||
</div>
|
||||
<div class="p-3 bg-blue-100 rounded-full">
|
||||
<svg class="w-6 h-6 text-blue-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4"></path>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 服务器 -->
|
||||
<div class="status-card bg-white rounded-lg shadow-md p-5">
|
||||
<div class="flex justify-between items-start">
|
||||
<div>
|
||||
<p class="text-gray-500 text-sm font-medium">服务器</p>
|
||||
<h3 class="text-2xl font-bold text-gray-800 metric-value">138</h3>
|
||||
</div>
|
||||
<div class="p-3 bg-green-100 rounded-full">
|
||||
<svg class="w-6 h-6 text-green-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 12h14M5 12a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v4a2 2 0 01-2 2M5 12a2 2 0
|
||||
@@ -1,620 +0,0 @@
|
||||
<!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="js/vendor/tailwind.js"></script>
|
||||
<!-- Chart.js -->
|
||||
<script src="js/vendor/chart.min.js"></script>
|
||||
|
||||
<!-- 自定义样式 -->
|
||||
<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="#dashboard" 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>
|
||||
|
||||
<!-- 导航栏下方的操作栏,仅在仪表盘显示 -->
|
||||
<div id="dashboardActions" class="bg-white shadow-sm border-b border-gray-200 hidden">
|
||||
<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">
|
||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"></path>
|
||||
</svg>
|
||||
刷新
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 主要内容区域 -->
|
||||
<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">
|
||||
<svg class="w-6 h-6 text-blue-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4"></path>
|
||||
</svg>
|
||||
</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">
|
||||
<svg class="w-6 h-6 text-yellow-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4m0 5c0 2.21-3.582 4-8 4s-8-1.79-8-4"></path>
|
||||
</svg>
|
||||
</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">0</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">
|
||||
<svg class="w-6 h-6 text-green-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 12h14M5 12a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v4a2 2 0 01-2 2M5 12a2 2 0 00-2 2v4a2 2 0 002 2h14a2 2 0 002-2v-4a2 2 0 00-2-2m-2-4h.01M17 16h.01"></path>
|
||||
</svg>
|
||||
</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">
|
||||
<svg class="w-6 h-6 text-red-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"></path>
|
||||
</svg>
|
||||
</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">
|
||||
<svg class="w-6 h-6 text-yellow-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"></path>
|
||||
</svg>
|
||||
</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">
|
||||
<svg class="w-6 h-6 text-orange-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"></path>
|
||||
</svg>
|
||||
</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">
|
||||
<svg class="w-6 h-6 text-pink-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"></path>
|
||||
</svg>
|
||||
</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">
|
||||
<svg class="w-4 h-4 text-gray-400 absolute left-3 top-1/2 transform -translate-y-1/2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path>
|
||||
</svg>
|
||||
</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="dashboardContent" class="hidden">
|
||||
<!-- 状态卡片 -->
|
||||
<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">
|
||||
<svg class="inline w-3 h-3 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 15l7-7 7 7"></path>
|
||||
</svg>
|
||||
较上次 +0.0%
|
||||
</p>
|
||||
</div>
|
||||
<div class="p-3 bg-blue-100 rounded-full">
|
||||
<svg class="w-6 h-6 text-blue-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 3v2m6-2v2M9 19v2m6-2v2M5 9H3m2 6H3m18-6h-2m2 6h-2M7 19h10a2 2 0 002-2V7a2 2 0 00-2-2H7a2 2 0 00-2 2v10a2 2 0 002 2zM9 9h6v6H9V9z"></path>
|
||||
</svg>
|
||||
</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">
|
||||
<svg class="inline w-3 h-3 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 15l7-7 7 7"></path>
|
||||
</svg>
|
||||
较上次 +0.0%
|
||||
</p>
|
||||
</div>
|
||||
<div class="p-3 bg-green-100 rounded-full">
|
||||
<svg class="w-6 h-6 text-green-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 5a1 1 0 011-1h14a1 1 0 011 1v2a1 1 0 01-1 1H5a1 1 0 01-1-1V5zM4 13a1 1 0 011-1h6a1 1 0 011 1v6a1 1 0 01-1 1H5a1 1 0 01-1-1v-6zM16 13a1 1 0 011-1h2a1 1 0 011 1v6a1 1 0 01-1 1h-2a1 1 0 01-1-1v-6z"></path>
|
||||
</svg>
|
||||
</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">
|
||||
<svg class="inline w-3 h-3 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 15l7-7 7 7"></path>
|
||||
</svg>
|
||||
较上次 +0.0%
|
||||
</p>
|
||||
</div>
|
||||
<div class="p-3 bg-yellow-100 rounded-full">
|
||||
<svg class="w-6 h-6 text-yellow-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 12h14M5 12a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v4a2 2 0 01-2 2M5 12a2 2 0 00-2 2v4a2 2 0 002 2h14a2 2 0 002-2v-4a2 2 0 00-2-2m-2-4h.01M17 16h.01"></path>
|
||||
</svg>
|
||||
</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">
|
||||
<svg class="w-6 h-6 text-purple-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z"></path>
|
||||
</svg>
|
||||
</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 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="networkRateChart"></canvas>
|
||||
</div>
|
||||
</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-6">
|
||||
<h2 class="text-lg font-semibold text-gray-900">设备状态概览</h2>
|
||||
<span class="text-sm text-gray-600">实时更新</span>
|
||||
</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">CPU使用率</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>
|
||||
<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="devicesTableBody" class="bg-white divide-y divide-gray-200">
|
||||
<!-- 设备状态将通过JavaScript动态添加 -->
|
||||
</tbody>
|
||||
</table>
|
||||
</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 lg:grid-cols-3 gap-6">
|
||||
<!-- 服务器品牌分布 -->
|
||||
<div class="bg-white rounded-xl shadow-lg p-6 transition-all duration-300 hover:shadow-xl">
|
||||
<h3 class="text-lg font-semibold text-gray-900 mb-4">服务器品牌分布</h3>
|
||||
<div class="chart-container h-80">
|
||||
<canvas id="serverBrandChart"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 近一周告警趋势 -->
|
||||
<div class="bg-white rounded-xl shadow-lg p-6 lg:col-span-2 transition-all duration-300 hover:shadow-xl">
|
||||
<h3 class="text-lg font-semibold text-gray-900 mb-4">近一周告警趋势</h3>
|
||||
<div class="chart-container h-80">
|
||||
<canvas id="serverAlarmTrendChart"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 服务器型号分类表 -->
|
||||
<div class="bg-white rounded-xl shadow-lg p-6 mt-6 transition-all duration-300 hover:shadow-xl">
|
||||
<div class="flex justify-between items-center mb-6">
|
||||
<h3 class="text-lg font-semibold text-gray-900">服务器型号分类</h3>
|
||||
<div class="flex 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>
|
||||
<option>戴尔</option>
|
||||
<option>惠普</option>
|
||||
<option>联想</option>
|
||||
<option>华为</option>
|
||||
</select>
|
||||
</div>
|
||||
</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 id="deviceModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center hidden z-50">
|
||||
<div class="bg-white rounded-xl shadow-xl p-6 w-full max-w-md transform transition-all duration-300 scale-100">
|
||||
<h3 id="modalTitle" class="text-xl font-bold text-gray-900 mb-6">添加设备</h3>
|
||||
<form id="deviceForm">
|
||||
<input type="hidden" id="deviceId">
|
||||
<div class="mb-5">
|
||||
<label for="deviceName" class="block text-sm font-medium text-gray-700 mb-2">设备名称</label>
|
||||
<input type="text" id="deviceName" name="name" required 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 class="mb-5">
|
||||
<label for="deviceIdInput" class="block text-sm font-medium text-gray-700 mb-2">设备ID</label>
|
||||
<input type="text" id="deviceIdInput" name="id" required 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 class="mb-5">
|
||||
<label for="deviceIp" class="block text-sm font-medium text-gray-700 mb-2">IP地址</label>
|
||||
<input type="text" id="deviceIp" name="ip" 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 class="mb-6">
|
||||
<label for="deviceStatus" class="block text-sm font-medium text-gray-700 mb-2">状态</label>
|
||||
<select id="deviceStatus" name="status" 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="active">活跃</option>
|
||||
<option value="inactive">非活跃</option>
|
||||
<option value="offline">离线</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="flex justify-end gap-3">
|
||||
<button type="button" id="cancelBtn" class="bg-gray-100 hover:bg-gray-200 text-gray-800 px-4 py-2 rounded-lg text-sm font-medium transition-all duration-200">
|
||||
取消
|
||||
</button>
|
||||
<button type="submit" 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>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<!-- JavaScript 文件 -->
|
||||
<script src="js/app.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because it is too large
Load Diff
Vendored
-13
File diff suppressed because one or more lines are too long
Vendored
-14
File diff suppressed because one or more lines are too long
Vendored
-83
File diff suppressed because one or more lines are too long
@@ -1,484 +0,0 @@
|
||||
<!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>
|
||||
File diff suppressed because it is too large
Load Diff
-13
File diff suppressed because one or more lines are too long
-14
File diff suppressed because one or more lines are too long
-83
File diff suppressed because one or more lines are too long
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"server_url": "http://localhost:8080/api",
|
||||
"id": "test-agent",
|
||||
"name": "Test Agent",
|
||||
"device_id": "test-device",
|
||||
"token": "bb30bfaee01bf7b541bbefe422f72645",
|
||||
"interval": "5s",
|
||||
"debug": true,
|
||||
"api_port": 8081
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 测试发送单个指标对象
|
||||
echo "测试发送单个指标对象:"
|
||||
curl -v -X POST -H "Content-Type: application/json" -H "X-Device-ID: test-device" -H "X-Agent-Name: test-agent" -H "X-Device-Token: test-token" -d '{"cpu": 50.5, "memory": 30.2, "disk": {":/": 45.6}, "network": {"eth0": {"bytes_sent": 1000, "bytes_received": 2000}}}' http://localhost:8080/api/metrics/
|
||||
|
||||
echo "\n---\n"
|
||||
|
||||
# 测试发送指标数组
|
||||
echo "测试发送指标数组:"
|
||||
curl -v -X POST -H "Content-Type: application/json" -H "X-Device-ID: test-device" -H "X-Agent-Name: test-agent" -H "X-Device-Token: test-token" -d '[{"cpu": 50.5, "memory": 30.2, "disk": {":/": 45.6}, "network": {"eth0": {"bytes_sent": 1000, "bytes_received": 2000}}}, {"cpu": 60.5, "memory": 40.2, "disk": {":/": 55.6}, "network": {"eth0": {"bytes_sent": 2000, "bytes_received": 3000}}}]' http://localhost:8080/api/metrics/
|
||||
Reference in New Issue
Block a user