23 lines
353 B
Go
23 lines
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"
|
||
|
}
|