add docker
Some checks failed
CI/CD / Vet, test, build (push) Has been cancelled
CI/CD / Docker image (push) Has been cancelled
CI/CD / Deploy binary to server (push) Has been cancelled

This commit is contained in:
2026-10-23 00:39:04 +05:00
parent 965b00dba5
commit e5f01d0e94
16 changed files with 463 additions and 52 deletions

24
pkg/sysstats/disk_unix.go Normal file
View File

@@ -0,0 +1,24 @@
//go:build unix
package sysstats
import "syscall"
func diskUsage(path string) (Disk, error) {
var st syscall.Statfs_t
if err := syscall.Statfs(path, &st); err != nil {
return Disk{}, err
}
bsize := uint64(st.Bsize)
total := uint64(st.Blocks) * bsize
free := uint64(st.Bavail) * bsize // space available to non-root users
used := total - uint64(st.Bfree)*bsize
return Disk{
Path: path,
TotalBytes: total,
UsedBytes: used,
FreeBytes: free,
UsagePercent: percent(used, used+free),
}, nil
}