From 7bc47a14cc9005f31a03942227c2519b62378b52 Mon Sep 17 00:00:00 2001 From: Shireesh Anjal <355479+anjalshireesh@users.noreply.github.com> Date: Sat, 21 Nov 2020 02:22:53 +0530 Subject: [PATCH] Rename OBD to Health (#10842) Also, Remove thread stats and openfds from the health report as we already have process stats and numfds --- cmd/admin-handlers.go | 130 +++++----- cmd/admin-router.go | 7 +- cmd/{obdinfo.go => healthinfo.go} | 66 ++--- cmd/{obdinfo_linux.go => healthinfo_linux.go} | 20 +- ...nfo_nonlinux.go => healthinfo_nonlinux.go} | 8 +- cmd/notification.go | 126 +++++----- cmd/peer-rest-client.go | 58 ++--- cmd/peer-rest-common.go | 18 +- cmd/peer-rest-server.go | 70 +++--- docs/debugging/README.md | 8 +- docs/zh_CN/debugging/README.md | 6 +- pkg/disk/{obd.go => health.go} | 4 +- pkg/iam/policy/admin-action.go | 8 +- pkg/iam/policy/constants.go | 2 +- pkg/madmin/{obd.go => health.go} | 234 +++++++++--------- pkg/madmin/{obd_linux.go => health_linux.go} | 4 +- .../{obd_nonlinux.go => health_nonlinux.go} | 4 +- pkg/net/{obd.go => health.go} | 4 +- 18 files changed, 383 insertions(+), 394 deletions(-) rename cmd/{obdinfo.go => healthinfo.go} (80%) rename cmd/{obdinfo_linux.go => healthinfo_linux.go} (86%) rename cmd/{obdinfo_nonlinux.go => healthinfo_nonlinux.go} (80%) rename pkg/disk/{obd.go => health.go} (97%) rename pkg/madmin/{obd.go => health.go} (51%) rename pkg/madmin/{obd_linux.go => health_linux.go} (92%) rename pkg/madmin/{obd_nonlinux.go => health_nonlinux.go} (86%) rename pkg/net/{obd.go => health.go} (95%) diff --git a/cmd/admin-handlers.go b/cmd/admin-handlers.go index d7fe3f3f6..6a9a0d081 100644 --- a/cmd/admin-handlers.go +++ b/cmd/admin-handlers.go @@ -1235,26 +1235,26 @@ func (a adminAPIHandlers) KMSKeyStatusHandler(w http.ResponseWriter, r *http.Req writeSuccessResponseJSON(w, resp) } -// OBDInfoHandler - GET /minio/admin/v3/obdinfo +// HealthInfoHandler - GET /minio/admin/v3/healthinfo // ---------- -// Get server on-board diagnostics -func (a adminAPIHandlers) OBDInfoHandler(w http.ResponseWriter, r *http.Request) { - ctx := newContext(r, w, "OBDInfo") +// Get server health info +func (a adminAPIHandlers) HealthInfoHandler(w http.ResponseWriter, r *http.Request) { + ctx := newContext(r, w, "HealthInfo") - defer logger.AuditLog(w, r, "OBDInfo", mustGetClaimsFromToken(r)) + defer logger.AuditLog(w, r, "HealthInfo", mustGetClaimsFromToken(r)) - objectAPI, _ := validateAdminReq(ctx, w, r, iampolicy.OBDInfoAdminAction) + objectAPI, _ := validateAdminReq(ctx, w, r, iampolicy.HealthInfoAdminAction) if objectAPI == nil { return } query := r.URL.Query() - obdInfo := madmin.OBDInfo{} - obdInfoCh := make(chan madmin.OBDInfo) + healthInfo := madmin.HealthInfo{} + healthInfoCh := make(chan madmin.HealthInfo) enc := json.NewEncoder(w) - partialWrite := func(oinfo madmin.OBDInfo) { - obdInfoCh <- oinfo + partialWrite := func(oinfo madmin.HealthInfo) { + healthInfoCh <- oinfo } setCommonHeaders(w) @@ -1267,8 +1267,8 @@ func (a adminAPIHandlers) OBDInfoHandler(w http.ResponseWriter, r *http.Request) errorResponse := getAPIErrorResponse(ctx, toAdminAPIErr(ctx, err), r.URL.String(), w.Header().Get(xhttp.AmzRequestID), globalDeploymentID) encodedErrorResponse := encodeResponse(errorResponse) - obdInfo.Error = string(encodedErrorResponse) - logger.LogIf(ctx, enc.Encode(obdInfo)) + healthInfo.Error = string(encodedErrorResponse) + logger.LogIf(ctx, enc.Encode(healthInfo)) } deadline := 3600 * time.Second @@ -1284,7 +1284,7 @@ func (a adminAPIHandlers) OBDInfoHandler(w http.ResponseWriter, r *http.Request) deadlinedCtx, cancel := context.WithTimeout(ctx, deadline) defer cancel() - nsLock := objectAPI.NewNSLock(minioMetaBucket, "obd-in-progress") + nsLock := objectAPI.NewNSLock(minioMetaBucket, "health-check-in-progress") if err := nsLock.GetLock(ctx, newDynamicTimeout(deadline, deadline)); err != nil { // returns a locked lock errResp(err) return @@ -1292,99 +1292,99 @@ func (a adminAPIHandlers) OBDInfoHandler(w http.ResponseWriter, r *http.Request) defer nsLock.Unlock() go func() { - defer close(obdInfoCh) + defer close(healthInfoCh) if cpu := query.Get("syscpu"); cpu == "true" { - cpuInfo := getLocalCPUOBDInfo(deadlinedCtx, r) + cpuInfo := getLocalCPUInfo(deadlinedCtx, r) - obdInfo.Sys.CPUInfo = append(obdInfo.Sys.CPUInfo, cpuInfo) - obdInfo.Sys.CPUInfo = append(obdInfo.Sys.CPUInfo, globalNotificationSys.CPUOBDInfo(deadlinedCtx)...) - partialWrite(obdInfo) + healthInfo.Sys.CPUInfo = append(healthInfo.Sys.CPUInfo, cpuInfo) + healthInfo.Sys.CPUInfo = append(healthInfo.Sys.CPUInfo, globalNotificationSys.CPUInfo(deadlinedCtx)...) + partialWrite(healthInfo) } if diskHw := query.Get("sysdiskhw"); diskHw == "true" { - diskHwInfo := getLocalDiskHwOBD(deadlinedCtx, r) + diskHwInfo := getLocalDiskHwInfo(deadlinedCtx, r) - obdInfo.Sys.DiskHwInfo = append(obdInfo.Sys.DiskHwInfo, diskHwInfo) - obdInfo.Sys.DiskHwInfo = append(obdInfo.Sys.DiskHwInfo, globalNotificationSys.DiskHwOBDInfo(deadlinedCtx)...) - partialWrite(obdInfo) + healthInfo.Sys.DiskHwInfo = append(healthInfo.Sys.DiskHwInfo, diskHwInfo) + healthInfo.Sys.DiskHwInfo = append(healthInfo.Sys.DiskHwInfo, globalNotificationSys.DiskHwInfo(deadlinedCtx)...) + partialWrite(healthInfo) } if osInfo := query.Get("sysosinfo"); osInfo == "true" { - osInfo := getLocalOsInfoOBD(deadlinedCtx, r) + osInfo := getLocalOsInfo(deadlinedCtx, r) - obdInfo.Sys.OsInfo = append(obdInfo.Sys.OsInfo, osInfo) - obdInfo.Sys.OsInfo = append(obdInfo.Sys.OsInfo, globalNotificationSys.OsOBDInfo(deadlinedCtx)...) - partialWrite(obdInfo) + healthInfo.Sys.OsInfo = append(healthInfo.Sys.OsInfo, osInfo) + healthInfo.Sys.OsInfo = append(healthInfo.Sys.OsInfo, globalNotificationSys.OsInfo(deadlinedCtx)...) + partialWrite(healthInfo) } if mem := query.Get("sysmem"); mem == "true" { - memInfo := getLocalMemOBD(deadlinedCtx, r) + memInfo := getLocalMemInfo(deadlinedCtx, r) - obdInfo.Sys.MemInfo = append(obdInfo.Sys.MemInfo, memInfo) - obdInfo.Sys.MemInfo = append(obdInfo.Sys.MemInfo, globalNotificationSys.MemOBDInfo(deadlinedCtx)...) - partialWrite(obdInfo) + healthInfo.Sys.MemInfo = append(healthInfo.Sys.MemInfo, memInfo) + healthInfo.Sys.MemInfo = append(healthInfo.Sys.MemInfo, globalNotificationSys.MemInfo(deadlinedCtx)...) + partialWrite(healthInfo) } if proc := query.Get("sysprocess"); proc == "true" { - procInfo := getLocalProcOBD(deadlinedCtx, r) + procInfo := getLocalProcInfo(deadlinedCtx, r) - obdInfo.Sys.ProcInfo = append(obdInfo.Sys.ProcInfo, procInfo) - obdInfo.Sys.ProcInfo = append(obdInfo.Sys.ProcInfo, globalNotificationSys.ProcOBDInfo(deadlinedCtx)...) - partialWrite(obdInfo) + healthInfo.Sys.ProcInfo = append(healthInfo.Sys.ProcInfo, procInfo) + healthInfo.Sys.ProcInfo = append(healthInfo.Sys.ProcInfo, globalNotificationSys.ProcInfo(deadlinedCtx)...) + partialWrite(healthInfo) } if config := query.Get("minioconfig"); config == "true" { cfg, err := readServerConfig(ctx, objectAPI) logger.LogIf(ctx, err) - obdInfo.Minio.Config = cfg - partialWrite(obdInfo) + healthInfo.Minio.Config = cfg + partialWrite(healthInfo) } if drive := query.Get("perfdrive"); drive == "true" { - // Get drive obd details from local server's drive(s) - driveOBDSerial := getLocalDrivesOBD(deadlinedCtx, false, globalEndpoints, r) - driveOBDParallel := getLocalDrivesOBD(deadlinedCtx, true, globalEndpoints, r) + // Get drive perf details from local server's drive(s) + drivePerfSerial := getLocalDrives(deadlinedCtx, false, globalEndpoints, r) + drivePerfParallel := getLocalDrives(deadlinedCtx, true, globalEndpoints, r) errStr := "" - if driveOBDSerial.Error != "" { - errStr = "serial: " + driveOBDSerial.Error + if drivePerfSerial.Error != "" { + errStr = "serial: " + drivePerfSerial.Error } - if driveOBDParallel.Error != "" { - errStr = errStr + " parallel: " + driveOBDParallel.Error + if drivePerfParallel.Error != "" { + errStr = errStr + " parallel: " + drivePerfParallel.Error } - driveOBD := madmin.ServerDrivesOBDInfo{ - Addr: driveOBDSerial.Addr, - Serial: driveOBDSerial.Serial, - Parallel: driveOBDParallel.Parallel, + driveInfo := madmin.ServerDrivesInfo{ + Addr: drivePerfSerial.Addr, + Serial: drivePerfSerial.Serial, + Parallel: drivePerfParallel.Parallel, Error: errStr, } - obdInfo.Perf.DriveInfo = append(obdInfo.Perf.DriveInfo, driveOBD) - partialWrite(obdInfo) + healthInfo.Perf.DriveInfo = append(healthInfo.Perf.DriveInfo, driveInfo) + partialWrite(healthInfo) - // Notify all other MinIO peers to report drive obd numbers - driveOBDs := globalNotificationSys.DriveOBDInfoChan(deadlinedCtx) - for obd := range driveOBDs { - obdInfo.Perf.DriveInfo = append(obdInfo.Perf.DriveInfo, obd) - partialWrite(obdInfo) + // Notify all other MinIO peers to report drive perf numbers + driveInfos := globalNotificationSys.DrivePerfInfoChan(deadlinedCtx) + for obd := range driveInfos { + healthInfo.Perf.DriveInfo = append(healthInfo.Perf.DriveInfo, obd) + partialWrite(healthInfo) } - partialWrite(obdInfo) + partialWrite(healthInfo) } if net := query.Get("perfnet"); net == "true" && globalIsDistErasure { - obdInfo.Perf.Net = append(obdInfo.Perf.Net, globalNotificationSys.NetOBDInfo(deadlinedCtx)) - partialWrite(obdInfo) + healthInfo.Perf.Net = append(healthInfo.Perf.Net, globalNotificationSys.NetInfo(deadlinedCtx)) + partialWrite(healthInfo) - netOBDs := globalNotificationSys.DispatchNetOBDChan(deadlinedCtx) - for obd := range netOBDs { - obdInfo.Perf.Net = append(obdInfo.Perf.Net, obd) - partialWrite(obdInfo) + netInfos := globalNotificationSys.DispatchNetPerfChan(deadlinedCtx) + for netInfo := range netInfos { + healthInfo.Perf.Net = append(healthInfo.Perf.Net, netInfo) + partialWrite(healthInfo) } - partialWrite(obdInfo) + partialWrite(healthInfo) - obdInfo.Perf.NetParallel = globalNotificationSys.NetOBDParallelInfo(deadlinedCtx) - partialWrite(obdInfo) + healthInfo.Perf.NetParallel = globalNotificationSys.NetPerfParallelInfo(deadlinedCtx) + partialWrite(healthInfo) } }() @@ -1394,7 +1394,7 @@ func (a adminAPIHandlers) OBDInfoHandler(w http.ResponseWriter, r *http.Request) for { select { - case oinfo, ok := <-obdInfoCh: + case oinfo, ok := <-healthInfoCh: if !ok { return } diff --git a/cmd/admin-router.go b/cmd/admin-router.go index 8865c6b93..1383cc13f 100644 --- a/cmd/admin-router.go +++ b/cmd/admin-router.go @@ -211,9 +211,12 @@ func registerAdminRouter(router *mux.Router, enableConfigOps, enableIAMOps bool) adminRouter.Methods(http.MethodGet).Path(adminVersion + "/kms/key/status").HandlerFunc(httpTraceAll(adminAPI.KMSKeyStatusHandler)) if !globalIsGateway { - // -- OBD API -- + // Keep obdinfo for backward compatibility with mc adminRouter.Methods(http.MethodGet).Path(adminVersion + "/obdinfo"). - HandlerFunc(httpTraceHdrs(adminAPI.OBDInfoHandler)) + HandlerFunc(httpTraceHdrs(adminAPI.HealthInfoHandler)) + // -- Health API -- + adminRouter.Methods(http.MethodGet).Path(adminVersion + "/healthinfo"). + HandlerFunc(httpTraceHdrs(adminAPI.HealthInfoHandler)) adminRouter.Methods(http.MethodGet).Path(adminVersion + "/bandwidth"). HandlerFunc(httpTraceHdrs(adminAPI.BandwidthMonitorHandler)) } diff --git a/cmd/obdinfo.go b/cmd/healthinfo.go similarity index 80% rename from cmd/obdinfo.go rename to cmd/healthinfo.go index 6245a9bbb..2f4195ba0 100644 --- a/cmd/obdinfo.go +++ b/cmd/healthinfo.go @@ -31,7 +31,7 @@ import ( "github.com/shirou/gopsutil/process" ) -func getLocalCPUOBDInfo(ctx context.Context, r *http.Request) madmin.ServerCPUOBDInfo { +func getLocalCPUInfo(ctx context.Context, r *http.Request) madmin.ServerCPUInfo { addr := r.Host if globalIsDistErasure { addr = GetLocalPeer(globalEndpoints) @@ -39,7 +39,7 @@ func getLocalCPUOBDInfo(ctx context.Context, r *http.Request) madmin.ServerCPUOB info, err := cpuhw.InfoWithContext(ctx) if err != nil { - return madmin.ServerCPUOBDInfo{ + return madmin.ServerCPUInfo{ Addr: addr, Error: err.Error(), } @@ -47,13 +47,13 @@ func getLocalCPUOBDInfo(ctx context.Context, r *http.Request) madmin.ServerCPUOB time, err := cpuhw.TimesWithContext(ctx, false) if err != nil { - return madmin.ServerCPUOBDInfo{ + return madmin.ServerCPUInfo{ Addr: addr, Error: err.Error(), } } - return madmin.ServerCPUOBDInfo{ + return madmin.ServerCPUInfo{ Addr: addr, CPUStat: info, TimeStat: time, @@ -61,8 +61,8 @@ func getLocalCPUOBDInfo(ctx context.Context, r *http.Request) madmin.ServerCPUOB } -func getLocalDrivesOBD(ctx context.Context, parallel bool, endpointServerSets EndpointServerSets, r *http.Request) madmin.ServerDrivesOBDInfo { - var drivesOBDInfo []madmin.DriveOBDInfo +func getLocalDrives(ctx context.Context, parallel bool, endpointServerSets EndpointServerSets, r *http.Request) madmin.ServerDrivesInfo { + var drivesPerfInfo []madmin.DrivePerfInfo var wg sync.WaitGroup for _, ep := range endpointServerSets { for _, endpoint := range ep.Endpoints { @@ -70,7 +70,7 @@ func getLocalDrivesOBD(ctx context.Context, parallel bool, endpointServerSets En if endpoint.IsLocal { if _, err := os.Stat(endpoint.Path); err != nil { // Since this drive is not available, add relevant details and proceed - drivesOBDInfo = append(drivesOBDInfo, madmin.DriveOBDInfo{ + drivesPerfInfo = append(drivesPerfInfo, madmin.DrivePerfInfo{ Path: endpoint.Path, Error: err.Error(), }) @@ -79,17 +79,17 @@ func getLocalDrivesOBD(ctx context.Context, parallel bool, endpointServerSets En measurePath := pathJoin(minioMetaTmpBucket, mustGetUUID()) measure := func(path string) { defer wg.Done() - driveOBDInfo := madmin.DriveOBDInfo{ + driveInfo := madmin.DrivePerfInfo{ Path: path, } - latency, throughput, err := disk.GetOBDInfo(ctx, path, pathJoin(path, measurePath)) + latency, throughput, err := disk.GetHealthInfo(ctx, path, pathJoin(path, measurePath)) if err != nil { - driveOBDInfo.Error = err.Error() + driveInfo.Error = err.Error() } else { - driveOBDInfo.Latency = latency - driveOBDInfo.Throughput = throughput + driveInfo.Latency = latency + driveInfo.Throughput = throughput } - drivesOBDInfo = append(drivesOBDInfo, driveOBDInfo) + drivesPerfInfo = append(drivesPerfInfo, driveInfo) } wg.Add(1) @@ -108,18 +108,18 @@ func getLocalDrivesOBD(ctx context.Context, parallel bool, endpointServerSets En addr = GetLocalPeer(endpointServerSets) } if parallel { - return madmin.ServerDrivesOBDInfo{ + return madmin.ServerDrivesInfo{ Addr: addr, - Parallel: drivesOBDInfo, + Parallel: drivesPerfInfo, } } - return madmin.ServerDrivesOBDInfo{ + return madmin.ServerDrivesInfo{ Addr: addr, - Serial: drivesOBDInfo, + Serial: drivesPerfInfo, } } -func getLocalMemOBD(ctx context.Context, r *http.Request) madmin.ServerMemOBDInfo { +func getLocalMemInfo(ctx context.Context, r *http.Request) madmin.ServerMemInfo { addr := r.Host if globalIsDistErasure { addr = GetLocalPeer(globalEndpoints) @@ -127,7 +127,7 @@ func getLocalMemOBD(ctx context.Context, r *http.Request) madmin.ServerMemOBDInf swap, err := memhw.SwapMemoryWithContext(ctx) if err != nil { - return madmin.ServerMemOBDInfo{ + return madmin.ServerMemInfo{ Addr: addr, Error: err.Error(), } @@ -135,27 +135,27 @@ func getLocalMemOBD(ctx context.Context, r *http.Request) madmin.ServerMemOBDInf vm, err := memhw.VirtualMemoryWithContext(ctx) if err != nil { - return madmin.ServerMemOBDInfo{ + return madmin.ServerMemInfo{ Addr: addr, Error: err.Error(), } } - return madmin.ServerMemOBDInfo{ + return madmin.ServerMemInfo{ Addr: addr, SwapMem: swap, VirtualMem: vm, } } -func getLocalProcOBD(ctx context.Context, r *http.Request) madmin.ServerProcOBDInfo { +func getLocalProcInfo(ctx context.Context, r *http.Request) madmin.ServerProcInfo { addr := r.Host if globalIsDistErasure { addr = GetLocalPeer(globalEndpoints) } - errProcInfo := func(err error) madmin.ServerProcOBDInfo { - return madmin.ServerProcOBDInfo{ + errProcInfo := func(err error) madmin.ServerProcInfo { + return madmin.ServerProcInfo{ Addr: addr, Error: err.Error(), } @@ -172,9 +172,9 @@ func getLocalProcOBD(ctx context.Context, r *http.Request) madmin.ServerProcOBDI return errProcInfo(err) } - sysProcs := []madmin.SysOBDProcess{} + sysProcs := []madmin.SysProcess{} for _, proc := range processes { - sysProc := madmin.SysOBDProcess{} + sysProc := madmin.SysProcess{} sysProc.Pid = proc.Pid bg, err := proc.BackgroundWithContext(ctx) @@ -296,12 +296,6 @@ func getLocalProcOBD(ctx context.Context, r *http.Request) madmin.ServerProcOBDI } sysProc.NumThreads = numThreads - openFiles, err := proc.OpenFilesWithContext(ctx) - if err != nil { - return errProcInfo(err) - } - sysProc.OpenFiles = openFiles - pageFaults, err := proc.PageFaultsWithContext(ctx) if err != nil { return errProcInfo(err) @@ -336,12 +330,6 @@ func getLocalProcOBD(ctx context.Context, r *http.Request) madmin.ServerProcOBDI } sysProc.Tgid = tgid - threads, err := proc.ThreadsWithContext(ctx) - if err != nil { - return errProcInfo(err) - } - sysProc.Threads = threads - times, err := proc.TimesWithContext(ctx) if err != nil { return errProcInfo(err) @@ -363,7 +351,7 @@ func getLocalProcOBD(ctx context.Context, r *http.Request) madmin.ServerProcOBDI sysProcs = append(sysProcs, sysProc) } - return madmin.ServerProcOBDInfo{ + return madmin.ServerProcInfo{ Addr: addr, Processes: sysProcs, } diff --git a/cmd/obdinfo_linux.go b/cmd/healthinfo_linux.go similarity index 86% rename from cmd/obdinfo_linux.go rename to cmd/healthinfo_linux.go index 4fbb903d2..eb9e73459 100644 --- a/cmd/obdinfo_linux.go +++ b/cmd/healthinfo_linux.go @@ -31,7 +31,7 @@ import ( "github.com/shirou/gopsutil/host" ) -func getLocalOsInfoOBD(ctx context.Context, r *http.Request) madmin.ServerOsOBDInfo { +func getLocalOsInfo(ctx context.Context, r *http.Request) madmin.ServerOsInfo { addr := r.Host if globalIsDistErasure { addr = GetLocalPeer(globalEndpoints) @@ -39,7 +39,7 @@ func getLocalOsInfoOBD(ctx context.Context, r *http.Request) madmin.ServerOsOBDI info, err := host.InfoWithContext(ctx) if err != nil { - return madmin.ServerOsOBDInfo{ + return madmin.ServerOsInfo{ Addr: addr, Error: err.Error(), } @@ -47,7 +47,7 @@ func getLocalOsInfoOBD(ctx context.Context, r *http.Request) madmin.ServerOsOBDI sensors, err := host.SensorsTemperaturesWithContext(ctx) if err != nil { - return madmin.ServerOsOBDInfo{ + return madmin.ServerOsInfo{ Addr: addr, Error: err.Error(), } @@ -56,7 +56,7 @@ func getLocalOsInfoOBD(ctx context.Context, r *http.Request) madmin.ServerOsOBDI // ignore user err, as it cannot be obtained reliably inside containers users, _ := host.UsersWithContext(ctx) - return madmin.ServerOsOBDInfo{ + return madmin.ServerOsInfo{ Addr: addr, Info: info, Sensors: sensors, @@ -64,7 +64,7 @@ func getLocalOsInfoOBD(ctx context.Context, r *http.Request) madmin.ServerOsOBDI } } -func getLocalDiskHwOBD(ctx context.Context, r *http.Request) madmin.ServerDiskHwOBDInfo { +func getLocalDiskHwInfo(ctx context.Context, r *http.Request) madmin.ServerDiskHwInfo { addr := r.Host if globalIsDistErasure { addr = GetLocalPeer(globalEndpoints) @@ -72,7 +72,7 @@ func getLocalDiskHwOBD(ctx context.Context, r *http.Request) madmin.ServerDiskHw parts, err := diskhw.PartitionsWithContext(ctx, true) if err != nil { - return madmin.ServerDiskHwOBDInfo{ + return madmin.ServerDiskHwInfo{ Addr: addr, Error: err.Error(), } @@ -101,7 +101,7 @@ func getLocalDiskHwOBD(ctx context.Context, r *http.Request) madmin.ServerDiskHw if syscall.EACCES == err { smartInfo.Error = err.Error() } else { - return madmin.ServerDiskHwOBDInfo{ + return madmin.ServerDiskHwInfo{ Addr: addr, Error: err.Error(), } @@ -120,7 +120,7 @@ func getLocalDiskHwOBD(ctx context.Context, r *http.Request) madmin.ServerDiskHw ioCounters, err := diskhw.IOCountersWithContext(ctx, drives...) if err != nil { - return madmin.ServerDiskHwOBDInfo{ + return madmin.ServerDiskHwInfo{ Addr: addr, Error: err.Error(), } @@ -129,7 +129,7 @@ func getLocalDiskHwOBD(ctx context.Context, r *http.Request) madmin.ServerDiskHw for _, path := range paths { usage, err := diskhw.UsageWithContext(ctx, path) if err != nil { - return madmin.ServerDiskHwOBDInfo{ + return madmin.ServerDiskHwInfo{ Addr: addr, Error: err.Error(), } @@ -137,7 +137,7 @@ func getLocalDiskHwOBD(ctx context.Context, r *http.Request) madmin.ServerDiskHw usages = append(usages, usage) } - return madmin.ServerDiskHwOBDInfo{ + return madmin.ServerDiskHwInfo{ Addr: addr, Usage: usages, Partitions: partitions, diff --git a/cmd/obdinfo_nonlinux.go b/cmd/healthinfo_nonlinux.go similarity index 80% rename from cmd/obdinfo_nonlinux.go rename to cmd/healthinfo_nonlinux.go index 9d8577a6a..b144008c6 100644 --- a/cmd/obdinfo_nonlinux.go +++ b/cmd/healthinfo_nonlinux.go @@ -27,25 +27,25 @@ import ( "github.com/minio/minio/pkg/madmin" ) -func getLocalDiskHwOBD(ctx context.Context, r *http.Request) madmin.ServerDiskHwOBDInfo { +func getLocalDiskHwInfo(ctx context.Context, r *http.Request) madmin.ServerDiskHwInfo { addr := r.Host if globalIsDistErasure { addr = GetLocalPeer(globalEndpoints) } - return madmin.ServerDiskHwOBDInfo{ + return madmin.ServerDiskHwInfo{ Addr: addr, Error: "unsupported platform: " + runtime.GOOS, } } -func getLocalOsInfoOBD(ctx context.Context, r *http.Request) madmin.ServerOsOBDInfo { +func getLocalOsInfo(ctx context.Context, r *http.Request) madmin.ServerOsInfo { addr := r.Host if globalIsDistErasure { addr = GetLocalPeer(globalEndpoints) } - return madmin.ServerOsOBDInfo{ + return madmin.ServerOsInfo{ Addr: addr, Error: "unsupported platform: " + runtime.GOOS, } diff --git a/cmd/notification.go b/cmd/notification.go index dfabe3e47..b47ebc393 100644 --- a/cmd/notification.go +++ b/cmd/notification.go @@ -847,13 +847,13 @@ func (sys *NotificationSys) Send(args eventArgs) { sys.targetList.Send(args.ToEvent(true), targetIDSet, sys.targetResCh) } -// NetOBDInfo - Net OBD information -func (sys *NotificationSys) NetOBDInfo(ctx context.Context) madmin.ServerNetOBDInfo { +// NetInfo - Net information +func (sys *NotificationSys) NetInfo(ctx context.Context) madmin.ServerNetHealthInfo { var sortedGlobalEndpoints []string /* Ensure that only untraversed links are visited by this server - i.e. if netOBD tests have been performed between a -> b, then do + i.e. if net perf tests have been performed between a -> b, then do not run it between b -> a The graph of tests looks like this @@ -905,51 +905,51 @@ func (sys *NotificationSys) NetOBDInfo(ctx context.Context) madmin.ServerNetOBDI } } - netOBDs := make([]madmin.NetOBDInfo, len(remoteTargets)) + netInfos := make([]madmin.NetPerfInfo, len(remoteTargets)) for index, client := range remoteTargets { if client == nil { continue } var err error - netOBDs[index], err = client.NetOBDInfo(ctx) + netInfos[index], err = client.NetInfo(ctx) addr := client.host.String() reqInfo := (&logger.ReqInfo{}).AppendTags("remotePeer", addr) ctx := logger.SetReqInfo(GlobalContext, reqInfo) logger.LogIf(ctx, err) - netOBDs[index].Addr = addr + netInfos[index].Addr = addr if err != nil { - netOBDs[index].Error = err.Error() + netInfos[index].Error = err.Error() } } - return madmin.ServerNetOBDInfo{ - Net: netOBDs, + return madmin.ServerNetHealthInfo{ + Net: netInfos, Addr: GetLocalPeer(globalEndpoints), } } -// DispatchNetOBDInfo - Net OBD information from other nodes -func (sys *NotificationSys) DispatchNetOBDInfo(ctx context.Context) []madmin.ServerNetOBDInfo { - serverNetOBDs := []madmin.ServerNetOBDInfo{} +// DispatchNetPerfInfo - Net perf information from other nodes +func (sys *NotificationSys) DispatchNetPerfInfo(ctx context.Context) []madmin.ServerNetHealthInfo { + serverNetInfos := []madmin.ServerNetHealthInfo{} for index, client := range sys.peerClients { if client == nil { continue } - serverNetOBD, err := sys.peerClients[index].DispatchNetOBDInfo(ctx) + serverNetInfo, err := sys.peerClients[index].DispatchNetInfo(ctx) if err != nil { - serverNetOBD.Addr = client.host.String() - serverNetOBD.Error = err.Error() + serverNetInfo.Addr = client.host.String() + serverNetInfo.Error = err.Error() } - serverNetOBDs = append(serverNetOBDs, serverNetOBD) + serverNetInfos = append(serverNetInfos, serverNetInfo) } - return serverNetOBDs + return serverNetInfos } -// DispatchNetOBDChan - Net OBD information from other nodes -func (sys *NotificationSys) DispatchNetOBDChan(ctx context.Context) chan madmin.ServerNetOBDInfo { - serverNetOBDs := make(chan madmin.ServerNetOBDInfo) +// DispatchNetPerfChan - Net perf information from other nodes +func (sys *NotificationSys) DispatchNetPerfChan(ctx context.Context) chan madmin.ServerNetHealthInfo { + serverNetInfos := make(chan madmin.ServerNetHealthInfo) wg := sync.WaitGroup{} wg.Add(1) @@ -958,27 +958,27 @@ func (sys *NotificationSys) DispatchNetOBDChan(ctx context.Context) chan madmin. if client == nil { continue } - serverNetOBD, err := client.DispatchNetOBDInfo(ctx) + serverNetInfo, err := client.DispatchNetInfo(ctx) if err != nil { - serverNetOBD.Addr = client.host.String() - serverNetOBD.Error = err.Error() + serverNetInfo.Addr = client.host.String() + serverNetInfo.Error = err.Error() } - serverNetOBDs <- serverNetOBD + serverNetInfos <- serverNetInfo } wg.Done() }() go func() { wg.Wait() - close(serverNetOBDs) + close(serverNetInfos) }() - return serverNetOBDs + return serverNetInfos } -// NetOBDParallelInfo - Performs NetOBD tests -func (sys *NotificationSys) NetOBDParallelInfo(ctx context.Context) madmin.ServerNetOBDInfo { - netOBDs := []madmin.NetOBDInfo{} +// NetPerfParallelInfo - Performs Net parallel tests +func (sys *NotificationSys) NetPerfParallelInfo(ctx context.Context) madmin.ServerNetHealthInfo { + netInfos := []madmin.NetPerfInfo{} wg := sync.WaitGroup{} for index, client := range sys.peerClients { @@ -988,26 +988,26 @@ func (sys *NotificationSys) NetOBDParallelInfo(ctx context.Context) madmin.Serve wg.Add(1) go func(index int) { - netOBD, err := sys.peerClients[index].NetOBDInfo(ctx) - netOBD.Addr = sys.peerClients[index].host.String() + netInfo, err := sys.peerClients[index].NetInfo(ctx) + netInfo.Addr = sys.peerClients[index].host.String() if err != nil { - netOBD.Error = err.Error() + netInfo.Error = err.Error() } - netOBDs = append(netOBDs, netOBD) + netInfos = append(netInfos, netInfo) wg.Done() }(index) } wg.Wait() - return madmin.ServerNetOBDInfo{ - Net: netOBDs, + return madmin.ServerNetHealthInfo{ + Net: netInfos, Addr: GetLocalPeer(globalEndpoints), } } -// DriveOBDInfo - Drive OBD information -func (sys *NotificationSys) DriveOBDInfo(ctx context.Context) []madmin.ServerDrivesOBDInfo { - reply := make([]madmin.ServerDrivesOBDInfo, len(sys.peerClients)) +// DrivePerfInfo - Drive perf information +func (sys *NotificationSys) DrivePerfInfo(ctx context.Context) []madmin.ServerDrivesInfo { + reply := make([]madmin.ServerDrivesInfo, len(sys.peerClients)) g := errgroup.WithNErrs(len(sys.peerClients)) for index, client := range sys.peerClients { @@ -1017,7 +1017,7 @@ func (sys *NotificationSys) DriveOBDInfo(ctx context.Context) []madmin.ServerDri index := index g.Go(func() error { var err error - reply[index], err = sys.peerClients[index].DriveOBDInfo(ctx) + reply[index], err = sys.peerClients[index].DriveInfo(ctx) return err }, index) } @@ -1035,9 +1035,9 @@ func (sys *NotificationSys) DriveOBDInfo(ctx context.Context) []madmin.ServerDri return reply } -// DriveOBDInfoChan - Drive OBD information -func (sys *NotificationSys) DriveOBDInfoChan(ctx context.Context) chan madmin.ServerDrivesOBDInfo { - updateChan := make(chan madmin.ServerDrivesOBDInfo) +// DrivePerfInfoChan - Drive perf information +func (sys *NotificationSys) DrivePerfInfoChan(ctx context.Context) chan madmin.ServerDrivesInfo { + updateChan := make(chan madmin.ServerDrivesInfo) wg := sync.WaitGroup{} for _, client := range sys.peerClients { @@ -1046,7 +1046,7 @@ func (sys *NotificationSys) DriveOBDInfoChan(ctx context.Context) chan madmin.Se } wg.Add(1) go func(client *peerRESTClient) { - reply, err := client.DriveOBDInfo(ctx) + reply, err := client.DriveInfo(ctx) addr := client.host.String() reqInfo := (&logger.ReqInfo{}).AppendTags("remotePeer", addr) @@ -1071,9 +1071,9 @@ func (sys *NotificationSys) DriveOBDInfoChan(ctx context.Context) chan madmin.Se return updateChan } -// CPUOBDInfo - CPU OBD information -func (sys *NotificationSys) CPUOBDInfo(ctx context.Context) []madmin.ServerCPUOBDInfo { - reply := make([]madmin.ServerCPUOBDInfo, len(sys.peerClients)) +// CPUInfo - CPU information +func (sys *NotificationSys) CPUInfo(ctx context.Context) []madmin.ServerCPUInfo { + reply := make([]madmin.ServerCPUInfo, len(sys.peerClients)) g := errgroup.WithNErrs(len(sys.peerClients)) for index, client := range sys.peerClients { @@ -1083,7 +1083,7 @@ func (sys *NotificationSys) CPUOBDInfo(ctx context.Context) []madmin.ServerCPUOB index := index g.Go(func() error { var err error - reply[index], err = sys.peerClients[index].CPUOBDInfo(ctx) + reply[index], err = sys.peerClients[index].CPUInfo(ctx) return err }, index) } @@ -1101,9 +1101,9 @@ func (sys *NotificationSys) CPUOBDInfo(ctx context.Context) []madmin.ServerCPUOB return reply } -// DiskHwOBDInfo - Disk HW OBD information -func (sys *NotificationSys) DiskHwOBDInfo(ctx context.Context) []madmin.ServerDiskHwOBDInfo { - reply := make([]madmin.ServerDiskHwOBDInfo, len(sys.peerClients)) +// DiskHwInfo - Disk HW information +func (sys *NotificationSys) DiskHwInfo(ctx context.Context) []madmin.ServerDiskHwInfo { + reply := make([]madmin.ServerDiskHwInfo, len(sys.peerClients)) g := errgroup.WithNErrs(len(sys.peerClients)) for index, client := range sys.peerClients { @@ -1113,7 +1113,7 @@ func (sys *NotificationSys) DiskHwOBDInfo(ctx context.Context) []madmin.ServerDi index := index g.Go(func() error { var err error - reply[index], err = sys.peerClients[index].DiskHwOBDInfo(ctx) + reply[index], err = sys.peerClients[index].DiskHwInfo(ctx) return err }, index) } @@ -1131,9 +1131,9 @@ func (sys *NotificationSys) DiskHwOBDInfo(ctx context.Context) []madmin.ServerDi return reply } -// OsOBDInfo - Os OBD information -func (sys *NotificationSys) OsOBDInfo(ctx context.Context) []madmin.ServerOsOBDInfo { - reply := make([]madmin.ServerOsOBDInfo, len(sys.peerClients)) +// OsInfo - Os information +func (sys *NotificationSys) OsInfo(ctx context.Context) []madmin.ServerOsInfo { + reply := make([]madmin.ServerOsInfo, len(sys.peerClients)) g := errgroup.WithNErrs(len(sys.peerClients)) for index, client := range sys.peerClients { @@ -1143,7 +1143,7 @@ func (sys *NotificationSys) OsOBDInfo(ctx context.Context) []madmin.ServerOsOBDI index := index g.Go(func() error { var err error - reply[index], err = sys.peerClients[index].OsOBDInfo(ctx) + reply[index], err = sys.peerClients[index].OsInfo(ctx) return err }, index) } @@ -1161,9 +1161,9 @@ func (sys *NotificationSys) OsOBDInfo(ctx context.Context) []madmin.ServerOsOBDI return reply } -// MemOBDInfo - Mem OBD information -func (sys *NotificationSys) MemOBDInfo(ctx context.Context) []madmin.ServerMemOBDInfo { - reply := make([]madmin.ServerMemOBDInfo, len(sys.peerClients)) +// MemInfo - Mem information +func (sys *NotificationSys) MemInfo(ctx context.Context) []madmin.ServerMemInfo { + reply := make([]madmin.ServerMemInfo, len(sys.peerClients)) g := errgroup.WithNErrs(len(sys.peerClients)) for index, client := range sys.peerClients { @@ -1173,7 +1173,7 @@ func (sys *NotificationSys) MemOBDInfo(ctx context.Context) []madmin.ServerMemOB index := index g.Go(func() error { var err error - reply[index], err = sys.peerClients[index].MemOBDInfo(ctx) + reply[index], err = sys.peerClients[index].MemInfo(ctx) return err }, index) } @@ -1191,9 +1191,9 @@ func (sys *NotificationSys) MemOBDInfo(ctx context.Context) []madmin.ServerMemOB return reply } -// ProcOBDInfo - Process OBD information -func (sys *NotificationSys) ProcOBDInfo(ctx context.Context) []madmin.ServerProcOBDInfo { - reply := make([]madmin.ServerProcOBDInfo, len(sys.peerClients)) +// ProcInfo - Process information +func (sys *NotificationSys) ProcInfo(ctx context.Context) []madmin.ServerProcInfo { + reply := make([]madmin.ServerProcInfo, len(sys.peerClients)) g := errgroup.WithNErrs(len(sys.peerClients)) for index, client := range sys.peerClients { @@ -1203,7 +1203,7 @@ func (sys *NotificationSys) ProcOBDInfo(ctx context.Context) []madmin.ServerProc index := index g.Go(func() error { var err error - reply[index], err = sys.peerClients[index].ProcOBDInfo(ctx) + reply[index], err = sys.peerClients[index].ProcInfo(ctx) return err }, index) } diff --git a/cmd/peer-rest-client.go b/cmd/peer-rest-client.go index e3ae152bf..28cc48101 100644 --- a/cmd/peer-rest-client.go +++ b/cmd/peer-rest-client.go @@ -123,7 +123,7 @@ func (r *nullReader) Read(b []byte) (int, error) { return len(b), nil } -func (client *peerRESTClient) doNetOBDTest(ctx context.Context, dataSize int64, threadCount uint) (info madmin.NetOBDInfo, err error) { +func (client *peerRESTClient) doNetTest(ctx context.Context, dataSize int64, threadCount uint) (info madmin.NetPerfInfo, err error) { var mu sync.Mutex // mutex used to protect these slices in go-routines latencies := []float64{} throughputs := []float64{} @@ -178,11 +178,11 @@ func (client *peerRESTClient) doNetOBDTest(ctx context.Context, dataSize int64, progress := io.LimitReader(&nullReader{}, dataSize) - // Turn off healthCheckFn for OBD tests to cater for higher load on the peers. + // Turn off healthCheckFn for health tests to cater for higher load on the peers. clnt := newPeerRESTClient(client.host) clnt.restClient.HealthCheckFn = nil - respBody, err := clnt.callWithContext(ctx, peerRESTMethodNetOBDInfo, nil, progress, dataSize) + respBody, err := clnt.callWithContext(ctx, peerRESTMethodNetInfo, nil, progress, dataSize) if err != nil { if errors.Is(err, context.DeadlineExceeded) { slowSample() @@ -225,8 +225,8 @@ func (client *peerRESTClient) doNetOBDTest(ctx context.Context, dataSize int64, return info, err } - latency, throughput, err := xnet.ComputeOBDStats(latencies, throughputs) - info = madmin.NetOBDInfo{ + latency, throughput, err := xnet.ComputePerfStats(latencies, throughputs) + info = madmin.NetPerfInfo{ Latency: latency, Throughput: throughput, } @@ -273,8 +273,8 @@ func maxLatencyForSizeThreads(size int64, threadCount uint) float64 { return math.MaxFloat64 } -// NetOBDInfo - fetch Net OBD information for a remote node. -func (client *peerRESTClient) NetOBDInfo(ctx context.Context) (info madmin.NetOBDInfo, err error) { +// NetInfo - fetch Net information for a remote node. +func (client *peerRESTClient) NetInfo(ctx context.Context) (info madmin.NetPerfInfo, err error) { // 100 Gbit -> 256 MiB * 50 threads // 40 Gbit -> 256 MiB * 20 threads @@ -313,7 +313,7 @@ func (client *peerRESTClient) NetOBDInfo(ctx context.Context) (info madmin.NetOB size := steps[i].size threads := steps[i].threads - if info, err = client.doNetOBDTest(ctx, size, threads); err != nil { + if info, err = client.doNetTest(ctx, size, threads); err != nil { if err == networkOverloaded { continue } @@ -327,9 +327,9 @@ func (client *peerRESTClient) NetOBDInfo(ctx context.Context) (info madmin.NetOB return info, err } -// DispatchNetOBDInfo - dispatch other nodes to run Net OBD. -func (client *peerRESTClient) DispatchNetOBDInfo(ctx context.Context) (info madmin.ServerNetOBDInfo, err error) { - respBody, err := client.callWithContext(ctx, peerRESTMethodDispatchNetOBDInfo, nil, nil, -1) +// DispatchNetInfo - dispatch other nodes to run Net info. +func (client *peerRESTClient) DispatchNetInfo(ctx context.Context) (info madmin.ServerNetHealthInfo, err error) { + respBody, err := client.callWithContext(ctx, peerRESTMethodDispatchNetInfo, nil, nil, -1) if err != nil { return } @@ -342,9 +342,9 @@ func (client *peerRESTClient) DispatchNetOBDInfo(ctx context.Context) (info madm return } -// DriveOBDInfo - fetch Drive OBD information for a remote node. -func (client *peerRESTClient) DriveOBDInfo(ctx context.Context) (info madmin.ServerDrivesOBDInfo, err error) { - respBody, err := client.callWithContext(ctx, peerRESTMethodDriveOBDInfo, nil, nil, -1) +// DriveInfo - fetch Drive information for a remote node. +func (client *peerRESTClient) DriveInfo(ctx context.Context) (info madmin.ServerDrivesInfo, err error) { + respBody, err := client.callWithContext(ctx, peerRESTMethodDriveInfo, nil, nil, -1) if err != nil { return } @@ -353,9 +353,9 @@ func (client *peerRESTClient) DriveOBDInfo(ctx context.Context) (info madmin.Ser return info, err } -// CPUOBDInfo - fetch CPU OBD information for a remote node. -func (client *peerRESTClient) CPUOBDInfo(ctx context.Context) (info madmin.ServerCPUOBDInfo, err error) { - respBody, err := client.callWithContext(ctx, peerRESTMethodCPUOBDInfo, nil, nil, -1) +// CPUInfo - fetch CPU information for a remote node. +func (client *peerRESTClient) CPUInfo(ctx context.Context) (info madmin.ServerCPUInfo, err error) { + respBody, err := client.callWithContext(ctx, peerRESTMethodCPUInfo, nil, nil, -1) if err != nil { return } @@ -364,9 +364,9 @@ func (client *peerRESTClient) CPUOBDInfo(ctx context.Context) (info madmin.Serve return info, err } -// DiskHwOBDInfo - fetch Disk HW OBD information for a remote node. -func (client *peerRESTClient) DiskHwOBDInfo(ctx context.Context) (info madmin.ServerDiskHwOBDInfo, err error) { - respBody, err := client.callWithContext(ctx, peerRESTMethodDiskHwOBDInfo, nil, nil, -1) +// DiskHwInfo - fetch Disk HW information for a remote node. +func (client *peerRESTClient) DiskHwInfo(ctx context.Context) (info madmin.ServerDiskHwInfo, err error) { + respBody, err := client.callWithContext(ctx, peerRESTMethodDiskHwInfo, nil, nil, -1) if err != nil { return } @@ -375,9 +375,9 @@ func (client *peerRESTClient) DiskHwOBDInfo(ctx context.Context) (info madmin.Se return info, err } -// OsOBDInfo - fetch OsInfo OBD information for a remote node. -func (client *peerRESTClient) OsOBDInfo(ctx context.Context) (info madmin.ServerOsOBDInfo, err error) { - respBody, err := client.callWithContext(ctx, peerRESTMethodOsInfoOBDInfo, nil, nil, -1) +// OsInfo - fetch OS information for a remote node. +func (client *peerRESTClient) OsInfo(ctx context.Context) (info madmin.ServerOsInfo, err error) { + respBody, err := client.callWithContext(ctx, peerRESTMethodOsInfo, nil, nil, -1) if err != nil { return } @@ -386,9 +386,9 @@ func (client *peerRESTClient) OsOBDInfo(ctx context.Context) (info madmin.Server return info, err } -// MemOBDInfo - fetch MemInfo OBD information for a remote node. -func (client *peerRESTClient) MemOBDInfo(ctx context.Context) (info madmin.ServerMemOBDInfo, err error) { - respBody, err := client.callWithContext(ctx, peerRESTMethodMemOBDInfo, nil, nil, -1) +// MemInfo - fetch Memory information for a remote node. +func (client *peerRESTClient) MemInfo(ctx context.Context) (info madmin.ServerMemInfo, err error) { + respBody, err := client.callWithContext(ctx, peerRESTMethodMemInfo, nil, nil, -1) if err != nil { return } @@ -397,9 +397,9 @@ func (client *peerRESTClient) MemOBDInfo(ctx context.Context) (info madmin.Serve return info, err } -// ProcOBDInfo - fetch ProcInfo OBD information for a remote node. -func (client *peerRESTClient) ProcOBDInfo(ctx context.Context) (info madmin.ServerProcOBDInfo, err error) { - respBody, err := client.callWithContext(ctx, peerRESTMethodProcOBDInfo, nil, nil, -1) +// ProcInfo - fetch Process information for a remote node. +func (client *peerRESTClient) ProcInfo(ctx context.Context) (info madmin.ServerProcInfo, err error) { + respBody, err := client.callWithContext(ctx, peerRESTMethodProcInfo, nil, nil, -1) if err != nil { return } diff --git a/cmd/peer-rest-common.go b/cmd/peer-rest-common.go index 44a8f53e4..d9912b402 100644 --- a/cmd/peer-rest-common.go +++ b/cmd/peer-rest-common.go @@ -17,7 +17,7 @@ package cmd const ( - peerRESTVersion = "v10" + peerRESTVersion = "v11" peerRESTVersionPrefix = SlashSeparator + peerRESTVersion peerRESTPrefix = minioReservedBucketPath + "/peer" peerRESTPath = peerRESTPrefix + peerRESTVersionPrefix @@ -26,14 +26,14 @@ const ( const ( peerRESTMethodHealth = "/health" peerRESTMethodServerInfo = "/serverinfo" - peerRESTMethodDriveOBDInfo = "/driveobdinfo" - peerRESTMethodNetOBDInfo = "/netobdinfo" - peerRESTMethodCPUOBDInfo = "/cpuobdinfo" - peerRESTMethodDiskHwOBDInfo = "/diskhwobdinfo" - peerRESTMethodOsInfoOBDInfo = "/osinfoobdinfo" - peerRESTMethodMemOBDInfo = "/memobdinfo" - peerRESTMethodProcOBDInfo = "/procobdinfo" - peerRESTMethodDispatchNetOBDInfo = "/dispatchnetobdinfo" + peerRESTMethodDriveInfo = "/driveinfo" + peerRESTMethodNetInfo = "/netinfo" + peerRESTMethodCPUInfo = "/cpuinfo" + peerRESTMethodDiskHwInfo = "/diskhwinfo" + peerRESTMethodOsInfo = "/osinfo" + peerRESTMethodMemInfo = "/meminfo" + peerRESTMethodProcInfo = "/procinfo" + peerRESTMethodDispatchNetInfo = "/dispatchnetinfo" peerRESTMethodDeleteBucketMetadata = "/deletebucketmetadata" peerRESTMethodLoadBucketMetadata = "/loadbucketmetadata" peerRESTMethodServerUpdate = "/serverupdate" diff --git a/cmd/peer-rest-server.go b/cmd/peer-rest-server.go index 5f756ef34..76fe75fc3 100644 --- a/cmd/peer-rest-server.go +++ b/cmd/peer-rest-server.go @@ -364,8 +364,8 @@ func (s *peerRESTServer) ServerInfoHandler(w http.ResponseWriter, r *http.Reques logger.LogIf(ctx, gob.NewEncoder(w).Encode(info)) } -func (s *peerRESTServer) NetOBDInfoHandler(w http.ResponseWriter, r *http.Request) { - ctx := newContext(r, w, "NetOBDInfo") +func (s *peerRESTServer) NetInfoHandler(w http.ResponseWriter, r *http.Request) { + ctx := newContext(r, w, "NetInfo") if !s.IsValid(w, r) { s.writeErrorResponse(w, errors.New("Invalid request")) return @@ -388,7 +388,7 @@ func (s *peerRESTServer) NetOBDInfoHandler(w http.ResponseWriter, r *http.Reques return } if n != r.ContentLength { - err := fmt.Errorf("OBD: short read: expected %d found %d", r.ContentLength, n) + err := fmt.Errorf("Subnet health: short read: expected %d found %d", r.ContentLength, n) logger.LogIf(ctx, err) w.Header().Set("FinalStatus", err.Error()) @@ -398,7 +398,7 @@ func (s *peerRESTServer) NetOBDInfoHandler(w http.ResponseWriter, r *http.Reques w.(http.Flusher).Flush() } -func (s *peerRESTServer) DispatchNetOBDInfoHandler(w http.ResponseWriter, r *http.Request) { +func (s *peerRESTServer) DispatchNetInfoHandler(w http.ResponseWriter, r *http.Request) { if !s.IsValid(w, r) { s.writeErrorResponse(w, errors.New("Invalid request")) return @@ -406,25 +406,25 @@ func (s *peerRESTServer) DispatchNetOBDInfoHandler(w http.ResponseWriter, r *htt done := keepHTTPResponseAlive(w) - ctx := newContext(r, w, "DispatchNetOBDInfo") - info := globalNotificationSys.NetOBDInfo(ctx) + ctx := newContext(r, w, "DispatchNetInfo") + info := globalNotificationSys.NetInfo(ctx) done(nil) logger.LogIf(ctx, gob.NewEncoder(w).Encode(info)) w.(http.Flusher).Flush() } -// DriveOBDInfoHandler - returns Drive OBD info. -func (s *peerRESTServer) DriveOBDInfoHandler(w http.ResponseWriter, r *http.Request) { +// DriveInfoHandler - returns Drive info. +func (s *peerRESTServer) DriveInfoHandler(w http.ResponseWriter, r *http.Request) { if !s.IsValid(w, r) { s.writeErrorResponse(w, errors.New("Invalid request")) return } - ctx, cancel := context.WithCancel(newContext(r, w, "DriveOBDInfo")) + ctx, cancel := context.WithCancel(newContext(r, w, "DriveInfo")) defer cancel() - infoSerial := getLocalDrivesOBD(ctx, false, globalEndpoints, r) - infoParallel := getLocalDrivesOBD(ctx, true, globalEndpoints, r) + infoSerial := getLocalDrives(ctx, false, globalEndpoints, r) + infoParallel := getLocalDrives(ctx, true, globalEndpoints, r) errStr := "" if infoSerial.Error != "" { @@ -433,7 +433,7 @@ func (s *peerRESTServer) DriveOBDInfoHandler(w http.ResponseWriter, r *http.Requ if infoParallel.Error != "" { errStr = errStr + " parallel: " + infoParallel.Error } - info := madmin.ServerDrivesOBDInfo{ + info := madmin.ServerDrivesInfo{ Addr: infoSerial.Addr, Serial: infoSerial.Serial, Parallel: infoParallel.Parallel, @@ -443,8 +443,8 @@ func (s *peerRESTServer) DriveOBDInfoHandler(w http.ResponseWriter, r *http.Requ logger.LogIf(ctx, gob.NewEncoder(w).Encode(info)) } -// CPUOBDInfoHandler - returns CPU OBD info. -func (s *peerRESTServer) CPUOBDInfoHandler(w http.ResponseWriter, r *http.Request) { +// CPUInfoHandler - returns CPU info. +func (s *peerRESTServer) CPUInfoHandler(w http.ResponseWriter, r *http.Request) { if !s.IsValid(w, r) { s.writeErrorResponse(w, errors.New("Invalid request")) return @@ -453,14 +453,14 @@ func (s *peerRESTServer) CPUOBDInfoHandler(w http.ResponseWriter, r *http.Reques ctx, cancel := context.WithCancel(r.Context()) defer cancel() - info := getLocalCPUOBDInfo(ctx, r) + info := getLocalCPUInfo(ctx, r) defer w.(http.Flusher).Flush() logger.LogIf(ctx, gob.NewEncoder(w).Encode(info)) } -// DiskHwOBDInfoHandler - returns Disk HW OBD info. -func (s *peerRESTServer) DiskHwOBDInfoHandler(w http.ResponseWriter, r *http.Request) { +// DiskHwInfoHandler - returns Disk HW info. +func (s *peerRESTServer) DiskHwInfoHandler(w http.ResponseWriter, r *http.Request) { if !s.IsValid(w, r) { s.writeErrorResponse(w, errors.New("Invalid request")) return @@ -469,14 +469,14 @@ func (s *peerRESTServer) DiskHwOBDInfoHandler(w http.ResponseWriter, r *http.Req ctx, cancel := context.WithCancel(r.Context()) defer cancel() - info := getLocalDiskHwOBD(ctx, r) + info := getLocalDiskHwInfo(ctx, r) defer w.(http.Flusher).Flush() logger.LogIf(ctx, gob.NewEncoder(w).Encode(info)) } -// OsOBDInfoHandler - returns Os OBD info. -func (s *peerRESTServer) OsOBDInfoHandler(w http.ResponseWriter, r *http.Request) { +// OsInfoHandler - returns Os info. +func (s *peerRESTServer) OsInfoHandler(w http.ResponseWriter, r *http.Request) { if !s.IsValid(w, r) { s.writeErrorResponse(w, errors.New("Invalid request")) return @@ -485,14 +485,14 @@ func (s *peerRESTServer) OsOBDInfoHandler(w http.ResponseWriter, r *http.Request ctx, cancel := context.WithCancel(r.Context()) defer cancel() - info := getLocalOsInfoOBD(ctx, r) + info := getLocalOsInfo(ctx, r) defer w.(http.Flusher).Flush() logger.LogIf(ctx, gob.NewEncoder(w).Encode(info)) } -// ProcOBDInfoHandler - returns Proc OBD info. -func (s *peerRESTServer) ProcOBDInfoHandler(w http.ResponseWriter, r *http.Request) { +// ProcInfoHandler - returns Proc info. +func (s *peerRESTServer) ProcInfoHandler(w http.ResponseWriter, r *http.Request) { if !s.IsValid(w, r) { s.writeErrorResponse(w, errors.New("Invalid request")) return @@ -501,14 +501,14 @@ func (s *peerRESTServer) ProcOBDInfoHandler(w http.ResponseWriter, r *http.Reque ctx, cancel := context.WithCancel(r.Context()) defer cancel() - info := getLocalProcOBD(ctx, r) + info := getLocalProcInfo(ctx, r) defer w.(http.Flusher).Flush() logger.LogIf(ctx, gob.NewEncoder(w).Encode(info)) } -// MemOBDInfoHandler - returns Mem OBD info. -func (s *peerRESTServer) MemOBDInfoHandler(w http.ResponseWriter, r *http.Request) { +// MemInfoHandler - returns Memory info. +func (s *peerRESTServer) MemInfoHandler(w http.ResponseWriter, r *http.Request) { if !s.IsValid(w, r) { s.writeErrorResponse(w, errors.New("Invalid request")) return @@ -517,7 +517,7 @@ func (s *peerRESTServer) MemOBDInfoHandler(w http.ResponseWriter, r *http.Reques ctx, cancel := context.WithCancel(r.Context()) defer cancel() - info := getLocalMemOBD(ctx, r) + info := getLocalMemInfo(ctx, r) defer w.(http.Flusher).Flush() logger.LogIf(ctx, gob.NewEncoder(w).Encode(info)) @@ -1026,14 +1026,14 @@ func registerPeerRESTHandlers(router *mux.Router) { subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodHealth).HandlerFunc(httpTraceHdrs(server.HealthHandler)) subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodGetLocks).HandlerFunc(httpTraceHdrs(server.GetLocksHandler)) subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodServerInfo).HandlerFunc(httpTraceHdrs(server.ServerInfoHandler)) - subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodProcOBDInfo).HandlerFunc(httpTraceHdrs(server.ProcOBDInfoHandler)) - subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodMemOBDInfo).HandlerFunc(httpTraceHdrs(server.MemOBDInfoHandler)) - subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodOsInfoOBDInfo).HandlerFunc(httpTraceHdrs(server.OsOBDInfoHandler)) - subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodDiskHwOBDInfo).HandlerFunc(httpTraceHdrs(server.DiskHwOBDInfoHandler)) - subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodCPUOBDInfo).HandlerFunc(httpTraceHdrs(server.CPUOBDInfoHandler)) - subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodDriveOBDInfo).HandlerFunc(httpTraceHdrs(server.DriveOBDInfoHandler)) - subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodNetOBDInfo).HandlerFunc(httpTraceHdrs(server.NetOBDInfoHandler)) - subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodDispatchNetOBDInfo).HandlerFunc(httpTraceHdrs(server.DispatchNetOBDInfoHandler)) + subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodProcInfo).HandlerFunc(httpTraceHdrs(server.ProcInfoHandler)) + subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodMemInfo).HandlerFunc(httpTraceHdrs(server.MemInfoHandler)) + subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodOsInfo).HandlerFunc(httpTraceHdrs(server.OsInfoHandler)) + subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodDiskHwInfo).HandlerFunc(httpTraceHdrs(server.DiskHwInfoHandler)) + subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodCPUInfo).HandlerFunc(httpTraceHdrs(server.CPUInfoHandler)) + subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodDriveInfo).HandlerFunc(httpTraceHdrs(server.DriveInfoHandler)) + subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodNetInfo).HandlerFunc(httpTraceHdrs(server.NetInfoHandler)) + subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodDispatchNetInfo).HandlerFunc(httpTraceHdrs(server.DispatchNetInfoHandler)) subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodCycleBloom).HandlerFunc(httpTraceHdrs(server.CycleServerBloomFilterHandler)) subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodDeleteBucketMetadata).HandlerFunc(httpTraceHdrs(server.DeleteBucketMetadataHandler)).Queries(restQueries(peerRESTBucket)...) subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodLoadBucketMetadata).HandlerFunc(httpTraceHdrs(server.LoadBucketMetadataHandler)).Queries(restQueries(peerRESTBucket)...) diff --git a/docs/debugging/README.md b/docs/debugging/README.md index fc6bda761..426afd8dd 100644 --- a/docs/debugging/README.md +++ b/docs/debugging/README.md @@ -24,8 +24,8 @@ mc admin trace --all --verbose myminio ``` -### On-board Diagnostics -On-board diagnostics help ensure that the underlying infrastructure that runs MinIO is configured correctly, and is functioning properly. This test is one-shot long running one, that is recommended to be run as soon as the cluster is first provisioned, and each time a failure scenrio is encountered. Note that the test incurs majority of the available resources on the system. Care must be taken when using this to debug failure scenario, so as to prevent larger outages. OBD tests can be triggered using [`mc admin obd`](https://github.com/minio/mc/blob/master/docs/minio-admin-complete-guide.md#command-obd---display-minio-server-obd) command. +### Subnet Health +Subnet Health diagnostics help ensure that the underlying infrastructure that runs MinIO is configured correctly, and is functioning properly. This test is one-shot long running one, that is recommended to be run as soon as the cluster is first provisioned, and each time a failure scenario is encountered. Note that the test incurs majority of the available resources on the system. Care must be taken when using this to debug failure scenario, so as to prevent larger outages. Health tests can be triggered using `mc admin subnet health` command. Example: ```sh @@ -34,7 +34,7 @@ minio server /data The command takes no flags ```sh -mc admin obd myminio +mc admin subnet health myminio ``` The output printed will be of the form @@ -53,7 +53,7 @@ The output printed will be of the form ** THIS FILE MAY CONTAIN SENSITIVE INFORMATION ABOUT YOUR ENVIRONMENT ** ** PLEASE INSPECT CONTENTS BEFORE SHARING IT ON ANY PUBLIC FORUM ** ********************************************************************************* -OBD data saved to dc-11-obd_20200321053323.json.gz +mc: Health data saved to dc-11-health_20200321053323.json.gz ``` The gzipped output contains debugging information for your system diff --git a/docs/zh_CN/debugging/README.md b/docs/zh_CN/debugging/README.md index e519d05f7..769eafb35 100644 --- a/docs/zh_CN/debugging/README.md +++ b/docs/zh_CN/debugging/README.md @@ -25,7 +25,7 @@ mc admin trace --all --verbose myminio ### 诊断工具 -诊断工具有助于确保运行MinIO的底层基础设施配置正确,并且运行正常。 此测试是一次长时间运行的测试,建议在首次配置集群时立即运行,并且每次遇到故障时都要运行该测试。 请注意,测试会占用系统上的大部分可用资源. 在使用这个来调试故障场景时必须小心,以防止更大的中断。 可以使用[`mc admin obd`](https://github.com/minio/mc/blob/master/docs/minio-admin-complete-guide.md#command-obd---display-minio-server-obd) 命令触发OBD测试. +诊断工具有助于确保运行MinIO的底层基础设施配置正确,并且运行正常。 此测试是一次长时间运行的测试,建议在首次配置集群时立即运行,并且每次遇到故障时都要运行该测试。 请注意,测试会占用系统上的大部分可用资源. 在使用这个来调试故障场景时必须小心,以防止更大的中断。 可以使用`mc admin subnet health` 命令触发Health测试. 示例: ```sh @@ -34,7 +34,7 @@ minio server /data 该命令不带标志 ```sh -mc admin obd myminio +mc admin subnet health myminio ``` 使用如下格式打印结果输出 @@ -53,7 +53,7 @@ mc admin obd myminio ** THIS FILE MAY CONTAIN SENSITIVE INFORMATION ABOUT YOUR ENVIRONMENT ** ** PLEASE INSPECT CONTENTS BEFORE SHARING IT ON ANY PUBLIC FORUM ** ********************************************************************************* -OBD data saved to dc-11-obd_20200321053323.json.gz +mc: Health data saved to dc-11-health_20200321053323.json.gz ``` gzip输出包含系统的调试信息 diff --git a/pkg/disk/obd.go b/pkg/disk/health.go similarity index 97% rename from pkg/disk/obd.go rename to pkg/disk/health.go index c48511c00..59efb6d9c 100644 --- a/pkg/disk/obd.go +++ b/pkg/disk/health.go @@ -47,8 +47,8 @@ type Throughput struct { Max float64 `json:"max_bytes_per_sec,omitempty"` } -// GetOBDInfo about the drive -func GetOBDInfo(ctx context.Context, drive, fsPath string) (Latency, Throughput, error) { +// GetHealthInfo about the drive +func GetHealthInfo(ctx context.Context, drive, fsPath string) (Latency, Throughput, error) { // Create a file with O_DIRECT flag, choose default umask and also make sure // we are exclusively writing to a new file using O_EXCL. diff --git a/pkg/iam/policy/admin-action.go b/pkg/iam/policy/admin-action.go index 59dceec24..b0b07ac74 100644 --- a/pkg/iam/policy/admin-action.go +++ b/pkg/iam/policy/admin-action.go @@ -47,8 +47,8 @@ const ( KMSKeyStatusAdminAction = "admin:KMSKeyStatus" // ServerInfoAdminAction - allow listing server info ServerInfoAdminAction = "admin:ServerInfo" - // OBDInfoAdminAction - allow obtaining cluster on-board diagnostics - OBDInfoAdminAction = "admin:OBDInfo" + // HealthInfoAdminAction - allow obtaining cluster health information + HealthInfoAdminAction = "admin:OBDInfo" // BandwidthMonitorAction - allow monitoring bandwidth usage BandwidthMonitorAction = "admin:BandwidthMonitor" @@ -132,7 +132,7 @@ var supportedAdminActions = map[AdminAction]struct{}{ ConsoleLogAdminAction: {}, KMSKeyStatusAdminAction: {}, ServerInfoAdminAction: {}, - OBDInfoAdminAction: {}, + HealthInfoAdminAction: {}, BandwidthMonitorAction: {}, ServerUpdateAdminAction: {}, ServiceRestartAdminAction: {}, @@ -175,7 +175,7 @@ var adminActionConditionKeyMap = map[Action]condition.KeySet{ StorageInfoAdminAction: condition.NewKeySet(condition.AllSupportedAdminKeys...), ServerInfoAdminAction: condition.NewKeySet(condition.AllSupportedAdminKeys...), DataUsageInfoAdminAction: condition.NewKeySet(condition.AllSupportedAdminKeys...), - OBDInfoAdminAction: condition.NewKeySet(condition.AllSupportedAdminKeys...), + HealthInfoAdminAction: condition.NewKeySet(condition.AllSupportedAdminKeys...), BandwidthMonitorAction: condition.NewKeySet(condition.AllSupportedAdminKeys...), TopLocksAdminAction: condition.NewKeySet(condition.AllSupportedAdminKeys...), ProfilingAdminAction: condition.NewKeySet(condition.AllSupportedAdminKeys...), diff --git a/pkg/iam/policy/constants.go b/pkg/iam/policy/constants.go index c6c075708..3575d600f 100644 --- a/pkg/iam/policy/constants.go +++ b/pkg/iam/policy/constants.go @@ -75,7 +75,7 @@ var AdminDiagnostics = Policy{ Actions: NewActionSet(ProfilingAdminAction, TraceAdminAction, ConsoleLogAdminAction, ServerInfoAdminAction, TopLocksAdminAction, - OBDInfoAdminAction, BandwidthMonitorAction), + HealthInfoAdminAction, BandwidthMonitorAction), Resources: NewResourceSet(NewResource("*", "")), }, }, diff --git a/pkg/madmin/obd.go b/pkg/madmin/health.go similarity index 51% rename from pkg/madmin/obd.go rename to pkg/madmin/health.go index 609806b49..b9f7e8f1b 100644 --- a/pkg/madmin/obd.go +++ b/pkg/madmin/health.go @@ -35,34 +35,34 @@ import ( "github.com/shirou/gopsutil/process" ) -// OBDInfo - MinIO cluster's OBD Info -type OBDInfo struct { - TimeStamp time.Time `json:"timestamp,omitempty"` - Error string `json:"error,omitempty"` - Perf PerfOBDInfo `json:"perf,omitempty"` - Minio MinioOBDInfo `json:"minio,omitempty"` - Sys SysOBDInfo `json:"sys,omitempty"` -} - -// SysOBDInfo - Includes hardware and system information of the MinIO cluster -type SysOBDInfo struct { - CPUInfo []ServerCPUOBDInfo `json:"cpus,omitempty"` - DiskHwInfo []ServerDiskHwOBDInfo `json:"drives,omitempty"` - OsInfo []ServerOsOBDInfo `json:"osinfos,omitempty"` - MemInfo []ServerMemOBDInfo `json:"meminfos,omitempty"` - ProcInfo []ServerProcOBDInfo `json:"procinfos,omitempty"` - Error string `json:"error,omitempty"` -} - -// ServerProcOBDInfo - Includes host process lvl information -type ServerProcOBDInfo struct { - Addr string `json:"addr"` - Processes []SysOBDProcess `json:"processes,omitempty"` +// HealthInfo - MinIO cluster's health Info +type HealthInfo struct { + TimeStamp time.Time `json:"timestamp,omitempty"` Error string `json:"error,omitempty"` + Perf PerfInfo `json:"perf,omitempty"` + Minio MinioHealthInfo `json:"minio,omitempty"` + Sys SysHealthInfo `json:"sys,omitempty"` } -// SysOBDProcess - Includes process lvl information about a single process -type SysOBDProcess struct { +// SysHealthInfo - Includes hardware and system information of the MinIO cluster +type SysHealthInfo struct { + CPUInfo []ServerCPUInfo `json:"cpus,omitempty"` + DiskHwInfo []ServerDiskHwInfo `json:"drives,omitempty"` + OsInfo []ServerOsInfo `json:"osinfos,omitempty"` + MemInfo []ServerMemInfo `json:"meminfos,omitempty"` + ProcInfo []ServerProcInfo `json:"procinfos,omitempty"` + Error string `json:"error,omitempty"` +} + +// ServerProcInfo - Includes host process lvl information +type ServerProcInfo struct { + Addr string `json:"addr"` + Processes []SysProcess `json:"processes,omitempty"` + Error string `json:"error,omitempty"` +} + +// SysProcess - Includes process lvl information about a single process +type SysProcess struct { Pid int32 `json:"pid"` Background bool `json:"background,omitempty"` CPUPercent float64 `json:"cpupercent,omitempty"` @@ -84,29 +84,27 @@ type SysOBDProcess struct { NumCtxSwitches *process.NumCtxSwitchesStat `json:"numctxswitches,omitempty"` NumFds int32 `json:"numfds,omitempty"` NumThreads int32 `json:"numthreads,omitempty"` - OpenFiles []process.OpenFilesStat `json:"openfiles,omitempty"` PageFaults *process.PageFaultsStat `json:"pagefaults,omitempty"` Parent int32 `json:"parent,omitempty"` Ppid int32 `json:"ppid,omitempty"` Rlimit []process.RlimitStat `json:"rlimit,omitempty"` Status string `json:"status,omitempty"` Tgid int32 `json:"tgid,omitempty"` - Threads map[int32]*cpu.TimesStat `json:"threadstats,omitempty"` Times *cpu.TimesStat `json:"cputimes,omitempty"` Uids []int32 `json:"uids,omitempty"` Username string `json:"username,omitempty"` } -// ServerMemOBDInfo - Includes host virtual and swap mem information -type ServerMemOBDInfo struct { +// ServerMemInfo - Includes host virtual and swap mem information +type ServerMemInfo struct { Addr string `json:"addr"` SwapMem *mem.SwapMemoryStat `json:"swap,omitempty"` VirtualMem *mem.VirtualMemoryStat `json:"virtualmem,omitempty"` Error string `json:"error,omitempty"` } -// ServerOsOBDInfo - Includes host os information -type ServerOsOBDInfo struct { +// ServerOsInfo - Includes host os information +type ServerOsInfo struct { Addr string `json:"addr"` Info *host.InfoStat `json:"info,omitempty"` Sensors []host.TemperatureStat `json:"sensors,omitempty"` @@ -114,115 +112,115 @@ type ServerOsOBDInfo struct { Error string `json:"error,omitempty"` } -// ServerCPUOBDInfo - Includes cpu and timer stats of each node of the MinIO cluster -type ServerCPUOBDInfo struct { +// ServerCPUInfo - Includes cpu and timer stats of each node of the MinIO cluster +type ServerCPUInfo struct { Addr string `json:"addr"` CPUStat []cpu.InfoStat `json:"cpu,omitempty"` TimeStat []cpu.TimesStat `json:"time,omitempty"` Error string `json:"error,omitempty"` } -// MinioOBDInfo - Includes MinIO confifuration information -type MinioOBDInfo struct { +// MinioHealthInfo - Includes MinIO confifuration information +type MinioHealthInfo struct { Info InfoMessage `json:"info,omitempty"` Config interface{} `json:"config,omitempty"` Error string `json:"error,omitempty"` } -// PerfOBDInfo - Includes Drive and Net perf info for the entire MinIO cluster -type PerfOBDInfo struct { - DriveInfo []ServerDrivesOBDInfo `json:"drives,omitempty"` - Net []ServerNetOBDInfo `json:"net,omitempty"` - NetParallel ServerNetOBDInfo `json:"net_parallel,omitempty"` +// PerfInfo - Includes Drive and Net perf info for the entire MinIO cluster +type PerfInfo struct { + DriveInfo []ServerDrivesInfo `json:"drives,omitempty"` + Net []ServerNetHealthInfo `json:"net,omitempty"` + NetParallel ServerNetHealthInfo `json:"net_parallel,omitempty"` Error string `json:"error,omitempty"` } -// ServerDrivesOBDInfo - Drive OBD info about all drives in a single MinIO node -type ServerDrivesOBDInfo struct { - Addr string `json:"addr"` - Serial []DriveOBDInfo `json:"serial,omitempty"` - Parallel []DriveOBDInfo `json:"parallel,omitempty"` - Error string `json:"error,omitempty"` +// ServerDrivesInfo - Drive info about all drives in a single MinIO node +type ServerDrivesInfo struct { + Addr string `json:"addr"` + Serial []DrivePerfInfo `json:"serial,omitempty"` + Parallel []DrivePerfInfo `json:"parallel,omitempty"` + Error string `json:"error,omitempty"` } -// DriveOBDInfo - Stats about a single drive in a MinIO node -type DriveOBDInfo struct { +// DrivePerfInfo - Stats about a single drive in a MinIO node +type DrivePerfInfo struct { Path string `json:"endpoint"` Latency disk.Latency `json:"latency,omitempty"` Throughput disk.Throughput `json:"throughput,omitempty"` Error string `json:"error,omitempty"` } -// ServerNetOBDInfo - Network OBD info about a single MinIO node -type ServerNetOBDInfo struct { - Addr string `json:"addr"` - Net []NetOBDInfo `json:"net,omitempty"` - Error string `json:"error,omitempty"` +// ServerNetHealthInfo - Network health info about a single MinIO node +type ServerNetHealthInfo struct { + Addr string `json:"addr"` + Net []NetPerfInfo `json:"net,omitempty"` + Error string `json:"error,omitempty"` } -// NetOBDInfo - one-to-one network connectivity Stats between 2 MinIO nodes -type NetOBDInfo struct { +// NetPerfInfo - one-to-one network connectivity Stats between 2 MinIO nodes +type NetPerfInfo struct { Addr string `json:"remote"` Latency net.Latency `json:"latency,omitempty"` Throughput net.Throughput `json:"throughput,omitempty"` Error string `json:"error,omitempty"` } -// OBDDataType - Typed OBD data types -type OBDDataType string +// HealthDataType - Typed Health data types +type HealthDataType string -// OBDDataTypes +// HealthDataTypes const ( - OBDDataTypePerfDrive OBDDataType = "perfdrive" - OBDDataTypePerfNet OBDDataType = "perfnet" - OBDDataTypeMinioInfo OBDDataType = "minioinfo" - OBDDataTypeMinioConfig OBDDataType = "minioconfig" - OBDDataTypeSysCPU OBDDataType = "syscpu" - OBDDataTypeSysDiskHw OBDDataType = "sysdiskhw" - OBDDataTypeSysDocker OBDDataType = "sysdocker" // is this really needed? - OBDDataTypeSysOsInfo OBDDataType = "sysosinfo" - OBDDataTypeSysLoad OBDDataType = "sysload" // provides very little info. Making it TBD - OBDDataTypeSysMem OBDDataType = "sysmem" - OBDDataTypeSysNet OBDDataType = "sysnet" - OBDDataTypeSysProcess OBDDataType = "sysprocess" + HealthDataTypePerfDrive HealthDataType = "perfdrive" + HealthDataTypePerfNet HealthDataType = "perfnet" + HealthDataTypeMinioInfo HealthDataType = "minioinfo" + HealthDataTypeMinioConfig HealthDataType = "minioconfig" + HealthDataTypeSysCPU HealthDataType = "syscpu" + HealthDataTypeSysDiskHw HealthDataType = "sysdiskhw" + HealthDataTypeSysDocker HealthDataType = "sysdocker" // is this really needed? + HealthDataTypeSysOsInfo HealthDataType = "sysosinfo" + HealthDataTypeSysLoad HealthDataType = "sysload" // provides very little info. Making it TBD + HealthDataTypeSysMem HealthDataType = "sysmem" + HealthDataTypeSysNet HealthDataType = "sysnet" + HealthDataTypeSysProcess HealthDataType = "sysprocess" ) -// OBDDataTypesMap - Map of OBD datatypes -var OBDDataTypesMap = map[string]OBDDataType{ - "perfdrive": OBDDataTypePerfDrive, - "perfnet": OBDDataTypePerfNet, - "minioinfo": OBDDataTypeMinioInfo, - "minioconfig": OBDDataTypeMinioConfig, - "syscpu": OBDDataTypeSysCPU, - "sysdiskhw": OBDDataTypeSysDiskHw, - "sysdocker": OBDDataTypeSysDocker, - "sysosinfo": OBDDataTypeSysOsInfo, - "sysload": OBDDataTypeSysLoad, - "sysmem": OBDDataTypeSysMem, - "sysnet": OBDDataTypeSysNet, - "sysprocess": OBDDataTypeSysProcess, +// HealthDataTypesMap - Map of Health datatypes +var HealthDataTypesMap = map[string]HealthDataType{ + "perfdrive": HealthDataTypePerfDrive, + "perfnet": HealthDataTypePerfNet, + "minioinfo": HealthDataTypeMinioInfo, + "minioconfig": HealthDataTypeMinioConfig, + "syscpu": HealthDataTypeSysCPU, + "sysdiskhw": HealthDataTypeSysDiskHw, + "sysdocker": HealthDataTypeSysDocker, + "sysosinfo": HealthDataTypeSysOsInfo, + "sysload": HealthDataTypeSysLoad, + "sysmem": HealthDataTypeSysMem, + "sysnet": HealthDataTypeSysNet, + "sysprocess": HealthDataTypeSysProcess, } -// OBDDataTypesList - List of OBD datatypes -var OBDDataTypesList = []OBDDataType{ - OBDDataTypePerfDrive, - OBDDataTypePerfNet, - OBDDataTypeMinioInfo, - OBDDataTypeMinioConfig, - OBDDataTypeSysCPU, - OBDDataTypeSysDiskHw, - OBDDataTypeSysDocker, - OBDDataTypeSysOsInfo, - OBDDataTypeSysLoad, - OBDDataTypeSysMem, - OBDDataTypeSysNet, - OBDDataTypeSysProcess, +// HealthDataTypesList - List of Health datatypes +var HealthDataTypesList = []HealthDataType{ + HealthDataTypePerfDrive, + HealthDataTypePerfNet, + HealthDataTypeMinioInfo, + HealthDataTypeMinioConfig, + HealthDataTypeSysCPU, + HealthDataTypeSysDiskHw, + HealthDataTypeSysDocker, + HealthDataTypeSysOsInfo, + HealthDataTypeSysLoad, + HealthDataTypeSysMem, + HealthDataTypeSysNet, + HealthDataTypeSysProcess, } -// ServerOBDInfo - Connect to a minio server and call OBD Info Management API -// to fetch server's information represented by OBDInfo structure -func (adm *AdminClient) ServerOBDInfo(ctx context.Context, obdDataTypes []OBDDataType, deadline time.Duration) <-chan OBDInfo { - respChan := make(chan OBDInfo) +// ServerHealthInfo - Connect to a minio server and call Health Info Management API +// to fetch server's information represented by HealthInfo structure +func (adm *AdminClient) ServerHealthInfo(ctx context.Context, healthDataTypes []HealthDataType, deadline time.Duration) <-chan HealthInfo { + respChan := make(chan HealthInfo) go func() { v := url.Values{} @@ -230,37 +228,37 @@ func (adm *AdminClient) ServerOBDInfo(ctx context.Context, obdDataTypes []OBDDat deadline.Truncate(1*time.Second).String()) // start with all set to false - for _, d := range OBDDataTypesList { + for _, d := range HealthDataTypesList { v.Set(string(d), "false") } // only 'trueify' user provided values - for _, d := range obdDataTypes { + for _, d := range healthDataTypes { v.Set(string(d), "true") } - var OBDInfoMessage OBDInfo - OBDInfoMessage.TimeStamp = time.Now() + var healthInfoMessage HealthInfo + healthInfoMessage.TimeStamp = time.Now() - if v.Get(string(OBDDataTypeMinioInfo)) == "true" { + if v.Get(string(HealthDataTypeMinioInfo)) == "true" { info, err := adm.ServerInfo(ctx) if err != nil { - respChan <- OBDInfo{ + respChan <- HealthInfo{ Error: err.Error(), } return } - OBDInfoMessage.Minio.Info = info - respChan <- OBDInfoMessage + healthInfoMessage.Minio.Info = info + respChan <- healthInfoMessage } resp, err := adm.executeMethod(ctx, "GET", requestData{ - relPath: adminAPIPrefix + "/obdinfo", + relPath: adminAPIPrefix + "/healthinfo", queryValues: v, }) defer closeResponse(resp) if err != nil { - respChan <- OBDInfo{ + respChan <- HealthInfo{ Error: err.Error(), } close(respChan) @@ -269,7 +267,7 @@ func (adm *AdminClient) ServerOBDInfo(ctx context.Context, obdDataTypes []OBDDat // Check response http status code if resp.StatusCode != http.StatusOK { - respChan <- OBDInfo{ + respChan <- HealthInfo{ Error: httpRespToErrorResponse(resp).Error(), } return @@ -278,21 +276,21 @@ func (adm *AdminClient) ServerOBDInfo(ctx context.Context, obdDataTypes []OBDDat // Unmarshal the server's json response decoder := json.NewDecoder(resp.Body) for { - err := decoder.Decode(&OBDInfoMessage) - OBDInfoMessage.TimeStamp = time.Now() + err := decoder.Decode(&healthInfoMessage) + healthInfoMessage.TimeStamp = time.Now() if err == io.EOF { break } if err != nil { - respChan <- OBDInfo{ + respChan <- HealthInfo{ Error: err.Error(), } } - respChan <- OBDInfoMessage + respChan <- healthInfoMessage } - respChan <- OBDInfoMessage + respChan <- healthInfoMessage close(respChan) }() return respChan diff --git a/pkg/madmin/obd_linux.go b/pkg/madmin/health_linux.go similarity index 92% rename from pkg/madmin/obd_linux.go rename to pkg/madmin/health_linux.go index 4d815a7e6..05d0598d4 100644 --- a/pkg/madmin/obd_linux.go +++ b/pkg/madmin/health_linux.go @@ -24,8 +24,8 @@ import ( diskhw "github.com/shirou/gopsutil/disk" ) -// ServerDiskHwOBDInfo - Includes usage counters, disk counters and partitions -type ServerDiskHwOBDInfo struct { +// ServerDiskHwInfo - Includes usage counters, disk counters and partitions +type ServerDiskHwInfo struct { Addr string `json:"addr"` Usage []*diskhw.UsageStat `json:"usages,omitempty"` Partitions []PartitionStat `json:"partitions,omitempty"` diff --git a/pkg/madmin/obd_nonlinux.go b/pkg/madmin/health_nonlinux.go similarity index 86% rename from pkg/madmin/obd_nonlinux.go rename to pkg/madmin/health_nonlinux.go index 4145d5a76..cfbbaf27f 100644 --- a/pkg/madmin/obd_nonlinux.go +++ b/pkg/madmin/health_nonlinux.go @@ -19,8 +19,8 @@ package madmin -// ServerDiskHwOBDInfo - Includes usage counters, disk counters and partitions -type ServerDiskHwOBDInfo struct { +// ServerDiskHwInfo - Includes usage counters, disk counters and partitions +type ServerDiskHwInfo struct { Addr string `json:"addr"` Error string `json:"error,omitempty"` } diff --git a/pkg/net/obd.go b/pkg/net/health.go similarity index 95% rename from pkg/net/obd.go rename to pkg/net/health.go index 89bd6db1c..687f24736 100644 --- a/pkg/net/obd.go +++ b/pkg/net/health.go @@ -41,8 +41,8 @@ type Throughput struct { Max float64 `json:"max_bytes_per_sec,omitempty"` } -// ComputeOBDStats takes arrays of Latency & Throughput to compute Statistics -func ComputeOBDStats(latencies, throughputs []float64) (Latency, Throughput, error) { +// ComputePerfStats takes arrays of Latency & Throughput to compute Statistics +func ComputePerfStats(latencies, throughputs []float64) (Latency, Throughput, error) { var avgLatency float64 var percentile50Latency float64 var percentile90Latency float64