2015-01-27 20:54:19 +08:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
|
|
|
|
"github.com/codegangsta/cli"
|
|
|
|
)
|
|
|
|
|
|
|
|
var oomCommand = cli.Command{
|
2015-02-01 12:51:12 +08:00
|
|
|
Name: "oom",
|
|
|
|
Usage: "display oom notifications for a container",
|
|
|
|
Flags: []cli.Flag{
|
|
|
|
cli.StringFlag{Name: "id", Value: "nsinit", Usage: "specify the ID for a container"},
|
|
|
|
},
|
|
|
|
Action: func(context *cli.Context) {
|
|
|
|
container, err := getContainer(context)
|
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
n, err := container.OOM()
|
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
for range n {
|
|
|
|
log.Printf("OOM notification received")
|
|
|
|
}
|
|
|
|
},
|
2015-01-27 20:54:19 +08:00
|
|
|
}
|