http-server-status/internal/pkg/checks/load.go

30 lines
388 B
Go
Raw Normal View History

2021-09-20 09:28:00 +00:00
package checks
import (
"github.com/mackerelio/go-osstat/loadavg"
)
type Load struct {
}
func (h Load) Execute() (ok bool, err error) {
load, err := loadavg.Get()
if load.Loadavg1 > 10 {
return false, nil
}
if load.Loadavg5 > 8 {
return false, nil
}
if load.Loadavg1 > 5 {
return false, nil
}
return true, nil
}
func (h Load) Name() string {
return "System Load"
}