package checks import ( "github.com/mackerelio/go-osstat/memory" ) type MemoryConfig struct { Max float64 `yaml:"max"` } type Memory struct { Config MemoryConfig } func (h Memory) Execute() (ok bool, data interface{}, err error) { memory, err := memory.Get() p := float64(100) / float64(memory.Total) * float64(memory.Used) if p > h.Config.Max { return false, nil, nil } return true, nil,nil } func (h Memory) Name() string { return "Memory usage" }