http-server-status/internal/pkg/checks/hdd.go
2021-09-20 11:28:00 +02:00

25 lines
No EOL
370 B
Go

package checks
import "github.com/shirou/gopsutil/disk"
type HDD struct {
}
func (h HDD) Execute() (ok bool, err error) {
parts, _ := disk.Partitions(true)
for _, p := range parts {
device := p.Mountpoint
s, _ := disk.Usage(device)
if s.UsedPercent > 80 {
return false, nil
}
}
return true, nil
}
func (h HDD) Name() string {
return "Disc space"
}