package checks import ( "github.com/shirou/gopsutil/disk" ) type HDDConfig struct { MaxPercent int `yaml:"max_percent"` Enabled bool `yaml:"enabled"` } type HDD struct { Config HDDConfig } func (h HDD) Execute() (ok bool, data interface{}, err error) { if h.Config.Enabled == false { return true, nil, nil } success := true parts, _ := disk.Partitions(false) usage := make(map[string]float64) for _, p := range parts { device := p.Mountpoint s, _ := disk.Usage(device) usage[device] = s.UsedPercent if s.UsedPercent > float64(h.Config.MaxPercent) { success = false //return false, parts,nil } } return success, usage,nil } func (h HDD) Name() string { return "DiscSpace" }