A btop-like monitor in the console, from Prometheus; node exporters discovered and installed
Monitor draws CPU, memory, GPUs, requests, tokens, latency, network and disk as Braille charts over 5m/1h/24h/7d, then per node, card and model sparklines; node and model pages have their own. History is read from monitoring.prometheus through POST /api/v1/metrics/range, or without it from what the console saw. The control plane serves the cluster's machines for Prometheus http_sd at /prometheus/targets on its metrics port, and node add installs prometheus-node-exporter. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
2e55487eca
commit
a1b1663e9d
16 files changed
+1217
-4
No files matched your search
@@ -0,0 +1,33 @@
|
||||
//go:build liverender
|
||||
|
||||
package cli
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"gitea.mynodes.xyz/ilker/llmgw/internal/control/adminapi"
|
||||
"gitea.mynodes.xyz/ilker/llmgw/internal/promq"
|
||||
)
|
||||
|
||||
func TestLiveRender(t *testing.T) {
|
||||
p := promq.New("http://10.0.0.146:9090", 10*time.Second)
|
||||
m := newConsoleModel("127.0.0.1:1", "/nonexistent")
|
||||
m.loaded, m.menu, m.inPanel, m.width, m.height = true, cMonitor, true, 170, 70
|
||||
m.mon.rng = 1
|
||||
step, qs := monitorQueries(time.Hour, (m.monitorWidth()/2-2)*2)
|
||||
res := adminapi.MetricsResult{Configured: true, Series: map[string][]promq.Series{}}
|
||||
for _, q := range qs {
|
||||
s, err := p.RangeQuery(context.Background(), q.Expr, q.By, time.Hour, step)
|
||||
if err != nil {
|
||||
t.Logf("%s: %v", q.ID, err)
|
||||
}
|
||||
res.Series[q.ID] = s
|
||||
}
|
||||
m.mon.res = res
|
||||
m.mon.key = m.monitorKey()
|
||||
_, body, _ := m.monitorPanel(m.monitorWidth())
|
||||
fmt.Println(body)
|
||||
}
|
||||
Reference in new issue
Block a user