30 lines
388 B
Go
30 lines
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"
|
||
|
}
|