mirror of
https://github.com/aljazceru/kata-containers.git
synced 2025-12-24 01:24:26 +01:00
Move all command line code to `cmd` and move containerd-shim-v2 to pkg. Fixes: #2627 Signed-off-by: Peng Tao <bergwolf@hyper.sh>
39 lines
815 B
Go
39 lines
815 B
Go
// Copyright (c) 2021 Apple Inc.
|
|
//
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
//
|
|
|
|
package main
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
kataMonitor "github.com/kata-containers/kata-containers/src/runtime/pkg/kata-monitor"
|
|
"github.com/kata-containers/kata-containers/src/runtime/pkg/katautils"
|
|
"github.com/urfave/cli"
|
|
)
|
|
|
|
var kataMetricsCLICommand = cli.Command{
|
|
Name: "metrics",
|
|
Usage: "gather metrics associated with infrastructure used to run a sandbox",
|
|
UsageText: "metrics <sandbox id>",
|
|
Action: func(context *cli.Context) error {
|
|
|
|
sandboxID := context.Args().Get(0)
|
|
|
|
if err := katautils.VerifyContainerID(sandboxID); err != nil {
|
|
return err
|
|
}
|
|
|
|
// Get the metrics!
|
|
metrics, err := kataMonitor.GetSandboxMetrics(sandboxID)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
fmt.Printf("%s\n", metrics)
|
|
|
|
return nil
|
|
},
|
|
}
|