Server statistics, multi-view record commands, and rc.3 fixes
Added:
- Server statistics: named's memory and CPU (from /proc), cache size,
sockets and client counts against their limits (statistics channel,
rndc status), host memory and load, and free disk space. Memory and
CPU are kept over time as gauges (sum and sample count, averaged in
timelines). Statistics page Server section, jarl stats server,
GET /stats/server.
- jarl record add|set|delete|disable|enable --view a,b | all: the same
change in each view, applied as one changeset.
- Blocking can be paused until resumed (jarl block pause indefinitely,
"Until I resume", {"indefinitely": true}).
Changed:
- List options (allow-transfer, forwarders, ...) get their braces added
when given without them.
- The dashboard lists named-checkconf's warnings about the running
configuration; the CLI prints them after an apply.
- Stats page: tile and card rows fill their width, and the queries and
failed answers charts share margins so their time axes line up.
- Dashboard: options have their own tile.
- 24-hour times in the web UI.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b097e10bef
commit
7be0762f48
48 files changed
+1346
-128
No files matched your search
@@ -3,6 +3,7 @@ package server
|
||||
import (
|
||||
"net/http"
|
||||
"net/netip"
|
||||
"path/filepath"
|
||||
"slices"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -240,3 +241,34 @@ func clientNames(st *model.State, want map[netip.Addr]bool, readable func(*model
|
||||
}
|
||||
return ptr
|
||||
}
|
||||
|
||||
// statsServer: GET /stats/server is the latest server statistics (named's
|
||||
// memory, CPU, cache and sockets, the host), named's client counts and
|
||||
// limits (rndc status), and the space left on the file systems Jarl and
|
||||
// named write to.
|
||||
func (s *Server) statsServer(w http.ResponseWriter, r *http.Request, p *auth.Principal) error {
|
||||
if _, err := s.statsQuerier(p); err != nil {
|
||||
return err
|
||||
}
|
||||
out := map[string]any{"server": s.cfg.Stats.Server()}
|
||||
if ns, err := s.eng.NamedStatus(r.Context()); err == nil {
|
||||
out["named"] = map[string]string{"recursive_clients": ns.RecursiveClients, "tcp_clients": ns.TCPClients, "zones": ns.Zones,
|
||||
"cpus": ns.CPUs, "worker_threads": ns.WorkerThreads, "last_configured": ns.LastConfigured}
|
||||
} else {
|
||||
out["named_error"] = err.Error()
|
||||
}
|
||||
paths := s.eng.Config().Paths
|
||||
dirs := map[string]string{"zone files": paths.ZoneDir, "Jarl's cache and blocklists": paths.CacheDir, "named.conf": paths.ConfigDir}
|
||||
labels := []string{"zone files", "Jarl's cache and blocklists", "named.conf"}
|
||||
if lf := s.cfg.Stats.Options().LogFile; lf != "" {
|
||||
dirs["named's logs"] = filepath.Dir(lf)
|
||||
labels = append(labels, "named's logs")
|
||||
}
|
||||
if db := s.cfg.Stats.Store().Path(); db != "" {
|
||||
dirs["statistics database"] = filepath.Dir(db)
|
||||
labels = append(labels, "statistics database")
|
||||
}
|
||||
out["disks"] = stats.DiskUsage(labels, dirs)
|
||||
writeJSON(w, http.StatusOK, out)
|
||||
return nil
|
||||
}
|
||||
Reference in new issue
Block a user