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

30 lines
No EOL
388 B
Go

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"
}