Skip to content

Commit

Permalink
stats: add docs
Browse files Browse the repository at this point in the history
Signed-off-by: Akihiro Suda <[email protected]>
  • Loading branch information
AkihiroSuda committed Nov 16, 2021
1 parent 4eac86d commit a9ee8fa
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -939,9 +939,16 @@ Flags:
### :whale: nerdctl stats
Display a live stream of container(s) resource usage statistics.

NOTE: no support for network I/O on cgroup v2 hosts (yet), see issue [#516](https://github.com/containerd/nerdctl/issues/516)

Usage: `nerdctl stats [flags]`

Flags:
- :whale: `-a, --all`: Show all containers (default shows just running)
- :whale: `--format=FORMAT`: Pretty-print images using a Go template, e.g., `{{json .}}`
- :whale: `--no-stream`: Disable streaming stats and only pull the first result
- :whale: `--no-trunc `: Do not truncate output

### :whale: nerdctl top
Display the running processes of a container.

Expand Down
7 changes: 5 additions & 2 deletions cmd/nerdctl/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,12 @@ import (
)

func newStatsCommand() *cobra.Command {
short := "Display a live stream of container(s) resource usage statistics."
long := short + "\nNOTE: no support for network I/O on cgroup v2 hosts (yet), see https://github.com/containerd/nerdctl/issues/516"
var statsCommand = &cobra.Command{
Use: "stats",
Short: "Display a live stream of container(s) resource usage statistics.",
Short: short,
Long: long,
RunE: statsAction,
ValidArgsFunction: statsShellComplete,
SilenceUsage: true,
Expand All @@ -60,7 +63,7 @@ func newStatsCommand() *cobra.Command {

func addStatsFlags(cmd *cobra.Command) {
cmd.Flags().BoolP("all", "a", false, "Show all containers (default shows just running)")
cmd.Flags().String("format", "", "Pretty-print images using a Go template")
cmd.Flags().String("format", "", "Pretty-print images using a Go template, e.g, '{{json .}}'")
cmd.Flags().Bool("no-stream", false, "Disable streaming stats and only pull the first result")
cmd.Flags().Bool("no-trunc", false, "Do not truncate output")
}
Expand Down

0 comments on commit a9ee8fa

Please sign in to comment.