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>
24 lines
636 B
Go
24 lines
636 B
Go
package adminapi
|
|
|
|
import (
|
|
"net/http/httptest"
|
|
"testing"
|
|
)
|
|
|
|
func TestNodeExporterTargetsAreTheControlPlaneAndTheStore(t *testing.T) {
|
|
a := &API{}
|
|
a.SetStoreStatus(func() ([]StoreMember, error) {
|
|
return []StoreMember{{Name: "pg01", Host: "10.0.0.149"}, {Name: "ctl", Host: "10.0.0.140"}}, nil
|
|
})
|
|
r := httptest.NewRequest("GET", "http://10.0.0.140:9091/prometheus/targets", nil)
|
|
got := a.nodeExporterTargetsWith(r, nil)
|
|
if len(got) != 2 {
|
|
t.Fatalf("%+v", got)
|
|
}
|
|
for _, g := range got {
|
|
if g.Targets[0] == "10.0.0.140:9100" && g.Labels["role"] != "control-plane" {
|
|
t.Errorf("the control plane twice: %+v", got)
|
|
}
|
|
}
|
|
}
|