package checks import ( "github.com/rs/zerolog/log" "github.com/shirou/gopsutil/disk" ) type HDDConfig struct { MaxPercent int `yaml:"max_percent"` } type HDD struct { Config HDDConfig } func (h HDD) Execute() (ok bool, err error) { parts, _ := disk.Partitions(true) log.Debug().Int("max_percent", h.Config.MaxPercent).Msg("Execute HDD Check") for _, p := range parts { device := p.Mountpoint s, _ := disk.Usage(device) if s.UsedPercent > float64(h.Config.MaxPercent) { return false, nil } } return true, nil } func (h HDD) Name() string { return "Disc space" }