Just output raw stats json

Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@docker.com> (github: crosbymichael)
This commit is contained in:
Michael Crosby 2014-06-26 16:25:55 -07:00
parent 21b71ef33d
commit 361ac10612
1 changed files with 5 additions and 16 deletions

View File

@ -21,30 +21,19 @@ func statsAction(context *cli.Context) {
log.Fatal(err)
}
runtimeCkpt, err := libcontainer.GetState(dataPath)
state, err := libcontainer.GetState(dataPath)
if err != nil {
log.Fatal(err)
}
stats, err := getStats(container, runtimeCkpt)
if err != nil {
log.Fatalf("Failed to get stats - %v\n", err)
}
fmt.Printf("Stats:\n%v\n", stats)
}
// returns the container stats in json format.
func getStats(container *libcontainer.Config, state *libcontainer.State) (string, error) {
stats, err := libcontainer.GetStats(container, state)
if err != nil {
return "", err
log.Fatal(err)
}
out, err := json.MarshalIndent(stats, "", "\t")
data, err := json.MarshalIndent(stats, "", "\t")
if err != nil {
return "", err
log.Fatal(err)
}
return string(out), nil
fmt.Printf("%s", data)
}