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

23 lines
No EOL
353 B
Go

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