2015-01-27 20:54:19 +08:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
|
|
|
|
"github.com/codegangsta/cli"
|
|
|
|
)
|
|
|
|
|
|
|
|
var oomCommand = cli.Command{
|
|
|
|
Name: "oom",
|
|
|
|
Usage: "display oom notifications for a container",
|
|
|
|
Action: oomAction,
|
|
|
|
}
|
|
|
|
|
|
|
|
func oomAction(context *cli.Context) {
|
2015-02-01 11:56:27 +08:00
|
|
|
factory, err := loadFactory(context)
|
2015-01-27 20:54:19 +08:00
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
2015-02-01 11:56:27 +08:00
|
|
|
container, err := factory.Load("nsinit")
|
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
n, err := container.OOM()
|
2015-01-27 20:54:19 +08:00
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
for range n {
|
|
|
|
log.Printf("OOM notification received")
|
|
|
|
}
|
|
|
|
}
|