添加连接数指标评估
This commit is contained in:
@@ -399,12 +399,13 @@
|
||||
<th class="sortable" data-sort="disk">磁盘 <span class="sort-icon"></span></th>
|
||||
<th class="sortable" data-sort="netRx">网络 ↓ <span class="sort-icon"></span></th>
|
||||
<th class="sortable" data-sort="netTx">网络 ↑ <span class="sort-icon"></span></th>
|
||||
<th class="sortable" data-sort="conntrack">Conntrack <span class="sort-icon"></span></th>
|
||||
<th class="sortable" data-sort="traffic24h">24h 流量 <span class="sort-icon"></span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="serverTableBody">
|
||||
<tr class="empty-row">
|
||||
<td colspan="9">暂无数据 - 请先配置 Prometheus 数据源</td>
|
||||
<td colspan="10">暂无数据 - 请先配置 Prometheus 数据源</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -1408,7 +1408,8 @@
|
||||
</div>` },
|
||||
{ key: 'rootFsUsedPct', label: '根分区使用率 (/)', value: formatPercent(server.diskPercent) },
|
||||
{ key: 'netRx', label: '网络接收速率 (RX)', value: formatBandwidth(server.netRx) },
|
||||
{ key: 'netTx', label: '网络发送速率 (TX)', value: formatBandwidth(server.netTx) }
|
||||
{ key: 'netTx', label: '网络发送速率 (TX)', value: formatBandwidth(server.netTx) },
|
||||
{ key: 'conntrackUsedPct', label: 'Conntrack 占用比例', value: formatPercent(server.conntrackPercent) }
|
||||
];
|
||||
|
||||
metrics.forEach(m => {
|
||||
@@ -1502,6 +1503,10 @@
|
||||
valA = (a.traffic24hRx ?? 0) + (a.traffic24hTx ?? 0);
|
||||
valB = (b.traffic24hRx ?? 0) + (b.traffic24hTx ?? 0);
|
||||
break;
|
||||
case 'conntrack':
|
||||
valA = a.conntrackPercent ?? 0;
|
||||
valB = b.conntrackPercent ?? 0;
|
||||
break;
|
||||
default:
|
||||
valA = (a.job || '').toLowerCase();
|
||||
valB = (b.job || '').toLowerCase();
|
||||
@@ -1627,7 +1632,7 @@
|
||||
if (!servers || servers.length === 0) {
|
||||
dom.serverTableBody.innerHTML = `
|
||||
<tr class="empty-row">
|
||||
<td colspan="9">暂无数据 - 请先配置 Prometheus 数据源</td>
|
||||
<td colspan="10">暂无数据 - 请先配置 Prometheus 数据源</td>
|
||||
</tr>
|
||||
`;
|
||||
return;
|
||||
@@ -1672,6 +1677,14 @@
|
||||
</td>
|
||||
<td>${formatBandwidth(server.netRx)}</td>
|
||||
<td>${formatBandwidth(server.netTx)}</td>
|
||||
<td>
|
||||
<div class="usage-bar">
|
||||
<div class="usage-bar-track">
|
||||
<div class="usage-bar-fill usage-bar-fill-cpu" style="width: ${Math.min(server.conntrackPercent || 0, 100)}%; background: var(--accent-indigo);"></div>
|
||||
</div>
|
||||
<span>${formatPercent(server.conntrackPercent || 0)}</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div style="font-size: 0.85rem; font-weight: 500; color: var(--text-primary);">${formatBytes((server.traffic24hRx || 0) + (server.traffic24hTx || 0))}</div>
|
||||
<div style="font-size: 0.65rem; color: var(--text-muted); margin-top: 2px;">↓${formatBytes(server.traffic24hRx || 0)} / ↑${formatBytes(server.traffic24hTx || 0)}</div>
|
||||
@@ -1790,6 +1803,11 @@
|
||||
{ key: 'netTx', label: '网络发送速率 (TX)', value: formatBandwidth(data.netTx) },
|
||||
{ key: 'sockstatTcp', label: 'TCP 链接数 (Sockstat)', value: data.sockstatTcp.toFixed(0) },
|
||||
{ key: 'sockstatTcpMem', label: 'TCP 内存占用', value: formatBytes(data.sockstatTcpMem) },
|
||||
{ key: 'conntrackUsedPct', label: 'Conntrack 占用比例', value: `
|
||||
<div style="display: flex; align-items: baseline; gap: 8px;">
|
||||
<span style="font-weight: 700; font-size: 1.1rem;">${formatPercent(data.conntrackUsedPct)}</span>
|
||||
<span style="font-size: 0.7rem; color: var(--text-secondary); font-weight: normal;">(${data.conntrackEntries.toFixed(0)} / ${data.conntrackLimit.toFixed(0)})</span>
|
||||
</div>` },
|
||||
{ key: 'networkTrend', label: '网络流量趋势 (24h)', value: '' }
|
||||
];
|
||||
|
||||
@@ -1952,6 +1970,7 @@
|
||||
if (metricKey.includes('Pct') || metricKey === 'cpuBusy') unit = '%';
|
||||
if (metricKey.startsWith('net')) unit = 'B/s';
|
||||
if (metricKey === 'sockstatTcpMem') unit = 'B';
|
||||
if (metricKey === 'conntrackUsedPct') unit = '%';
|
||||
|
||||
if (metricKey === 'networkTrend') {
|
||||
chart = new AreaChart(canvas);
|
||||
@@ -1966,6 +1985,7 @@
|
||||
if (metricKey === 'memUsedPct') chart.totalValue = currentServerDetail.memTotal;
|
||||
if (metricKey === 'swapUsedPct') chart.totalValue = currentServerDetail.swapTotal;
|
||||
if (metricKey === 'rootFsUsedPct') chart.totalValue = currentServerDetail.rootFsTotal;
|
||||
if (metricKey === 'conntrackUsedPct') chart.totalValue = data.conntrackLimit;
|
||||
|
||||
try {
|
||||
const { instance, job, source } = currentServerDetail;
|
||||
|
||||
Reference in New Issue
Block a user