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>
40 lines
922 B
Go
40 lines
922 B
Go
//go:build unix
|
|
|
|
package stats
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"syscall"
|
|
)
|
|
|
|
// DiskUsage returns the space on the file systems holding paths (label ->
|
|
// directory), one entry per file system with the labels of the paths on
|
|
// it, in the order of labels.
|
|
func DiskUsage(labels []string, paths map[string]string) []Disk {
|
|
var out []Disk
|
|
byDev := map[string]int{}
|
|
for _, l := range labels {
|
|
p := paths[l]
|
|
fi, err := os.Stat(p)
|
|
if err != nil {
|
|
continue
|
|
}
|
|
dev := fmt.Sprint(p)
|
|
if st, ok := fi.Sys().(*syscall.Stat_t); ok {
|
|
dev = fmt.Sprint(st.Dev)
|
|
}
|
|
if i, ok := byDev[dev]; ok {
|
|
out[i].Holds = append(out[i].Holds, l)
|
|
continue
|
|
}
|
|
var fs syscall.Statfs_t
|
|
if err := syscall.Statfs(p, &fs); err != nil {
|
|
continue
|
|
}
|
|
byDev[dev] = len(out)
|
|
out = append(out, Disk{Path: p, Holds: []string{l}, Total: int64(fs.Blocks) * int64(fs.Bsize), Free: int64(fs.Bavail) * int64(fs.Bsize)})
|
|
}
|
|
return out
|
|
}
|