49 lines
1.5 KiB
HTML
49 lines
1.5 KiB
HTML
<!doctype html>
|
|
<html lang="zh-CN">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Syscall Monitor</title>
|
|
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
|
|
</head>
|
|
<body>
|
|
<header>
|
|
<h1>Syscall Monitor</h1>
|
|
<nav>
|
|
<a href="{{ url_for('index') }}">实时监控</a>
|
|
<a href="{{ url_for('config_page') }}">配置</a>
|
|
</nav>
|
|
</header>
|
|
<main>
|
|
<div class="card">
|
|
<p class="muted">当前监控 {{ syscalls|length }} 项,每秒刷新。计数自 Agent 启动起累计。</p>
|
|
{% if syscalls %}
|
|
<table>
|
|
<thead><tr><th>System Call</th><th style="text-align:right">调用次数</th></tr></thead>
|
|
<tbody id="rows">
|
|
{% for name in syscalls %}
|
|
<tr><td><span class="tag">{{ name }}</span></td><td class="count" data-name="{{ name }}">—</td></tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
{% else %}
|
|
<p>尚未配置监控项,前往 <a href="{{ url_for('config_page') }}">配置页面</a> 添加。</p>
|
|
{% endif %}
|
|
</div>
|
|
</main>
|
|
<script>
|
|
async function refresh() {
|
|
try {
|
|
const r = await fetch('/api/counts');
|
|
const data = await r.json();
|
|
document.querySelectorAll('td.count').forEach(td => {
|
|
const n = td.dataset.name;
|
|
td.textContent = (data[n] ?? 0).toLocaleString();
|
|
});
|
|
} catch (e) { /* keep last value on error */ }
|
|
}
|
|
refresh();
|
|
setInterval(refresh, 1000);
|
|
</script>
|
|
</body>
|
|
</html>
|