Files
worker/internal/webapp/templates/status.html
Gleb Tv 2c7a0236da feat: publish standalone worker
Separate worker packaging and service lifecycle from the control plane.
2026-07-13 17:55:14 +03:00

83 строки
3.7 KiB
HTML

{{define "body"}}<section class="card">
<h1>Server status</h1>
<p class="muted">Sampled every 5s from <code>/proc</code> and statfs. CLI tools (lsblk, smartctl, sensors) are not bundled with the worker; install them on the host separately if you want richer hardware data. SMART self-tests are out of scope.</p>
<h2>CPU</h2>
<div class="cards">
<div class="metric"><div class="label">Total busy</div><div class="value">{{fmtPercent .Snapshot.CPU.TotalPct}}</div></div>
<div class="metric"><div class="label">User</div><div class="value">{{fmtPercent .Snapshot.CPU.UserPct}}</div></div>
<div class="metric"><div class="label">System</div><div class="value">{{fmtPercent .Snapshot.CPU.SystemPct}}</div></div>
<div class="metric"><div class="label">Idle</div><div class="value">{{fmtPercent .Snapshot.CPU.IdlePct}}</div></div>
<div class="metric"><div class="label">I/O wait</div><div class="value">{{fmtPercent .Snapshot.CPU.IOWaitPct}}</div></div>
</div>
<h2>Load</h2>
<div class="cards">
<div class="metric"><div class="label">1 min</div><div class="value">{{printf "%.2f" .Snapshot.Load.One}}</div></div>
<div class="metric"><div class="label">5 min</div><div class="value">{{printf "%.2f" .Snapshot.Load.Five}}</div></div>
<div class="metric"><div class="label">15 min</div><div class="value">{{printf "%.2f" .Snapshot.Load.Fifteen}}</div></div>
</div>
<h2>Memory</h2>
<table>
<tbody>
<tr><th>Total</th><td>{{fmtBytes .Snapshot.Memory.Total}}</td></tr>
<tr><th>Available</th><td>{{fmtBytes .Snapshot.Memory.Available}} ({{fmtPercent .Snapshot.Memory.AvailablePct}})</td></tr>
<tr><th>Free</th><td>{{fmtBytes .Snapshot.Memory.Free}}</td></tr>
<tr><th>Buffers</th><td>{{fmtBytes .Snapshot.Memory.Buffers}}</td></tr>
<tr><th>Cached</th><td>{{fmtBytes .Snapshot.Memory.Cached}}</td></tr>
<tr><th>Swap total</th><td>{{fmtBytes .Snapshot.Memory.SwapTotal}}</td></tr>
<tr><th>Swap free</th><td>{{fmtBytes .Snapshot.Memory.SwapFree}}</td></tr>
</tbody>
</table>
<h2>Uptime</h2>
<div class="cards">
<div class="metric"><div class="label">Uptime</div><div class="value">{{fmtDuration .Snapshot.Uptime}}</div></div>
<div class="metric"><div class="label">Boot at</div><div class="value">{{fmtTime .Snapshot.BootAt}}</div></div>
<div class="metric"><div class="label">Last sample</div><div class="value">{{fmtTime .SnapshotAt}}</div></div>
</div>
<h2>Network</h2>
<table>
<thead><tr><th>Iface</th><th>RX bytes</th><th>TX bytes</th><th>RX pkts</th><th>TX pkts</th><th>RX errs</th><th>TX errs</th><th>RX drops</th><th>TX drops</th></tr></thead>
<tbody>
{{range .Snapshot.Networks}}
<tr>
<td>{{.Name}}</td>
<td>{{fmtBytes .RxBytes}}</td>
<td>{{fmtBytes .TxBytes}}</td>
<td>{{.RxPkt}}</td>
<td>{{.TxPkt}}</td>
<td>{{.RxErr}}</td>
<td>{{.TxErr}}</td>
<td>{{.RxDrop}}</td>
<td>{{.TxDrop}}</td>
</tr>
{{else}}
<tr><td colspan="9" class="muted">No network interfaces detected.</td></tr>
{{end}}
</tbody>
</table>
<h2>Mount points</h2>
<table>
<thead><tr><th>Mount</th><th>Device</th><th>FS</th><th>Total</th><th>Free</th><th>Used</th><th>Use%</th></tr></thead>
<tbody>
{{range .Snapshot.Disks}}
<tr>
<td>{{.Mount}}</td>
<td>{{.Device}}</td>
<td>{{.FSType}}</td>
<td>{{fmtBytes .Total}}</td>
<td>{{fmtBytes .Free}}</td>
<td>{{fmtBytes .Used}}</td>
<td>{{fmtPercent .UsedPct}}</td>
</tr>
{{else}}
<tr><td colspan="7" class="muted">No mount points parsed from /proc/mounts.</td></tr>
{{end}}
</tbody>
</table>
</section>{{end}}