Files
paul f717f7a82f Long-term telemetry: hourly rollups in JSONL, a range selector in the UI
- telemetry/record.py: a Recorder subscribed to Telemetry keeps min/avg/max
  per metric for the current hour and appends each finished hour as one JSON
  line to records-YYYY-MM.jsonl in the data dir (~400 days kept; whole months
  older than that are pruned on start). Best effort by design: a failing disk
  logs once and stops recording; nothing else notices. load() merges lines per
  hour (a restart re-writes the current hour; torn last lines are skipped).
- app.py: the recorder runs unless --demo (simulated samples must not mix into
  real records) and flushes the open hour in close(), after the telemetry
  thread has stopped. records(days) validates 1..400.
- Web: GET /api/records?days=N (bad values answer 400 with the reason).
- UI: a range selector above the power/temperature charts switches them
  between the live 10 minutes and hourly averages for 24 h / 7 d / 30 d /
  1 y; the chart window, tick labels (min/h/d), tooltips and table captions
  adapt to the span. Live samples keep accumulating behind a long-range view,
  so switching back is instant.
- Tests: test_record.py (5) and a /api/records case in test_web.py; README
  updated (API table, System section, layout).
2026-12-05 18:04:57 +13:00

121 lines
4.9 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>The Kurgan</title>
<link rel="icon" href="/static/favicon.ico" sizes="16x16 32x32 48x48">
<link rel="stylesheet" href="/static/style.css">
<script src="/static/app.js" defer></script>
</head>
<body>
<header class="masthead">
<div class="brand">
<img src="/static/logo.png" alt="" width="90" height="40">
<h1>THE KURGAN</h1>
</div>
<nav aria-label="Sections">
<a href="#system">System</a><a href="#cooling">Cooling</a><a href="#lighting">Lighting</a><a href="#ai">AI</a>
</nav>
<div class="hero" title="Whole-PC power draw (DC, load on the power supply)">
<span class="hero-value" id="hero-total">--</span><span class="hero-unit">W</span>
<span class="hero-label">whole PC</span>
</div>
<div class="meta" id="meta" aria-live="polite"></div>
</header>
<div class="banner" id="banner" role="status" hidden></div>
<main>
<!-- ======================================================== SYSTEM -->
<section id="system" aria-labelledby="h-system">
<h2 id="h-system">System</h2>
<div class="tiles">
<div class="card tile">
<div class="label"><span class="key" style="background:var(--cpu)"></span>CPU</div>
<div class="value"><span id="cpu-temp">--</span><small>°C</small></div>
<div class="detail" id="cpu-detail">&nbsp;</div>
</div>
<div class="card tile">
<div class="label"><span class="key" style="background:var(--gpu)"></span>GPU</div>
<div class="value"><span id="gpu-temp">--</span><small>°C</small></div>
<div class="detail" id="gpu-detail">&nbsp;</div>
</div>
<div class="card tile">
<div class="label">GPU memory</div>
<div class="value"><span id="vram-used">--</span><small id="vram-total"></small></div>
<div class="meter" role="meter" aria-label="GPU memory used" id="vram-meter"><span></span></div>
</div>
<div class="card tile">
<div class="label">LCD</div>
<div class="value" style="font-size:18px;margin-top:8px" id="lcd-status">--</div>
<div class="detail" id="lcd-detail">&nbsp;</div>
</div>
</div>
<div class="row" style="justify-content:flex-end;margin:0 0 10px">
<div class="seg" role="radiogroup" aria-label="Chart range" id="chart-range"></div>
</div>
<div class="grid2">
<figure class="card chart" id="chart-power"></figure>
<figure class="card chart" id="chart-temps"></figure>
</div>
</section>
<!-- ======================================================== COOLING -->
<section id="cooling" aria-labelledby="h-cooling">
<h2 id="h-cooling">Cooling</h2>
<div class="card">
<div class="row">
<div>
<h3>Fan profile</h3>
<p class="sub" style="margin:0">Applies to the Commander PRO case fans and the motherboard top fans. Fail-safes stay on in every profile.</p>
</div>
<div class="spacer"></div>
<div class="seg" role="radiogroup" aria-label="Fan profile" id="profiles"></div>
</div>
<p class="profile-desc" id="profile-desc"></p>
<div id="cooling-note"></div>
</div>
<div class="grid3" id="fan-groups"></div>
<div class="grid2">
<figure class="card chart" id="chart-fans"></figure>
<figure class="card chart" id="chart-curves"></figure>
</div>
</section>
<!-- ======================================================== LIGHTING -->
<section id="lighting" aria-labelledby="h-lighting">
<h2 id="h-lighting">Lighting</h2>
<div class="grid3" id="light-zones"></div>
<p class="muted" style="font-size:13px;margin:10px 2px 0" id="chase-note"></p>
</section>
<!-- ======================================================== AI -->
<section id="ai" aria-labelledby="h-ai">
<h2 id="h-ai">AI</h2>
<div class="card">
<div class="row" style="margin-bottom:12px">
<div>
<h3>Local LLM server</h3>
<p class="sub" style="margin:0">One runs at a time, so they never share the GPU's memory. A request to either one's address starts it, once the other has finished what it's doing; switching stops the other completely first.</p>
<p class="sub" style="margin:4px 0 0" id="ai-idle"></p>
</div>
</div>
<div class="backends" role="radiogroup" aria-label="LLM server" id="backends"></div>
<div id="ai-notes"></div>
</div>
<div class="grid2">
<div class="card" id="ai-active"></div>
<figure class="card chart" id="chart-vram"></figure>
</div>
<div class="card" style="margin-top:16px">
<h3>Recent requests</h3>
<p class="sub" id="requests-sub">Newest first</p>
<div class="table-wrap" id="requests"></div>
</div>
</section>
</main>
<footer id="footer"></footer>
<div class="tooltip" id="tooltip" role="tooltip" hidden></div>
</body>
</html>