Merge mc monitor to mc info (#2838)
This commit is contained in:
committed by
Nitish Tiwari
parent
89d30e9aa2
commit
3acbeda9c2
@@ -17,38 +17,32 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
humanize "github.com/dustin/go-humanize"
|
||||
"github.com/fatih/color"
|
||||
"github.com/minio/cli"
|
||||
json "github.com/minio/mc/pkg/colorjson"
|
||||
"github.com/minio/mc/pkg/console"
|
||||
"github.com/minio/mc/pkg/probe"
|
||||
"github.com/minio/minio/pkg/madmin"
|
||||
)
|
||||
|
||||
var (
|
||||
adminMonitorFlags = []cli.Flag{}
|
||||
)
|
||||
|
||||
const (
|
||||
monitor = "BoldGreen"
|
||||
monitorDegraded = "BoldYellow"
|
||||
monitorFail = "BoldRed"
|
||||
)
|
||||
|
||||
var adminMonitorCmd = cli.Command{
|
||||
Name: "monitor",
|
||||
Usage: "monitor cpu and mem statistics",
|
||||
Action: mainAdminMonitor,
|
||||
Before: setGlobalsFromContext,
|
||||
Flags: append(adminMonitorFlags, globalFlags...),
|
||||
HideHelpCommand: true,
|
||||
CustomHelpTemplate: `Name:
|
||||
var adminInfoCPU = cli.Command{
|
||||
Name: "cpu",
|
||||
Usage: "display MinIO server cpu information",
|
||||
Action: mainAdminCPUInfo,
|
||||
Before: setGlobalsFromContext,
|
||||
Flags: globalFlags,
|
||||
CustomHelpTemplate: `NAME:
|
||||
{{.HelpName}} - {{.Usage}}
|
||||
|
||||
USAGE:
|
||||
@@ -58,20 +52,20 @@ FLAGS:
|
||||
{{range .VisibleFlags}}{{.}}
|
||||
{{end}}
|
||||
EXAMPLES:
|
||||
1. Get server cpu and mem statistics of the 'play' server.
|
||||
$ {{.HelpName}} play/
|
||||
1. Get server CPU information of the 'play' MinIO server.
|
||||
$ {{.HelpName}} play/
|
||||
|
||||
`,
|
||||
}
|
||||
|
||||
// serverMonitorMessage holds service status info along with
|
||||
// cpu, mem, net and disk monitoristics
|
||||
type serverMonitorMessage struct {
|
||||
Monitor string `json:"status"`
|
||||
Service string `json:"service"`
|
||||
Addr string `json:"address"`
|
||||
Err string `json:"error"`
|
||||
CPULoad *madmin.ServerCPULoadInfo `json:"cpu,omitempty"`
|
||||
MemUsage *madmin.ServerMemUsageInfo `json:"mem,omitempty"`
|
||||
Monitor string `json:"status"`
|
||||
Service string `json:"service"`
|
||||
Addr string `json:"address"`
|
||||
Err string `json:"error"`
|
||||
CPULoad *madmin.ServerCPULoadInfo `json:"cpu,omitempty"`
|
||||
}
|
||||
|
||||
func (s serverMonitorMessage) JSON() string {
|
||||
@@ -109,21 +103,11 @@ func (s serverMonitorMessage) String() string {
|
||||
msg += "\n"
|
||||
}
|
||||
|
||||
// Mem section
|
||||
msg += fmt.Sprintf("%s usage\n", console.Colorize(monitor, " MEM"))
|
||||
for i := range s.MemUsage.Usage {
|
||||
msg += fmt.Sprintf(" current %s\n", humanize.IBytes(s.MemUsage.Usage[i].Mem))
|
||||
if len(s.MemUsage.HistoricUsage) > i {
|
||||
msg += fmt.Sprintf(" historic %s\n", humanize.IBytes(s.MemUsage.HistoricUsage[i].Mem))
|
||||
}
|
||||
msg += "\n"
|
||||
}
|
||||
|
||||
return msg
|
||||
}
|
||||
|
||||
func mainAdminMonitor(ctx *cli.Context) error {
|
||||
checkAdminMonitorSyntax(ctx)
|
||||
func mainAdminCPUInfo(ctx *cli.Context) error {
|
||||
checkAdminCPUInfoSyntax(ctx)
|
||||
|
||||
// set the console colors
|
||||
console.SetColor(monitor, color.New(color.FgGreen, color.Bold))
|
||||
@@ -171,17 +155,9 @@ func mainAdminMonitor(ctx *cli.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
sort.Stable(&sortWrapper{cpuLoads: cpuLoads})
|
||||
sort.Stable(&sortCPUWrapper{cpuLoads: cpuLoads})
|
||||
|
||||
memUsages, e := client.ServerMemUsageInfo()
|
||||
if err := processErr(e); err != nil {
|
||||
// exit immediately if error encountered
|
||||
return nil
|
||||
}
|
||||
sort.Stable(&sortWrapper{memUsages: memUsages})
|
||||
|
||||
for i, cpuLoad := range cpuLoads {
|
||||
memUsage := memUsages[i]
|
||||
for _, cpuLoad := range cpuLoads {
|
||||
if cpuLoad.Error != "" {
|
||||
printMsg(serverMonitorMessage{
|
||||
Service: "off",
|
||||
@@ -190,63 +166,44 @@ func mainAdminMonitor(ctx *cli.Context) error {
|
||||
})
|
||||
continue
|
||||
}
|
||||
if memUsage.Error != "" {
|
||||
printMsg(serverMonitorMessage{
|
||||
Service: "off",
|
||||
Addr: memUsage.Addr,
|
||||
Err: memUsage.Error,
|
||||
})
|
||||
continue
|
||||
}
|
||||
|
||||
printMsg(serverMonitorMessage{
|
||||
Service: "on",
|
||||
Addr: cpuLoad.Addr,
|
||||
CPULoad: &cpuLoad,
|
||||
MemUsage: &memUsage,
|
||||
Service: "on",
|
||||
Addr: cpuLoad.Addr,
|
||||
CPULoad: &cpuLoad,
|
||||
})
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type sortWrapper struct {
|
||||
cpuLoads []madmin.ServerCPULoadInfo
|
||||
memUsages []madmin.ServerMemUsageInfo
|
||||
type sortCPUWrapper struct {
|
||||
cpuLoads []madmin.ServerCPULoadInfo
|
||||
}
|
||||
|
||||
func (s *sortWrapper) Len() int {
|
||||
if s.cpuLoads != nil {
|
||||
return len(s.cpuLoads)
|
||||
}
|
||||
return len(s.memUsages)
|
||||
func (s *sortCPUWrapper) Len() int {
|
||||
return len(s.cpuLoads)
|
||||
|
||||
}
|
||||
|
||||
func (s *sortWrapper) Swap(i, j int) {
|
||||
func (s *sortCPUWrapper) Swap(i, j int) {
|
||||
if s.cpuLoads != nil {
|
||||
s.cpuLoads[i], s.cpuLoads[j] = s.cpuLoads[j], s.cpuLoads[i]
|
||||
return
|
||||
}
|
||||
if s.memUsages != nil {
|
||||
s.memUsages[i], s.memUsages[j] = s.memUsages[j], s.memUsages[i]
|
||||
}
|
||||
}
|
||||
|
||||
func (s *sortWrapper) Less(i, j int) bool {
|
||||
func (s *sortCPUWrapper) Less(i, j int) bool {
|
||||
if s.cpuLoads != nil {
|
||||
return strings.Compare(s.cpuLoads[i].Addr, s.cpuLoads[j].Addr) < 0
|
||||
}
|
||||
if s.memUsages != nil {
|
||||
return strings.Compare(s.memUsages[i].Addr, s.memUsages[j].Addr) < 0
|
||||
}
|
||||
return false
|
||||
|
||||
}
|
||||
|
||||
// checkAdminMonitorSyntax - validate all the passed arguments
|
||||
func checkAdminMonitorSyntax(ctx *cli.Context) {
|
||||
func checkAdminCPUInfoSyntax(ctx *cli.Context) {
|
||||
if len(ctx.Args()) == 0 || len(ctx.Args()) > 1 {
|
||||
|
||||
exit := globalErrorExitStatus
|
||||
cli.ShowCommandHelpAndExit(ctx, "monitor", exit)
|
||||
cli.ShowCommandHelpAndExit(ctx, "cpu", exit)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,211 @@
|
||||
/*
|
||||
* MinIO Client (C) 2019 MinIO, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
humanize "github.com/dustin/go-humanize"
|
||||
"github.com/fatih/color"
|
||||
"github.com/minio/cli"
|
||||
"github.com/minio/mc/pkg/console"
|
||||
"github.com/minio/mc/pkg/probe"
|
||||
"github.com/minio/minio/pkg/madmin"
|
||||
)
|
||||
|
||||
const (
|
||||
memory = "BoldGreen"
|
||||
memoryDegraded = "BoldYellow"
|
||||
memoryFail = "BoldRed"
|
||||
)
|
||||
|
||||
var adminInfoMem = cli.Command{
|
||||
Name: "mem",
|
||||
Usage: "display MinIO server memory information",
|
||||
Action: mainAdminMemInfo,
|
||||
Before: setGlobalsFromContext,
|
||||
Flags: globalFlags,
|
||||
CustomHelpTemplate: `NAME:
|
||||
{{.HelpName}} - {{.Usage}}
|
||||
|
||||
USAGE:
|
||||
{{.HelpName}} TARGET
|
||||
|
||||
FLAGS:
|
||||
{{range .VisibleFlags}}{{.}}
|
||||
{{end}}
|
||||
EXAMPLES:
|
||||
1. Get server CPU information of the 'play' MinIO server.
|
||||
$ {{.HelpName}} play/
|
||||
|
||||
`,
|
||||
}
|
||||
|
||||
// serverMonitorMessage holds service status info along with
|
||||
// cpu, mem, net and disk monitoristics
|
||||
type serverMemoryInfo struct {
|
||||
Monitor string `json:"status"`
|
||||
Service string `json:"service"`
|
||||
Addr string `json:"address"`
|
||||
Err string `json:"error"`
|
||||
MemUsage *madmin.ServerMemUsageInfo `json:"mem,omitempty"`
|
||||
}
|
||||
|
||||
func (s serverMemoryInfo) JSON() string {
|
||||
s.Monitor = "success"
|
||||
if s.Err != "" {
|
||||
s.Monitor = "fail"
|
||||
}
|
||||
statusJSONBytes, e := json.MarshalIndent(s, "", " ")
|
||||
fatalIf(probe.NewError(e), "Unable to marshal into JSON")
|
||||
|
||||
return string(statusJSONBytes)
|
||||
}
|
||||
|
||||
func (s serverMemoryInfo) String() string {
|
||||
msg := ""
|
||||
dot := "●"
|
||||
|
||||
if s.Err != "" || s.Service == "off" {
|
||||
msg += fmt.Sprintf("%s %s\n", console.Colorize(memoryFail, dot), s.Addr)
|
||||
msg += fmt.Sprintf(" Server is %s\n", console.Colorize(memoryFail, "offline"))
|
||||
msg += fmt.Sprintf(" Error : %s\n", console.Colorize(memoryFail, s.Err))
|
||||
return msg
|
||||
}
|
||||
|
||||
// Print server title
|
||||
msg += fmt.Sprintf("%s %s \n", console.Colorize(memory, dot), s.Addr)
|
||||
msg += "\n"
|
||||
|
||||
// Mem section
|
||||
msg += fmt.Sprintf("%s usage\n", console.Colorize(memory, " MEM"))
|
||||
for i := range s.MemUsage.Usage {
|
||||
msg += fmt.Sprintf(" current %s\n", humanize.IBytes(s.MemUsage.Usage[i].Mem))
|
||||
if len(s.MemUsage.HistoricUsage) > i {
|
||||
msg += fmt.Sprintf(" historic %s\n", humanize.IBytes(s.MemUsage.HistoricUsage[i].Mem))
|
||||
}
|
||||
msg += "\n"
|
||||
}
|
||||
|
||||
return msg
|
||||
}
|
||||
|
||||
func mainAdminMemInfo(ctx *cli.Context) error {
|
||||
checkAdminMemInfoSyntax(ctx)
|
||||
|
||||
// set the console colors
|
||||
console.SetColor(memory, color.New(color.FgGreen, color.Bold))
|
||||
console.SetColor(memoryDegraded, color.New(color.FgYellow, color.Bold))
|
||||
console.SetColor(memoryFail, color.New(color.FgRed, color.Bold))
|
||||
|
||||
// Get the alias
|
||||
args := ctx.Args()
|
||||
aliasedURL := args.Get(0)
|
||||
|
||||
// Create a new MinIO admin client
|
||||
client, err := newAdminClient(aliasedURL)
|
||||
fatalIf(err, "Cannot get a configured admin connection.")
|
||||
|
||||
printOfflineErrorMessage := func(err error) {
|
||||
errMsg := ""
|
||||
if err != nil {
|
||||
errMsg = err.Error()
|
||||
}
|
||||
printMsg(serverMonitorMessage{
|
||||
Addr: aliasedURL,
|
||||
Service: "off",
|
||||
Err: errMsg,
|
||||
})
|
||||
}
|
||||
|
||||
processErr := func(e error) error {
|
||||
switch e.(type) {
|
||||
case *json.SyntaxError:
|
||||
printOfflineErrorMessage(e)
|
||||
return e
|
||||
case *url.Error:
|
||||
printOfflineErrorMessage(e)
|
||||
return e
|
||||
default:
|
||||
// If the error is not nil and unrecognized, just print it and exit
|
||||
fatalIf(probe.NewError(e), "Cannot get service status.")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
memUsages, e := client.ServerMemUsageInfo()
|
||||
if err := processErr(e); err != nil {
|
||||
// exit immediately if error encountered
|
||||
return nil
|
||||
}
|
||||
sort.Stable(&sortMemWrapper{memUsages: memUsages})
|
||||
|
||||
for _, memUsage := range memUsages {
|
||||
|
||||
if memUsage.Error != "" {
|
||||
printMsg(serverMemoryInfo{
|
||||
Service: "off",
|
||||
Addr: memUsage.Addr,
|
||||
Err: memUsage.Error,
|
||||
})
|
||||
continue
|
||||
}
|
||||
|
||||
printMsg(serverMemoryInfo{
|
||||
Service: "on",
|
||||
Addr: memUsage.Addr,
|
||||
MemUsage: &memUsage,
|
||||
})
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type sortMemWrapper struct {
|
||||
memUsages []madmin.ServerMemUsageInfo
|
||||
}
|
||||
|
||||
func (s *sortMemWrapper) Len() int {
|
||||
return len(s.memUsages)
|
||||
}
|
||||
|
||||
func (s *sortMemWrapper) Swap(i, j int) {
|
||||
if s.memUsages != nil {
|
||||
s.memUsages[i], s.memUsages[j] = s.memUsages[j], s.memUsages[i]
|
||||
}
|
||||
}
|
||||
|
||||
func (s *sortMemWrapper) Less(i, j int) bool {
|
||||
|
||||
if s.memUsages != nil {
|
||||
return strings.Compare(s.memUsages[i].Addr, s.memUsages[j].Addr) < 0
|
||||
}
|
||||
return false
|
||||
|
||||
}
|
||||
|
||||
// checkAdminMonitorSyntax - validate all the passed arguments
|
||||
func checkAdminMemInfoSyntax(ctx *cli.Context) {
|
||||
if len(ctx.Args()) == 0 || len(ctx.Args()) > 1 {
|
||||
|
||||
exit := globalErrorExitStatus
|
||||
cli.ShowCommandHelpAndExit(ctx, "mem", exit)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,370 @@
|
||||
/*
|
||||
* MinIO Client (C) 2016-2019 MinIO, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
humanize "github.com/dustin/go-humanize"
|
||||
"github.com/fatih/color"
|
||||
"github.com/minio/cli"
|
||||
json "github.com/minio/mc/pkg/colorjson"
|
||||
"github.com/minio/mc/pkg/console"
|
||||
"github.com/minio/mc/pkg/probe"
|
||||
"github.com/minio/minio/pkg/madmin"
|
||||
)
|
||||
|
||||
var adminInfoServer = cli.Command{
|
||||
Name: "server",
|
||||
Usage: "display MinIO server information",
|
||||
Action: mainAdminServerInfo,
|
||||
Before: setGlobalsFromContext,
|
||||
Flags: globalFlags,
|
||||
CustomHelpTemplate: `NAME:
|
||||
{{.HelpName}} - {{.Usage}}
|
||||
|
||||
USAGE:
|
||||
{{.HelpName}} TARGET
|
||||
|
||||
FLAGS:
|
||||
{{range .VisibleFlags}}{{.}}
|
||||
{{end}}
|
||||
EXAMPLES:
|
||||
1. Get server information of the 'play' MinIO server.
|
||||
$ {{.HelpName}} play/
|
||||
|
||||
`,
|
||||
}
|
||||
|
||||
// backendType - indicates the type of backend storage
|
||||
type backendType string
|
||||
|
||||
const (
|
||||
fsType = backendType("FS")
|
||||
erasureType = backendType("Erasure")
|
||||
)
|
||||
|
||||
// fsBackend contains specific FS storage information
|
||||
type fsBackend struct {
|
||||
Type backendType `json:"backendType"`
|
||||
}
|
||||
|
||||
// xlBackend contains specific erasure storage information
|
||||
type xlBackend struct {
|
||||
Type backendType `json:"backendType"`
|
||||
OnlineDisks int `json:"onlineDisks"`
|
||||
OfflineDisks int `json:"offlineDisks"`
|
||||
// Data disks for currently configured Standard storage class.
|
||||
StandardSCData int `json:"standardSCData"`
|
||||
// Parity disks for currently configured Standard storage class.
|
||||
StandardSCParity int `json:"standardSCParity"`
|
||||
// Data disks for currently configured Reduced Redundancy storage class.
|
||||
RRSCData int `json:"rrSCData"`
|
||||
// Parity disks for currently configured Reduced Redundancy storage class.
|
||||
RRSCParity int `json:"rrSCParity"`
|
||||
|
||||
// List of all disk status.
|
||||
Sets [][]madmin.DriveInfo `json:"sets"`
|
||||
}
|
||||
|
||||
// backendStatus represents the overall information of all backend storage types
|
||||
type backendStatus struct {
|
||||
Used uint64 `json:"used"`
|
||||
Backend interface{} `json:"backend"`
|
||||
}
|
||||
|
||||
// ServerInfo holds the whole server information that will be
|
||||
// returned by ServerInfo API.
|
||||
type ServerInfo struct {
|
||||
StorageInfo backendStatus `json:"storage"`
|
||||
ConnStats madmin.ServerConnStats `json:"network"`
|
||||
Properties madmin.ServerProperties `json:"server"`
|
||||
CPULoad madmin.ServerCPULoadInfo `json:"cpu,omitempty"`
|
||||
MemUsage madmin.ServerMemUsageInfo `json:"mem,omitempty"`
|
||||
}
|
||||
|
||||
// infoMessage container to hold service status information.
|
||||
type infoMessage struct {
|
||||
Status string `json:"status"`
|
||||
Service string `json:"service"`
|
||||
Addr string `json:"address"`
|
||||
Err string `json:"error"`
|
||||
*ServerInfo
|
||||
}
|
||||
|
||||
// String colorized service status message.
|
||||
func (u infoMessage) String() (msg string) {
|
||||
dot := "●"
|
||||
|
||||
// When service is offline
|
||||
if u.Service == "off" {
|
||||
msg += fmt.Sprintf("%s %s\n", console.Colorize("InfoFail", dot), console.Colorize("PrintB", u.Addr))
|
||||
msg += fmt.Sprintf(" Uptime: %s\n", console.Colorize("InfoFail", "offline"))
|
||||
return
|
||||
}
|
||||
|
||||
// Print error if any and exit
|
||||
if u.Err != "" {
|
||||
msg += fmt.Sprintf("%s %s\n", console.Colorize("InfoFail", dot), console.Colorize("PrintB", u.Addr))
|
||||
msg += fmt.Sprintf(" Uptime: %s\n", console.Colorize("InfoFail", "offline"))
|
||||
e := u.Err
|
||||
if strings.Trim(e, " ") == "rpc: retry error" {
|
||||
e = "unreachable"
|
||||
}
|
||||
msg += fmt.Sprintf(" Error: %s", console.Colorize("InfoFail", e))
|
||||
return
|
||||
}
|
||||
|
||||
// Print server title
|
||||
msg += fmt.Sprintf("%s %s\n", console.Colorize("Info", dot), console.Colorize("PrintB", u.Addr))
|
||||
|
||||
// Uptime
|
||||
msg += fmt.Sprintf(" Uptime: %s\n", console.Colorize("Info",
|
||||
humanize.RelTime(time.Now(), time.Now().Add(-u.ServerInfo.Properties.Uptime), "", "")))
|
||||
|
||||
// Version
|
||||
version := u.ServerInfo.Properties.Version
|
||||
if u.ServerInfo.Properties.Version == "DEVELOPMENT.GOGET" {
|
||||
version = "<development>"
|
||||
}
|
||||
msg += fmt.Sprintf(" Version: %s\n", version)
|
||||
// Region
|
||||
if u.ServerInfo.Properties.Region != "" {
|
||||
msg += fmt.Sprintf(" Region: %s\n", u.ServerInfo.Properties.Region)
|
||||
}
|
||||
// ARNs
|
||||
sqsARNs := ""
|
||||
for _, v := range u.ServerInfo.Properties.SQSARN {
|
||||
sqsARNs += fmt.Sprintf("%s ", v)
|
||||
}
|
||||
if sqsARNs != "" {
|
||||
msg += fmt.Sprintf(" SQS ARNs: %s\n", sqsARNs)
|
||||
}
|
||||
|
||||
// Incoming/outgoing
|
||||
msg += fmt.Sprintf(" Storage: Used %s", humanize.IBytes(u.StorageInfo.Used))
|
||||
if v, ok := u.ServerInfo.StorageInfo.Backend.(xlBackend); ok {
|
||||
upBackends := 0
|
||||
downBackends := 0
|
||||
for _, set := range v.Sets {
|
||||
for _, s := range set {
|
||||
if strings.Contains(s.Endpoint, u.Addr) || s.Endpoint[0] == '/' || s.Endpoint[0] == '.' {
|
||||
if s.State == "ok" {
|
||||
upBackends++
|
||||
} else {
|
||||
downBackends++
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
upBackendsString := fmt.Sprintf("%d", upBackends)
|
||||
if downBackends != 0 {
|
||||
upBackendsString = console.Colorize("InfoFail", fmt.Sprintf("%d", upBackends))
|
||||
}
|
||||
msg += fmt.Sprintf("\n Drives: %s/%d %s\n", upBackendsString,
|
||||
upBackends+downBackends, console.Colorize("Info", "OK"))
|
||||
msg += "\n"
|
||||
|
||||
//CPU section
|
||||
msg += fmt.Sprintf("%s min avg max\n", console.Colorize("Info", " CPU"))
|
||||
for i := range u.CPULoad.Load {
|
||||
msg += fmt.Sprintf(" current %.2f%% %.2f%% %.2f%%\n", u.CPULoad.Load[i].Min, u.CPULoad.Load[i].Avg, u.CPULoad.Load[i].Max)
|
||||
if len(u.CPULoad.HistoricLoad) > i {
|
||||
msg += fmt.Sprintf(" historic %.2f%% %.2f%% %.2f%%\n", u.CPULoad.HistoricLoad[i].Min, u.CPULoad.HistoricLoad[i].Avg, u.CPULoad.HistoricLoad[i].Max)
|
||||
}
|
||||
msg += "\n"
|
||||
}
|
||||
|
||||
// Mem section
|
||||
msg += fmt.Sprintf("%s usage\n", console.Colorize("Info", " MEM"))
|
||||
for i := range u.MemUsage.Usage {
|
||||
msg += fmt.Sprintf(" current %s\n", humanize.IBytes(u.MemUsage.Usage[i].Mem))
|
||||
if len(u.MemUsage.HistoricUsage) > i {
|
||||
msg += fmt.Sprintf(" historic %s\n", humanize.IBytes(u.MemUsage.HistoricUsage[i].Mem))
|
||||
}
|
||||
msg += "\n"
|
||||
}
|
||||
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// JSON jsonified service status message.
|
||||
func (u infoMessage) JSON() string {
|
||||
u.Status = "success"
|
||||
statusJSONBytes, e := json.MarshalIndent(u, "", " ")
|
||||
fatalIf(probe.NewError(e), "Unable to marshal into JSON.")
|
||||
|
||||
return string(statusJSONBytes)
|
||||
}
|
||||
|
||||
// checkAdminInfoSyntax - validate all the passed arguments
|
||||
func checkAdminServerInfoSyntax(ctx *cli.Context) {
|
||||
if len(ctx.Args()) == 0 || len(ctx.Args()) > 2 {
|
||||
cli.ShowCommandHelpAndExit(ctx, "server", 1) // last argument is exit code
|
||||
}
|
||||
}
|
||||
|
||||
func mainAdminServerInfo(ctx *cli.Context) error {
|
||||
checkAdminServerInfoSyntax(ctx)
|
||||
|
||||
console.SetColor("Info", color.New(color.FgGreen, color.Bold))
|
||||
console.SetColor("InfoDegraded", color.New(color.FgYellow, color.Bold))
|
||||
console.SetColor("InfoFail", color.New(color.FgRed, color.Bold))
|
||||
|
||||
// Get the alias parameter from cli
|
||||
args := ctx.Args()
|
||||
aliasedURL := args.Get(0)
|
||||
|
||||
// Create a new MinIO Admin Client
|
||||
client, err := newAdminClient(aliasedURL)
|
||||
fatalIf(err, "Cannot get a configured admin connection.")
|
||||
|
||||
printOfflineErrorMessage := func(err error) {
|
||||
errMsg := ""
|
||||
if err != nil {
|
||||
errMsg = err.Error()
|
||||
}
|
||||
printMsg(infoMessage{
|
||||
Addr: aliasedURL,
|
||||
Service: "off",
|
||||
Err: errMsg,
|
||||
})
|
||||
}
|
||||
|
||||
processErr := func(e error) error {
|
||||
switch e.(type) {
|
||||
case *json.SyntaxError:
|
||||
printOfflineErrorMessage(e)
|
||||
return e
|
||||
case *url.Error:
|
||||
printOfflineErrorMessage(e)
|
||||
return e
|
||||
default:
|
||||
// If the error is not nil and unrecognized, just print it and exit
|
||||
fatalIf(probe.NewError(e), "Cannot get service status.")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Fetch info of all servers (cluster or single server)
|
||||
serversInfo, e := client.ServerInfo()
|
||||
if err := processErr(e); err != nil {
|
||||
// exit immediately if error encountered
|
||||
return nil
|
||||
}
|
||||
// Fetch info of all CPU loads (all MinIO server instances)
|
||||
cpuLoads, e := client.ServerCPULoadInfo()
|
||||
|
||||
if err := processErr(e); err != nil {
|
||||
// exit immediately if error encountered
|
||||
return nil
|
||||
}
|
||||
memUsages, e := client.ServerMemUsageInfo()
|
||||
if err := processErr(e); err != nil {
|
||||
// exit immediately if error encountered
|
||||
return nil
|
||||
}
|
||||
|
||||
infoMessages := []infoMessage{}
|
||||
|
||||
for i, serverInfo := range serversInfo {
|
||||
cpuLoad := cpuLoads[i]
|
||||
memUsage := memUsages[i]
|
||||
|
||||
// Print the error if exists and jump to the next server
|
||||
if serverInfo.Error != "" {
|
||||
|
||||
infoMessages = append(infoMessages, infoMessage{
|
||||
Service: "on",
|
||||
Addr: serverInfo.Addr,
|
||||
Err: serverInfo.Error,
|
||||
})
|
||||
continue
|
||||
}
|
||||
|
||||
// Construct the backend status
|
||||
storageInfo := backendStatus{
|
||||
Used: serverInfo.Data.StorageInfo.Used,
|
||||
}
|
||||
|
||||
if serverInfo.Data.StorageInfo.Backend.Type == madmin.Erasure {
|
||||
storageInfo.Backend = xlBackend{
|
||||
Type: erasureType,
|
||||
OnlineDisks: serverInfo.Data.StorageInfo.Backend.OnlineDisks,
|
||||
OfflineDisks: serverInfo.Data.StorageInfo.Backend.OfflineDisks,
|
||||
StandardSCData: serverInfo.Data.StorageInfo.Backend.StandardSCData,
|
||||
StandardSCParity: serverInfo.Data.StorageInfo.Backend.StandardSCParity,
|
||||
RRSCData: serverInfo.Data.StorageInfo.Backend.RRSCData,
|
||||
RRSCParity: serverInfo.Data.StorageInfo.Backend.RRSCParity,
|
||||
Sets: serverInfo.Data.StorageInfo.Backend.Sets,
|
||||
}
|
||||
} else {
|
||||
storageInfo.Backend = fsBackend{
|
||||
Type: fsType,
|
||||
}
|
||||
}
|
||||
|
||||
infoMessages = append(infoMessages, (infoMessage{
|
||||
Service: "on",
|
||||
Addr: serverInfo.Addr,
|
||||
Err: serverInfo.Error,
|
||||
ServerInfo: &ServerInfo{
|
||||
StorageInfo: storageInfo,
|
||||
ConnStats: serverInfo.Data.ConnStats,
|
||||
Properties: serverInfo.Data.Properties,
|
||||
CPULoad: cpuLoad,
|
||||
MemUsage: memUsage,
|
||||
},
|
||||
}))
|
||||
|
||||
}
|
||||
|
||||
sort.Stable(&sortInfoWrapper{infoMessages})
|
||||
|
||||
for _, s := range infoMessages {
|
||||
printMsg(s)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type sortInfoWrapper struct {
|
||||
infos []infoMessage
|
||||
}
|
||||
|
||||
func (s *sortInfoWrapper) Len() int {
|
||||
return len(s.infos)
|
||||
}
|
||||
|
||||
func (s *sortInfoWrapper) Swap(i, j int) {
|
||||
if s.infos != nil {
|
||||
s.infos[i], s.infos[j] = s.infos[j], s.infos[i]
|
||||
}
|
||||
}
|
||||
|
||||
func (s *sortInfoWrapper) Less(i, j int) bool {
|
||||
if s.infos != nil {
|
||||
return s.infos[i].Addr < s.infos[j].Addr
|
||||
}
|
||||
return false
|
||||
|
||||
}
|
||||
+12
-290
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* MinIO Client (C) 2016-2019 MinIO, Inc.
|
||||
* MinIO Client (C) 2019 MinIO, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,303 +16,25 @@
|
||||
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
humanize "github.com/dustin/go-humanize"
|
||||
"github.com/fatih/color"
|
||||
"github.com/minio/cli"
|
||||
json "github.com/minio/mc/pkg/colorjson"
|
||||
"github.com/minio/mc/pkg/console"
|
||||
"github.com/minio/mc/pkg/probe"
|
||||
"github.com/minio/minio/pkg/madmin"
|
||||
)
|
||||
|
||||
var (
|
||||
adminInfoFlags = []cli.Flag{}
|
||||
)
|
||||
import "github.com/minio/cli"
|
||||
|
||||
var adminInfoCmd = cli.Command{
|
||||
Name: "info",
|
||||
Usage: "display MinIO server information",
|
||||
Action: mainAdminInfo,
|
||||
Before: setGlobalsFromContext,
|
||||
Flags: append(adminInfoFlags, globalFlags...),
|
||||
CustomHelpTemplate: `NAME:
|
||||
{{.HelpName}} - {{.Usage}}
|
||||
|
||||
USAGE:
|
||||
{{.HelpName}} TARGET
|
||||
|
||||
FLAGS:
|
||||
{{range .VisibleFlags}}{{.}}
|
||||
{{end}}
|
||||
EXAMPLES:
|
||||
1. Get server information of the 'play' MinIO server.
|
||||
$ {{.HelpName}} play/
|
||||
|
||||
`,
|
||||
}
|
||||
|
||||
// backendType - indicates the type of backend storage
|
||||
type backendType string
|
||||
|
||||
const (
|
||||
fsType = backendType("FS")
|
||||
erasureType = backendType("Erasure")
|
||||
)
|
||||
|
||||
// fsBackend contains specific FS storage information
|
||||
type fsBackend struct {
|
||||
Type backendType `json:"backendType"`
|
||||
}
|
||||
|
||||
// xlBackend contains specific erasure storage information
|
||||
type xlBackend struct {
|
||||
Type backendType `json:"backendType"`
|
||||
OnlineDisks int `json:"onlineDisks"`
|
||||
OfflineDisks int `json:"offlineDisks"`
|
||||
// Data disks for currently configured Standard storage class.
|
||||
StandardSCData int `json:"standardSCData"`
|
||||
// Parity disks for currently configured Standard storage class.
|
||||
StandardSCParity int `json:"standardSCParity"`
|
||||
// Data disks for currently configured Reduced Redundancy storage class.
|
||||
RRSCData int `json:"rrSCData"`
|
||||
// Parity disks for currently configured Reduced Redundancy storage class.
|
||||
RRSCParity int `json:"rrSCParity"`
|
||||
|
||||
// List of all disk status.
|
||||
Sets [][]madmin.DriveInfo `json:"sets"`
|
||||
}
|
||||
|
||||
// backendStatus represents the overall information of all backend storage types
|
||||
type backendStatus struct {
|
||||
Used uint64 `json:"used"`
|
||||
Backend interface{} `json:"backend"`
|
||||
}
|
||||
|
||||
// ServerInfo holds the whole server information that will be
|
||||
// returned by ServerInfo API.
|
||||
type ServerInfo struct {
|
||||
StorageInfo backendStatus `json:"storage"`
|
||||
ConnStats madmin.ServerConnStats `json:"network"`
|
||||
Properties madmin.ServerProperties `json:"server"`
|
||||
}
|
||||
|
||||
// infoMessage container to hold service status information.
|
||||
type infoMessage struct {
|
||||
Status string `json:"status"`
|
||||
Service string `json:"service"`
|
||||
Addr string `json:"address"`
|
||||
Err string `json:"error"`
|
||||
*ServerInfo
|
||||
}
|
||||
|
||||
// String colorized service status message.
|
||||
func (u infoMessage) String() (msg string) {
|
||||
dot := "●"
|
||||
|
||||
// When service is offline
|
||||
if u.Service == "off" {
|
||||
msg += fmt.Sprintf("%s %s\n", console.Colorize("InfoFail", dot), console.Colorize("PrintB", u.Addr))
|
||||
msg += fmt.Sprintf(" Uptime: %s\n", console.Colorize("InfoFail", "offline"))
|
||||
return
|
||||
}
|
||||
|
||||
// Print error if any and exit
|
||||
if u.Err != "" {
|
||||
msg += fmt.Sprintf("%s %s\n", console.Colorize("InfoFail", dot), console.Colorize("PrintB", u.Addr))
|
||||
msg += fmt.Sprintf(" Uptime: %s\n", console.Colorize("InfoFail", "offline"))
|
||||
e := u.Err
|
||||
if strings.Trim(e, " ") == "rpc: retry error" {
|
||||
e = "unreachable"
|
||||
}
|
||||
msg += fmt.Sprintf(" Error: %s", console.Colorize("InfoFail", e))
|
||||
return
|
||||
}
|
||||
|
||||
// Print server title
|
||||
msg += fmt.Sprintf("%s %s\n", console.Colorize("Info", dot), console.Colorize("PrintB", u.Addr))
|
||||
|
||||
// Uptime
|
||||
msg += fmt.Sprintf(" Uptime: %s\n", console.Colorize("Info",
|
||||
humanize.RelTime(time.Now(), time.Now().Add(-u.ServerInfo.Properties.Uptime), "", "")))
|
||||
|
||||
// Version
|
||||
version := u.ServerInfo.Properties.Version
|
||||
if u.ServerInfo.Properties.Version == "DEVELOPMENT.GOGET" {
|
||||
version = "<development>"
|
||||
}
|
||||
msg += fmt.Sprintf(" Version: %s\n", version)
|
||||
// Region
|
||||
if u.ServerInfo.Properties.Region != "" {
|
||||
msg += fmt.Sprintf(" Region: %s\n", u.ServerInfo.Properties.Region)
|
||||
}
|
||||
// ARNs
|
||||
sqsARNs := ""
|
||||
for _, v := range u.ServerInfo.Properties.SQSARN {
|
||||
sqsARNs += fmt.Sprintf("%s ", v)
|
||||
}
|
||||
if sqsARNs != "" {
|
||||
msg += fmt.Sprintf(" SQS ARNs: %s\n", sqsARNs)
|
||||
}
|
||||
|
||||
// Incoming/outgoing
|
||||
msg += fmt.Sprintf(" Storage: Used %s", humanize.IBytes(u.StorageInfo.Used))
|
||||
if v, ok := u.ServerInfo.StorageInfo.Backend.(xlBackend); ok {
|
||||
upBackends := 0
|
||||
downBackends := 0
|
||||
for _, set := range v.Sets {
|
||||
for _, s := range set {
|
||||
if strings.Contains(s.Endpoint, u.Addr) || s.Endpoint[0] == '/' || s.Endpoint[0] == '.' {
|
||||
if s.State == "ok" {
|
||||
upBackends++
|
||||
} else {
|
||||
downBackends++
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
upBackendsString := fmt.Sprintf("%d", upBackends)
|
||||
if downBackends != 0 {
|
||||
upBackendsString = console.Colorize("InfoFail", fmt.Sprintf("%d", upBackends))
|
||||
}
|
||||
msg += fmt.Sprintf("\n Drives: %s/%d %s\n", upBackendsString,
|
||||
upBackends+downBackends, console.Colorize("Info", "OK"))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// JSON jsonified service status Message message.
|
||||
func (u infoMessage) JSON() string {
|
||||
u.Status = "success"
|
||||
statusJSONBytes, e := json.MarshalIndent(u, "", " ")
|
||||
fatalIf(probe.NewError(e), "Unable to marshal into JSON.")
|
||||
|
||||
return string(statusJSONBytes)
|
||||
}
|
||||
|
||||
// checkAdminInfoSyntax - validate all the passed arguments
|
||||
func checkAdminInfoSyntax(ctx *cli.Context) {
|
||||
if len(ctx.Args()) == 0 || len(ctx.Args()) > 2 {
|
||||
cli.ShowCommandHelpAndExit(ctx, "info", 1) // last argument is exit code
|
||||
}
|
||||
Flags: globalFlags,
|
||||
Subcommands: []cli.Command{
|
||||
adminInfoServer,
|
||||
adminInfoCPU,
|
||||
adminInfoMem,
|
||||
},
|
||||
HideHelpCommand: true,
|
||||
}
|
||||
|
||||
// mainAdminConfig is the handle for "mc admin config" command.
|
||||
func mainAdminInfo(ctx *cli.Context) error {
|
||||
// Validate service status syntax.
|
||||
checkAdminInfoSyntax(ctx)
|
||||
|
||||
console.SetColor("Info", color.New(color.FgGreen, color.Bold))
|
||||
console.SetColor("InfoDegraded", color.New(color.FgYellow, color.Bold))
|
||||
console.SetColor("InfoFail", color.New(color.FgRed, color.Bold))
|
||||
|
||||
// Get the alias parameter from cli
|
||||
args := ctx.Args()
|
||||
aliasedURL := args.Get(0)
|
||||
|
||||
// Create a new MinIO Admin Client
|
||||
client, err := newAdminClient(aliasedURL)
|
||||
fatalIf(err, "Cannot get a configured admin connection.")
|
||||
|
||||
// Fetch info of all servers (cluster or single server)
|
||||
serversInfo, e := client.ServerInfo()
|
||||
|
||||
// Check the availability of the server: online or offline. A server is considered
|
||||
// offline if we can't get any response or we get a bad format response
|
||||
var serviceOffline bool
|
||||
switch e.(type) {
|
||||
case *json.SyntaxError:
|
||||
serviceOffline = true
|
||||
case *url.Error:
|
||||
serviceOffline = true
|
||||
}
|
||||
|
||||
if serviceOffline {
|
||||
printMsg(infoMessage{Addr: aliasedURL, Service: "off"})
|
||||
return nil
|
||||
}
|
||||
|
||||
// If the error is not nil and not unrecognizable, just print it and exit
|
||||
fatalIf(probe.NewError(e), "Cannot get service status.")
|
||||
|
||||
infoMessages := []infoMessage{}
|
||||
for _, serverInfo := range serversInfo {
|
||||
// Print the error if exists and jump to the next server
|
||||
if serverInfo.Error != "" {
|
||||
infoMessages = append(infoMessages, infoMessage{
|
||||
Service: "on",
|
||||
Addr: serverInfo.Addr,
|
||||
Err: serverInfo.Error,
|
||||
})
|
||||
continue
|
||||
}
|
||||
|
||||
// Construct the backend status
|
||||
storageInfo := backendStatus{
|
||||
Used: serverInfo.Data.StorageInfo.Used,
|
||||
}
|
||||
|
||||
if serverInfo.Data.StorageInfo.Backend.Type == madmin.Erasure {
|
||||
storageInfo.Backend = xlBackend{
|
||||
Type: erasureType,
|
||||
OnlineDisks: serverInfo.Data.StorageInfo.Backend.OnlineDisks,
|
||||
OfflineDisks: serverInfo.Data.StorageInfo.Backend.OfflineDisks,
|
||||
StandardSCData: serverInfo.Data.StorageInfo.Backend.StandardSCData,
|
||||
StandardSCParity: serverInfo.Data.StorageInfo.Backend.StandardSCParity,
|
||||
RRSCData: serverInfo.Data.StorageInfo.Backend.RRSCData,
|
||||
RRSCParity: serverInfo.Data.StorageInfo.Backend.RRSCParity,
|
||||
Sets: serverInfo.Data.StorageInfo.Backend.Sets,
|
||||
}
|
||||
} else {
|
||||
storageInfo.Backend = fsBackend{
|
||||
Type: fsType,
|
||||
}
|
||||
}
|
||||
|
||||
infoMessages = append(infoMessages, (infoMessage{
|
||||
Service: "on",
|
||||
Addr: serverInfo.Addr,
|
||||
Err: serverInfo.Error,
|
||||
ServerInfo: &ServerInfo{
|
||||
StorageInfo: storageInfo,
|
||||
ConnStats: serverInfo.Data.ConnStats,
|
||||
Properties: serverInfo.Data.Properties,
|
||||
},
|
||||
}))
|
||||
|
||||
}
|
||||
|
||||
sort.Stable(&sortInfoWrapper{infoMessages})
|
||||
for _, s := range infoMessages {
|
||||
printMsg(s)
|
||||
}
|
||||
|
||||
cli.ShowCommandHelp(ctx, ctx.Args().First())
|
||||
return nil
|
||||
}
|
||||
|
||||
type sortInfoWrapper struct {
|
||||
infos []infoMessage
|
||||
}
|
||||
|
||||
func (s *sortInfoWrapper) Len() int {
|
||||
return len(s.infos)
|
||||
}
|
||||
|
||||
func (s *sortInfoWrapper) Swap(i, j int) {
|
||||
if s.infos != nil {
|
||||
s.infos[i], s.infos[j] = s.infos[j], s.infos[i]
|
||||
}
|
||||
}
|
||||
|
||||
func (s *sortInfoWrapper) Less(i, j int) bool {
|
||||
if s.infos != nil {
|
||||
return s.infos[i].Addr < s.infos[j].Addr
|
||||
}
|
||||
return false
|
||||
|
||||
// Sub-commands like "server", "cpu", "mem" have their own main.
|
||||
}
|
||||
|
||||
@@ -39,7 +39,6 @@ var adminCmd = cli.Command{
|
||||
adminHealCmd,
|
||||
adminProfileCmd,
|
||||
adminTopCmd,
|
||||
adminMonitorCmd,
|
||||
adminTraceCmd,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -16,13 +16,13 @@ top provide top like statistics for MinIO
|
||||
### Docker Stable
|
||||
```
|
||||
docker pull minio/mc
|
||||
docker run minio/mc admin info play
|
||||
docker run minio/mc admin info server play
|
||||
```
|
||||
|
||||
### Docker Edge
|
||||
```
|
||||
docker pull minio/mc:edge
|
||||
docker run minio/mc:edge admin info play
|
||||
docker run minio/mc:edge admin info server play
|
||||
```
|
||||
|
||||
### Homebrew (macOS)
|
||||
@@ -108,7 +108,7 @@ mc config host add minio http://192.168.1.51:9000 BKIKJAA5BMMU2RHO6IBB V7f1CwQqA
|
||||
Get MinIO server information for the configured alias `minio`
|
||||
|
||||
```
|
||||
mc admin info minio
|
||||
mc admin info server minio
|
||||
|
||||
● 192.168.1.51:9000
|
||||
Uptime : online since 1 day ago
|
||||
@@ -117,6 +117,15 @@ mc admin info minio
|
||||
SQS ARNs : <none>
|
||||
Stats : Incoming 82GiB, Outgoing 28GiB
|
||||
Storage : Used 7.4GiB
|
||||
|
||||
CPU min avg max
|
||||
current 0.12% 0.14% 0.17%
|
||||
historic 0.03% 1.27% 412.18%
|
||||
|
||||
MEM usage
|
||||
current 602 MiB
|
||||
historic 448 MiB
|
||||
|
||||
```
|
||||
|
||||
## 5. Everyday Use
|
||||
@@ -135,7 +144,7 @@ Debug option enables debug output to console.
|
||||
*Example: Display verbose debug output for `info` command.*
|
||||
|
||||
```
|
||||
mc admin --debug info minio
|
||||
mc admin --debug info server minio
|
||||
mc: <DEBUG> GET /minio/admin/v1/info HTTP/1.1
|
||||
Host: 192.168.1.51:9000
|
||||
User-Agent: MinIO (linux; amd64) madmin-go/0.0.1 mc/2018-05-23T23:43:34Z
|
||||
@@ -164,6 +173,14 @@ mc: <DEBUG> Response Time: 140.70112ms
|
||||
SQS ARNs : <none>
|
||||
Stats : Incoming 82GiB, Outgoing 28GiB
|
||||
Storage : Used 7.4GiB
|
||||
|
||||
CPU min avg max
|
||||
current 0.12% 0.14% 0.17%
|
||||
historic 0.03% 1.27% 412.18%
|
||||
|
||||
MEM usage
|
||||
current 602 MiB
|
||||
historic 448 MiB
|
||||
```
|
||||
|
||||
### Option [--json]
|
||||
@@ -172,7 +189,7 @@ JSON option enables parseable output in [JSON lines](http://jsonlines.org/) form
|
||||
*Example: MinIO server information.*
|
||||
|
||||
```
|
||||
mc admin --json info minio
|
||||
mc admin --json info server minio
|
||||
{
|
||||
"status": "success",
|
||||
"service": "on",
|
||||
@@ -195,6 +212,36 @@ mc admin --json info minio
|
||||
"region": "",
|
||||
"sqsARN": []
|
||||
}
|
||||
"cpu": {
|
||||
"addr": "play.minio.io:9000",
|
||||
"load": [
|
||||
{
|
||||
"avg": 0.11,
|
||||
"max": 0.13,
|
||||
"min": 0.09
|
||||
}
|
||||
],
|
||||
"historicLoad": [
|
||||
{
|
||||
"avg": 1.270331023187104,
|
||||
"max": 412.18000000000006,
|
||||
"min": 0.03
|
||||
}
|
||||
]
|
||||
},
|
||||
"mem": {
|
||||
"addr": "play.minio.io:9000",
|
||||
"usage": [
|
||||
{
|
||||
"mem": 631800056
|
||||
}
|
||||
],
|
||||
"historicUsage": [
|
||||
{
|
||||
"mem": 469437357
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user