Rename OBD to Health (#10842)

Also, Remove thread stats and openfds from the health report 
as we already have process stats and numfds
This commit is contained in:
Shireesh Anjal 2020-11-21 02:22:53 +05:30 committed by GitHub
parent 4a31b31ca6
commit 7bc47a14cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 383 additions and 394 deletions

View File

@ -1235,26 +1235,26 @@ func (a adminAPIHandlers) KMSKeyStatusHandler(w http.ResponseWriter, r *http.Req
writeSuccessResponseJSON(w, resp) writeSuccessResponseJSON(w, resp)
} }
// OBDInfoHandler - GET /minio/admin/v3/obdinfo // HealthInfoHandler - GET /minio/admin/v3/healthinfo
// ---------- // ----------
// Get server on-board diagnostics // Get server health info
func (a adminAPIHandlers) OBDInfoHandler(w http.ResponseWriter, r *http.Request) { func (a adminAPIHandlers) HealthInfoHandler(w http.ResponseWriter, r *http.Request) {
ctx := newContext(r, w, "OBDInfo") 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 { if objectAPI == nil {
return return
} }
query := r.URL.Query() query := r.URL.Query()
obdInfo := madmin.OBDInfo{} healthInfo := madmin.HealthInfo{}
obdInfoCh := make(chan madmin.OBDInfo) healthInfoCh := make(chan madmin.HealthInfo)
enc := json.NewEncoder(w) enc := json.NewEncoder(w)
partialWrite := func(oinfo madmin.OBDInfo) { partialWrite := func(oinfo madmin.HealthInfo) {
obdInfoCh <- oinfo healthInfoCh <- oinfo
} }
setCommonHeaders(w) 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(), errorResponse := getAPIErrorResponse(ctx, toAdminAPIErr(ctx, err), r.URL.String(),
w.Header().Get(xhttp.AmzRequestID), globalDeploymentID) w.Header().Get(xhttp.AmzRequestID), globalDeploymentID)
encodedErrorResponse := encodeResponse(errorResponse) encodedErrorResponse := encodeResponse(errorResponse)
obdInfo.Error = string(encodedErrorResponse) healthInfo.Error = string(encodedErrorResponse)
logger.LogIf(ctx, enc.Encode(obdInfo)) logger.LogIf(ctx, enc.Encode(healthInfo))
} }
deadline := 3600 * time.Second deadline := 3600 * time.Second
@ -1284,7 +1284,7 @@ func (a adminAPIHandlers) OBDInfoHandler(w http.ResponseWriter, r *http.Request)
deadlinedCtx, cancel := context.WithTimeout(ctx, deadline) deadlinedCtx, cancel := context.WithTimeout(ctx, deadline)
defer cancel() 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 if err := nsLock.GetLock(ctx, newDynamicTimeout(deadline, deadline)); err != nil { // returns a locked lock
errResp(err) errResp(err)
return return
@ -1292,99 +1292,99 @@ func (a adminAPIHandlers) OBDInfoHandler(w http.ResponseWriter, r *http.Request)
defer nsLock.Unlock() defer nsLock.Unlock()
go func() { go func() {
defer close(obdInfoCh) defer close(healthInfoCh)
if cpu := query.Get("syscpu"); cpu == "true" { if cpu := query.Get("syscpu"); cpu == "true" {
cpuInfo := getLocalCPUOBDInfo(deadlinedCtx, r) cpuInfo := getLocalCPUInfo(deadlinedCtx, r)
obdInfo.Sys.CPUInfo = append(obdInfo.Sys.CPUInfo, cpuInfo) healthInfo.Sys.CPUInfo = append(healthInfo.Sys.CPUInfo, cpuInfo)
obdInfo.Sys.CPUInfo = append(obdInfo.Sys.CPUInfo, globalNotificationSys.CPUOBDInfo(deadlinedCtx)...) healthInfo.Sys.CPUInfo = append(healthInfo.Sys.CPUInfo, globalNotificationSys.CPUInfo(deadlinedCtx)...)
partialWrite(obdInfo) partialWrite(healthInfo)
} }
if diskHw := query.Get("sysdiskhw"); diskHw == "true" { if diskHw := query.Get("sysdiskhw"); diskHw == "true" {
diskHwInfo := getLocalDiskHwOBD(deadlinedCtx, r) diskHwInfo := getLocalDiskHwInfo(deadlinedCtx, r)
obdInfo.Sys.DiskHwInfo = append(obdInfo.Sys.DiskHwInfo, diskHwInfo) healthInfo.Sys.DiskHwInfo = append(healthInfo.Sys.DiskHwInfo, diskHwInfo)
obdInfo.Sys.DiskHwInfo = append(obdInfo.Sys.DiskHwInfo, globalNotificationSys.DiskHwOBDInfo(deadlinedCtx)...) healthInfo.Sys.DiskHwInfo = append(healthInfo.Sys.DiskHwInfo, globalNotificationSys.DiskHwInfo(deadlinedCtx)...)
partialWrite(obdInfo) partialWrite(healthInfo)
} }
if osInfo := query.Get("sysosinfo"); osInfo == "true" { if osInfo := query.Get("sysosinfo"); osInfo == "true" {
osInfo := getLocalOsInfoOBD(deadlinedCtx, r) osInfo := getLocalOsInfo(deadlinedCtx, r)
obdInfo.Sys.OsInfo = append(obdInfo.Sys.OsInfo, osInfo) healthInfo.Sys.OsInfo = append(healthInfo.Sys.OsInfo, osInfo)
obdInfo.Sys.OsInfo = append(obdInfo.Sys.OsInfo, globalNotificationSys.OsOBDInfo(deadlinedCtx)...) healthInfo.Sys.OsInfo = append(healthInfo.Sys.OsInfo, globalNotificationSys.OsInfo(deadlinedCtx)...)
partialWrite(obdInfo) partialWrite(healthInfo)
} }
if mem := query.Get("sysmem"); mem == "true" { if mem := query.Get("sysmem"); mem == "true" {
memInfo := getLocalMemOBD(deadlinedCtx, r) memInfo := getLocalMemInfo(deadlinedCtx, r)
obdInfo.Sys.MemInfo = append(obdInfo.Sys.MemInfo, memInfo) healthInfo.Sys.MemInfo = append(healthInfo.Sys.MemInfo, memInfo)
obdInfo.Sys.MemInfo = append(obdInfo.Sys.MemInfo, globalNotificationSys.MemOBDInfo(deadlinedCtx)...) healthInfo.Sys.MemInfo = append(healthInfo.Sys.MemInfo, globalNotificationSys.MemInfo(deadlinedCtx)...)
partialWrite(obdInfo) partialWrite(healthInfo)
} }
if proc := query.Get("sysprocess"); proc == "true" { if proc := query.Get("sysprocess"); proc == "true" {
procInfo := getLocalProcOBD(deadlinedCtx, r) procInfo := getLocalProcInfo(deadlinedCtx, r)
obdInfo.Sys.ProcInfo = append(obdInfo.Sys.ProcInfo, procInfo) healthInfo.Sys.ProcInfo = append(healthInfo.Sys.ProcInfo, procInfo)
obdInfo.Sys.ProcInfo = append(obdInfo.Sys.ProcInfo, globalNotificationSys.ProcOBDInfo(deadlinedCtx)...) healthInfo.Sys.ProcInfo = append(healthInfo.Sys.ProcInfo, globalNotificationSys.ProcInfo(deadlinedCtx)...)
partialWrite(obdInfo) partialWrite(healthInfo)
} }
if config := query.Get("minioconfig"); config == "true" { if config := query.Get("minioconfig"); config == "true" {
cfg, err := readServerConfig(ctx, objectAPI) cfg, err := readServerConfig(ctx, objectAPI)
logger.LogIf(ctx, err) logger.LogIf(ctx, err)
obdInfo.Minio.Config = cfg healthInfo.Minio.Config = cfg
partialWrite(obdInfo) partialWrite(healthInfo)
} }
if drive := query.Get("perfdrive"); drive == "true" { if drive := query.Get("perfdrive"); drive == "true" {
// Get drive obd details from local server's drive(s) // Get drive perf details from local server's drive(s)
driveOBDSerial := getLocalDrivesOBD(deadlinedCtx, false, globalEndpoints, r) drivePerfSerial := getLocalDrives(deadlinedCtx, false, globalEndpoints, r)
driveOBDParallel := getLocalDrivesOBD(deadlinedCtx, true, globalEndpoints, r) drivePerfParallel := getLocalDrives(deadlinedCtx, true, globalEndpoints, r)
errStr := "" errStr := ""
if driveOBDSerial.Error != "" { if drivePerfSerial.Error != "" {
errStr = "serial: " + driveOBDSerial.Error errStr = "serial: " + drivePerfSerial.Error
} }
if driveOBDParallel.Error != "" { if drivePerfParallel.Error != "" {
errStr = errStr + " parallel: " + driveOBDParallel.Error errStr = errStr + " parallel: " + drivePerfParallel.Error
} }
driveOBD := madmin.ServerDrivesOBDInfo{ driveInfo := madmin.ServerDrivesInfo{
Addr: driveOBDSerial.Addr, Addr: drivePerfSerial.Addr,
Serial: driveOBDSerial.Serial, Serial: drivePerfSerial.Serial,
Parallel: driveOBDParallel.Parallel, Parallel: drivePerfParallel.Parallel,
Error: errStr, Error: errStr,
} }
obdInfo.Perf.DriveInfo = append(obdInfo.Perf.DriveInfo, driveOBD) healthInfo.Perf.DriveInfo = append(healthInfo.Perf.DriveInfo, driveInfo)
partialWrite(obdInfo) partialWrite(healthInfo)
// Notify all other MinIO peers to report drive obd numbers // Notify all other MinIO peers to report drive perf numbers
driveOBDs := globalNotificationSys.DriveOBDInfoChan(deadlinedCtx) driveInfos := globalNotificationSys.DrivePerfInfoChan(deadlinedCtx)
for obd := range driveOBDs { for obd := range driveInfos {
obdInfo.Perf.DriveInfo = append(obdInfo.Perf.DriveInfo, obd) healthInfo.Perf.DriveInfo = append(healthInfo.Perf.DriveInfo, obd)
partialWrite(obdInfo) partialWrite(healthInfo)
} }
partialWrite(obdInfo) partialWrite(healthInfo)
} }
if net := query.Get("perfnet"); net == "true" && globalIsDistErasure { if net := query.Get("perfnet"); net == "true" && globalIsDistErasure {
obdInfo.Perf.Net = append(obdInfo.Perf.Net, globalNotificationSys.NetOBDInfo(deadlinedCtx)) healthInfo.Perf.Net = append(healthInfo.Perf.Net, globalNotificationSys.NetInfo(deadlinedCtx))
partialWrite(obdInfo) partialWrite(healthInfo)
netOBDs := globalNotificationSys.DispatchNetOBDChan(deadlinedCtx) netInfos := globalNotificationSys.DispatchNetPerfChan(deadlinedCtx)
for obd := range netOBDs { for netInfo := range netInfos {
obdInfo.Perf.Net = append(obdInfo.Perf.Net, obd) healthInfo.Perf.Net = append(healthInfo.Perf.Net, netInfo)
partialWrite(obdInfo) partialWrite(healthInfo)
} }
partialWrite(obdInfo) partialWrite(healthInfo)
obdInfo.Perf.NetParallel = globalNotificationSys.NetOBDParallelInfo(deadlinedCtx) healthInfo.Perf.NetParallel = globalNotificationSys.NetPerfParallelInfo(deadlinedCtx)
partialWrite(obdInfo) partialWrite(healthInfo)
} }
}() }()
@ -1394,7 +1394,7 @@ func (a adminAPIHandlers) OBDInfoHandler(w http.ResponseWriter, r *http.Request)
for { for {
select { select {
case oinfo, ok := <-obdInfoCh: case oinfo, ok := <-healthInfoCh:
if !ok { if !ok {
return return
} }

View File

@ -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)) adminRouter.Methods(http.MethodGet).Path(adminVersion + "/kms/key/status").HandlerFunc(httpTraceAll(adminAPI.KMSKeyStatusHandler))
if !globalIsGateway { if !globalIsGateway {
// -- OBD API -- // Keep obdinfo for backward compatibility with mc
adminRouter.Methods(http.MethodGet).Path(adminVersion + "/obdinfo"). 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"). adminRouter.Methods(http.MethodGet).Path(adminVersion + "/bandwidth").
HandlerFunc(httpTraceHdrs(adminAPI.BandwidthMonitorHandler)) HandlerFunc(httpTraceHdrs(adminAPI.BandwidthMonitorHandler))
} }

View File

@ -31,7 +31,7 @@ import (
"github.com/shirou/gopsutil/process" "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 addr := r.Host
if globalIsDistErasure { if globalIsDistErasure {
addr = GetLocalPeer(globalEndpoints) addr = GetLocalPeer(globalEndpoints)
@ -39,7 +39,7 @@ func getLocalCPUOBDInfo(ctx context.Context, r *http.Request) madmin.ServerCPUOB
info, err := cpuhw.InfoWithContext(ctx) info, err := cpuhw.InfoWithContext(ctx)
if err != nil { if err != nil {
return madmin.ServerCPUOBDInfo{ return madmin.ServerCPUInfo{
Addr: addr, Addr: addr,
Error: err.Error(), Error: err.Error(),
} }
@ -47,13 +47,13 @@ func getLocalCPUOBDInfo(ctx context.Context, r *http.Request) madmin.ServerCPUOB
time, err := cpuhw.TimesWithContext(ctx, false) time, err := cpuhw.TimesWithContext(ctx, false)
if err != nil { if err != nil {
return madmin.ServerCPUOBDInfo{ return madmin.ServerCPUInfo{
Addr: addr, Addr: addr,
Error: err.Error(), Error: err.Error(),
} }
} }
return madmin.ServerCPUOBDInfo{ return madmin.ServerCPUInfo{
Addr: addr, Addr: addr,
CPUStat: info, CPUStat: info,
TimeStat: time, 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 { func getLocalDrives(ctx context.Context, parallel bool, endpointServerSets EndpointServerSets, r *http.Request) madmin.ServerDrivesInfo {
var drivesOBDInfo []madmin.DriveOBDInfo var drivesPerfInfo []madmin.DrivePerfInfo
var wg sync.WaitGroup var wg sync.WaitGroup
for _, ep := range endpointServerSets { for _, ep := range endpointServerSets {
for _, endpoint := range ep.Endpoints { for _, endpoint := range ep.Endpoints {
@ -70,7 +70,7 @@ func getLocalDrivesOBD(ctx context.Context, parallel bool, endpointServerSets En
if endpoint.IsLocal { if endpoint.IsLocal {
if _, err := os.Stat(endpoint.Path); err != nil { if _, err := os.Stat(endpoint.Path); err != nil {
// Since this drive is not available, add relevant details and proceed // Since this drive is not available, add relevant details and proceed
drivesOBDInfo = append(drivesOBDInfo, madmin.DriveOBDInfo{ drivesPerfInfo = append(drivesPerfInfo, madmin.DrivePerfInfo{
Path: endpoint.Path, Path: endpoint.Path,
Error: err.Error(), Error: err.Error(),
}) })
@ -79,17 +79,17 @@ func getLocalDrivesOBD(ctx context.Context, parallel bool, endpointServerSets En
measurePath := pathJoin(minioMetaTmpBucket, mustGetUUID()) measurePath := pathJoin(minioMetaTmpBucket, mustGetUUID())
measure := func(path string) { measure := func(path string) {
defer wg.Done() defer wg.Done()
driveOBDInfo := madmin.DriveOBDInfo{ driveInfo := madmin.DrivePerfInfo{
Path: path, 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 { if err != nil {
driveOBDInfo.Error = err.Error() driveInfo.Error = err.Error()
} else { } else {
driveOBDInfo.Latency = latency driveInfo.Latency = latency
driveOBDInfo.Throughput = throughput driveInfo.Throughput = throughput
} }
drivesOBDInfo = append(drivesOBDInfo, driveOBDInfo) drivesPerfInfo = append(drivesPerfInfo, driveInfo)
} }
wg.Add(1) wg.Add(1)
@ -108,18 +108,18 @@ func getLocalDrivesOBD(ctx context.Context, parallel bool, endpointServerSets En
addr = GetLocalPeer(endpointServerSets) addr = GetLocalPeer(endpointServerSets)
} }
if parallel { if parallel {
return madmin.ServerDrivesOBDInfo{ return madmin.ServerDrivesInfo{
Addr: addr, Addr: addr,
Parallel: drivesOBDInfo, Parallel: drivesPerfInfo,
} }
} }
return madmin.ServerDrivesOBDInfo{ return madmin.ServerDrivesInfo{
Addr: addr, 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 addr := r.Host
if globalIsDistErasure { if globalIsDistErasure {
addr = GetLocalPeer(globalEndpoints) addr = GetLocalPeer(globalEndpoints)
@ -127,7 +127,7 @@ func getLocalMemOBD(ctx context.Context, r *http.Request) madmin.ServerMemOBDInf
swap, err := memhw.SwapMemoryWithContext(ctx) swap, err := memhw.SwapMemoryWithContext(ctx)
if err != nil { if err != nil {
return madmin.ServerMemOBDInfo{ return madmin.ServerMemInfo{
Addr: addr, Addr: addr,
Error: err.Error(), Error: err.Error(),
} }
@ -135,27 +135,27 @@ func getLocalMemOBD(ctx context.Context, r *http.Request) madmin.ServerMemOBDInf
vm, err := memhw.VirtualMemoryWithContext(ctx) vm, err := memhw.VirtualMemoryWithContext(ctx)
if err != nil { if err != nil {
return madmin.ServerMemOBDInfo{ return madmin.ServerMemInfo{
Addr: addr, Addr: addr,
Error: err.Error(), Error: err.Error(),
} }
} }
return madmin.ServerMemOBDInfo{ return madmin.ServerMemInfo{
Addr: addr, Addr: addr,
SwapMem: swap, SwapMem: swap,
VirtualMem: vm, 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 addr := r.Host
if globalIsDistErasure { if globalIsDistErasure {
addr = GetLocalPeer(globalEndpoints) addr = GetLocalPeer(globalEndpoints)
} }
errProcInfo := func(err error) madmin.ServerProcOBDInfo { errProcInfo := func(err error) madmin.ServerProcInfo {
return madmin.ServerProcOBDInfo{ return madmin.ServerProcInfo{
Addr: addr, Addr: addr,
Error: err.Error(), Error: err.Error(),
} }
@ -172,9 +172,9 @@ func getLocalProcOBD(ctx context.Context, r *http.Request) madmin.ServerProcOBDI
return errProcInfo(err) return errProcInfo(err)
} }
sysProcs := []madmin.SysOBDProcess{} sysProcs := []madmin.SysProcess{}
for _, proc := range processes { for _, proc := range processes {
sysProc := madmin.SysOBDProcess{} sysProc := madmin.SysProcess{}
sysProc.Pid = proc.Pid sysProc.Pid = proc.Pid
bg, err := proc.BackgroundWithContext(ctx) bg, err := proc.BackgroundWithContext(ctx)
@ -296,12 +296,6 @@ func getLocalProcOBD(ctx context.Context, r *http.Request) madmin.ServerProcOBDI
} }
sysProc.NumThreads = numThreads sysProc.NumThreads = numThreads
openFiles, err := proc.OpenFilesWithContext(ctx)
if err != nil {
return errProcInfo(err)
}
sysProc.OpenFiles = openFiles
pageFaults, err := proc.PageFaultsWithContext(ctx) pageFaults, err := proc.PageFaultsWithContext(ctx)
if err != nil { if err != nil {
return errProcInfo(err) return errProcInfo(err)
@ -336,12 +330,6 @@ func getLocalProcOBD(ctx context.Context, r *http.Request) madmin.ServerProcOBDI
} }
sysProc.Tgid = tgid sysProc.Tgid = tgid
threads, err := proc.ThreadsWithContext(ctx)
if err != nil {
return errProcInfo(err)
}
sysProc.Threads = threads
times, err := proc.TimesWithContext(ctx) times, err := proc.TimesWithContext(ctx)
if err != nil { if err != nil {
return errProcInfo(err) return errProcInfo(err)
@ -363,7 +351,7 @@ func getLocalProcOBD(ctx context.Context, r *http.Request) madmin.ServerProcOBDI
sysProcs = append(sysProcs, sysProc) sysProcs = append(sysProcs, sysProc)
} }
return madmin.ServerProcOBDInfo{ return madmin.ServerProcInfo{
Addr: addr, Addr: addr,
Processes: sysProcs, Processes: sysProcs,
} }

View File

@ -31,7 +31,7 @@ import (
"github.com/shirou/gopsutil/host" "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 addr := r.Host
if globalIsDistErasure { if globalIsDistErasure {
addr = GetLocalPeer(globalEndpoints) addr = GetLocalPeer(globalEndpoints)
@ -39,7 +39,7 @@ func getLocalOsInfoOBD(ctx context.Context, r *http.Request) madmin.ServerOsOBDI
info, err := host.InfoWithContext(ctx) info, err := host.InfoWithContext(ctx)
if err != nil { if err != nil {
return madmin.ServerOsOBDInfo{ return madmin.ServerOsInfo{
Addr: addr, Addr: addr,
Error: err.Error(), Error: err.Error(),
} }
@ -47,7 +47,7 @@ func getLocalOsInfoOBD(ctx context.Context, r *http.Request) madmin.ServerOsOBDI
sensors, err := host.SensorsTemperaturesWithContext(ctx) sensors, err := host.SensorsTemperaturesWithContext(ctx)
if err != nil { if err != nil {
return madmin.ServerOsOBDInfo{ return madmin.ServerOsInfo{
Addr: addr, Addr: addr,
Error: err.Error(), 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 // ignore user err, as it cannot be obtained reliably inside containers
users, _ := host.UsersWithContext(ctx) users, _ := host.UsersWithContext(ctx)
return madmin.ServerOsOBDInfo{ return madmin.ServerOsInfo{
Addr: addr, Addr: addr,
Info: info, Info: info,
Sensors: sensors, 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 addr := r.Host
if globalIsDistErasure { if globalIsDistErasure {
addr = GetLocalPeer(globalEndpoints) addr = GetLocalPeer(globalEndpoints)
@ -72,7 +72,7 @@ func getLocalDiskHwOBD(ctx context.Context, r *http.Request) madmin.ServerDiskHw
parts, err := diskhw.PartitionsWithContext(ctx, true) parts, err := diskhw.PartitionsWithContext(ctx, true)
if err != nil { if err != nil {
return madmin.ServerDiskHwOBDInfo{ return madmin.ServerDiskHwInfo{
Addr: addr, Addr: addr,
Error: err.Error(), Error: err.Error(),
} }
@ -101,7 +101,7 @@ func getLocalDiskHwOBD(ctx context.Context, r *http.Request) madmin.ServerDiskHw
if syscall.EACCES == err { if syscall.EACCES == err {
smartInfo.Error = err.Error() smartInfo.Error = err.Error()
} else { } else {
return madmin.ServerDiskHwOBDInfo{ return madmin.ServerDiskHwInfo{
Addr: addr, Addr: addr,
Error: err.Error(), Error: err.Error(),
} }
@ -120,7 +120,7 @@ func getLocalDiskHwOBD(ctx context.Context, r *http.Request) madmin.ServerDiskHw
ioCounters, err := diskhw.IOCountersWithContext(ctx, drives...) ioCounters, err := diskhw.IOCountersWithContext(ctx, drives...)
if err != nil { if err != nil {
return madmin.ServerDiskHwOBDInfo{ return madmin.ServerDiskHwInfo{
Addr: addr, Addr: addr,
Error: err.Error(), Error: err.Error(),
} }
@ -129,7 +129,7 @@ func getLocalDiskHwOBD(ctx context.Context, r *http.Request) madmin.ServerDiskHw
for _, path := range paths { for _, path := range paths {
usage, err := diskhw.UsageWithContext(ctx, path) usage, err := diskhw.UsageWithContext(ctx, path)
if err != nil { if err != nil {
return madmin.ServerDiskHwOBDInfo{ return madmin.ServerDiskHwInfo{
Addr: addr, Addr: addr,
Error: err.Error(), Error: err.Error(),
} }
@ -137,7 +137,7 @@ func getLocalDiskHwOBD(ctx context.Context, r *http.Request) madmin.ServerDiskHw
usages = append(usages, usage) usages = append(usages, usage)
} }
return madmin.ServerDiskHwOBDInfo{ return madmin.ServerDiskHwInfo{
Addr: addr, Addr: addr,
Usage: usages, Usage: usages,
Partitions: partitions, Partitions: partitions,

View File

@ -27,25 +27,25 @@ import (
"github.com/minio/minio/pkg/madmin" "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 addr := r.Host
if globalIsDistErasure { if globalIsDistErasure {
addr = GetLocalPeer(globalEndpoints) addr = GetLocalPeer(globalEndpoints)
} }
return madmin.ServerDiskHwOBDInfo{ return madmin.ServerDiskHwInfo{
Addr: addr, Addr: addr,
Error: "unsupported platform: " + runtime.GOOS, 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 addr := r.Host
if globalIsDistErasure { if globalIsDistErasure {
addr = GetLocalPeer(globalEndpoints) addr = GetLocalPeer(globalEndpoints)
} }
return madmin.ServerOsOBDInfo{ return madmin.ServerOsInfo{
Addr: addr, Addr: addr,
Error: "unsupported platform: " + runtime.GOOS, Error: "unsupported platform: " + runtime.GOOS,
} }

View File

@ -847,13 +847,13 @@ func (sys *NotificationSys) Send(args eventArgs) {
sys.targetList.Send(args.ToEvent(true), targetIDSet, sys.targetResCh) sys.targetList.Send(args.ToEvent(true), targetIDSet, sys.targetResCh)
} }
// NetOBDInfo - Net OBD information // NetInfo - Net information
func (sys *NotificationSys) NetOBDInfo(ctx context.Context) madmin.ServerNetOBDInfo { func (sys *NotificationSys) NetInfo(ctx context.Context) madmin.ServerNetHealthInfo {
var sortedGlobalEndpoints []string var sortedGlobalEndpoints []string
/* /*
Ensure that only untraversed links are visited by this server 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 not run it between b -> a
The graph of tests looks like this 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 { for index, client := range remoteTargets {
if client == nil { if client == nil {
continue continue
} }
var err error var err error
netOBDs[index], err = client.NetOBDInfo(ctx) netInfos[index], err = client.NetInfo(ctx)
addr := client.host.String() addr := client.host.String()
reqInfo := (&logger.ReqInfo{}).AppendTags("remotePeer", addr) reqInfo := (&logger.ReqInfo{}).AppendTags("remotePeer", addr)
ctx := logger.SetReqInfo(GlobalContext, reqInfo) ctx := logger.SetReqInfo(GlobalContext, reqInfo)
logger.LogIf(ctx, err) logger.LogIf(ctx, err)
netOBDs[index].Addr = addr netInfos[index].Addr = addr
if err != nil { if err != nil {
netOBDs[index].Error = err.Error() netInfos[index].Error = err.Error()
} }
} }
return madmin.ServerNetOBDInfo{ return madmin.ServerNetHealthInfo{
Net: netOBDs, Net: netInfos,
Addr: GetLocalPeer(globalEndpoints), Addr: GetLocalPeer(globalEndpoints),
} }
} }
// DispatchNetOBDInfo - Net OBD information from other nodes // DispatchNetPerfInfo - Net perf information from other nodes
func (sys *NotificationSys) DispatchNetOBDInfo(ctx context.Context) []madmin.ServerNetOBDInfo { func (sys *NotificationSys) DispatchNetPerfInfo(ctx context.Context) []madmin.ServerNetHealthInfo {
serverNetOBDs := []madmin.ServerNetOBDInfo{} serverNetInfos := []madmin.ServerNetHealthInfo{}
for index, client := range sys.peerClients { for index, client := range sys.peerClients {
if client == nil { if client == nil {
continue continue
} }
serverNetOBD, err := sys.peerClients[index].DispatchNetOBDInfo(ctx) serverNetInfo, err := sys.peerClients[index].DispatchNetInfo(ctx)
if err != nil { if err != nil {
serverNetOBD.Addr = client.host.String() serverNetInfo.Addr = client.host.String()
serverNetOBD.Error = err.Error() serverNetInfo.Error = err.Error()
} }
serverNetOBDs = append(serverNetOBDs, serverNetOBD) serverNetInfos = append(serverNetInfos, serverNetInfo)
} }
return serverNetOBDs return serverNetInfos
} }
// DispatchNetOBDChan - Net OBD information from other nodes // DispatchNetPerfChan - Net perf information from other nodes
func (sys *NotificationSys) DispatchNetOBDChan(ctx context.Context) chan madmin.ServerNetOBDInfo { func (sys *NotificationSys) DispatchNetPerfChan(ctx context.Context) chan madmin.ServerNetHealthInfo {
serverNetOBDs := make(chan madmin.ServerNetOBDInfo) serverNetInfos := make(chan madmin.ServerNetHealthInfo)
wg := sync.WaitGroup{} wg := sync.WaitGroup{}
wg.Add(1) wg.Add(1)
@ -958,27 +958,27 @@ func (sys *NotificationSys) DispatchNetOBDChan(ctx context.Context) chan madmin.
if client == nil { if client == nil {
continue continue
} }
serverNetOBD, err := client.DispatchNetOBDInfo(ctx) serverNetInfo, err := client.DispatchNetInfo(ctx)
if err != nil { if err != nil {
serverNetOBD.Addr = client.host.String() serverNetInfo.Addr = client.host.String()
serverNetOBD.Error = err.Error() serverNetInfo.Error = err.Error()
} }
serverNetOBDs <- serverNetOBD serverNetInfos <- serverNetInfo
} }
wg.Done() wg.Done()
}() }()
go func() { go func() {
wg.Wait() wg.Wait()
close(serverNetOBDs) close(serverNetInfos)
}() }()
return serverNetOBDs return serverNetInfos
} }
// NetOBDParallelInfo - Performs NetOBD tests // NetPerfParallelInfo - Performs Net parallel tests
func (sys *NotificationSys) NetOBDParallelInfo(ctx context.Context) madmin.ServerNetOBDInfo { func (sys *NotificationSys) NetPerfParallelInfo(ctx context.Context) madmin.ServerNetHealthInfo {
netOBDs := []madmin.NetOBDInfo{} netInfos := []madmin.NetPerfInfo{}
wg := sync.WaitGroup{} wg := sync.WaitGroup{}
for index, client := range sys.peerClients { for index, client := range sys.peerClients {
@ -988,26 +988,26 @@ func (sys *NotificationSys) NetOBDParallelInfo(ctx context.Context) madmin.Serve
wg.Add(1) wg.Add(1)
go func(index int) { go func(index int) {
netOBD, err := sys.peerClients[index].NetOBDInfo(ctx) netInfo, err := sys.peerClients[index].NetInfo(ctx)
netOBD.Addr = sys.peerClients[index].host.String() netInfo.Addr = sys.peerClients[index].host.String()
if err != nil { if err != nil {
netOBD.Error = err.Error() netInfo.Error = err.Error()
} }
netOBDs = append(netOBDs, netOBD) netInfos = append(netInfos, netInfo)
wg.Done() wg.Done()
}(index) }(index)
} }
wg.Wait() wg.Wait()
return madmin.ServerNetOBDInfo{ return madmin.ServerNetHealthInfo{
Net: netOBDs, Net: netInfos,
Addr: GetLocalPeer(globalEndpoints), Addr: GetLocalPeer(globalEndpoints),
} }
} }
// DriveOBDInfo - Drive OBD information // DrivePerfInfo - Drive perf information
func (sys *NotificationSys) DriveOBDInfo(ctx context.Context) []madmin.ServerDrivesOBDInfo { func (sys *NotificationSys) DrivePerfInfo(ctx context.Context) []madmin.ServerDrivesInfo {
reply := make([]madmin.ServerDrivesOBDInfo, len(sys.peerClients)) reply := make([]madmin.ServerDrivesInfo, len(sys.peerClients))
g := errgroup.WithNErrs(len(sys.peerClients)) g := errgroup.WithNErrs(len(sys.peerClients))
for index, client := range sys.peerClients { for index, client := range sys.peerClients {
@ -1017,7 +1017,7 @@ func (sys *NotificationSys) DriveOBDInfo(ctx context.Context) []madmin.ServerDri
index := index index := index
g.Go(func() error { g.Go(func() error {
var err error var err error
reply[index], err = sys.peerClients[index].DriveOBDInfo(ctx) reply[index], err = sys.peerClients[index].DriveInfo(ctx)
return err return err
}, index) }, index)
} }
@ -1035,9 +1035,9 @@ func (sys *NotificationSys) DriveOBDInfo(ctx context.Context) []madmin.ServerDri
return reply return reply
} }
// DriveOBDInfoChan - Drive OBD information // DrivePerfInfoChan - Drive perf information
func (sys *NotificationSys) DriveOBDInfoChan(ctx context.Context) chan madmin.ServerDrivesOBDInfo { func (sys *NotificationSys) DrivePerfInfoChan(ctx context.Context) chan madmin.ServerDrivesInfo {
updateChan := make(chan madmin.ServerDrivesOBDInfo) updateChan := make(chan madmin.ServerDrivesInfo)
wg := sync.WaitGroup{} wg := sync.WaitGroup{}
for _, client := range sys.peerClients { for _, client := range sys.peerClients {
@ -1046,7 +1046,7 @@ func (sys *NotificationSys) DriveOBDInfoChan(ctx context.Context) chan madmin.Se
} }
wg.Add(1) wg.Add(1)
go func(client *peerRESTClient) { go func(client *peerRESTClient) {
reply, err := client.DriveOBDInfo(ctx) reply, err := client.DriveInfo(ctx)
addr := client.host.String() addr := client.host.String()
reqInfo := (&logger.ReqInfo{}).AppendTags("remotePeer", addr) reqInfo := (&logger.ReqInfo{}).AppendTags("remotePeer", addr)
@ -1071,9 +1071,9 @@ func (sys *NotificationSys) DriveOBDInfoChan(ctx context.Context) chan madmin.Se
return updateChan return updateChan
} }
// CPUOBDInfo - CPU OBD information // CPUInfo - CPU information
func (sys *NotificationSys) CPUOBDInfo(ctx context.Context) []madmin.ServerCPUOBDInfo { func (sys *NotificationSys) CPUInfo(ctx context.Context) []madmin.ServerCPUInfo {
reply := make([]madmin.ServerCPUOBDInfo, len(sys.peerClients)) reply := make([]madmin.ServerCPUInfo, len(sys.peerClients))
g := errgroup.WithNErrs(len(sys.peerClients)) g := errgroup.WithNErrs(len(sys.peerClients))
for index, client := range sys.peerClients { for index, client := range sys.peerClients {
@ -1083,7 +1083,7 @@ func (sys *NotificationSys) CPUOBDInfo(ctx context.Context) []madmin.ServerCPUOB
index := index index := index
g.Go(func() error { g.Go(func() error {
var err error var err error
reply[index], err = sys.peerClients[index].CPUOBDInfo(ctx) reply[index], err = sys.peerClients[index].CPUInfo(ctx)
return err return err
}, index) }, index)
} }
@ -1101,9 +1101,9 @@ func (sys *NotificationSys) CPUOBDInfo(ctx context.Context) []madmin.ServerCPUOB
return reply return reply
} }
// DiskHwOBDInfo - Disk HW OBD information // DiskHwInfo - Disk HW information
func (sys *NotificationSys) DiskHwOBDInfo(ctx context.Context) []madmin.ServerDiskHwOBDInfo { func (sys *NotificationSys) DiskHwInfo(ctx context.Context) []madmin.ServerDiskHwInfo {
reply := make([]madmin.ServerDiskHwOBDInfo, len(sys.peerClients)) reply := make([]madmin.ServerDiskHwInfo, len(sys.peerClients))
g := errgroup.WithNErrs(len(sys.peerClients)) g := errgroup.WithNErrs(len(sys.peerClients))
for index, client := range sys.peerClients { for index, client := range sys.peerClients {
@ -1113,7 +1113,7 @@ func (sys *NotificationSys) DiskHwOBDInfo(ctx context.Context) []madmin.ServerDi
index := index index := index
g.Go(func() error { g.Go(func() error {
var err error var err error
reply[index], err = sys.peerClients[index].DiskHwOBDInfo(ctx) reply[index], err = sys.peerClients[index].DiskHwInfo(ctx)
return err return err
}, index) }, index)
} }
@ -1131,9 +1131,9 @@ func (sys *NotificationSys) DiskHwOBDInfo(ctx context.Context) []madmin.ServerDi
return reply return reply
} }
// OsOBDInfo - Os OBD information // OsInfo - Os information
func (sys *NotificationSys) OsOBDInfo(ctx context.Context) []madmin.ServerOsOBDInfo { func (sys *NotificationSys) OsInfo(ctx context.Context) []madmin.ServerOsInfo {
reply := make([]madmin.ServerOsOBDInfo, len(sys.peerClients)) reply := make([]madmin.ServerOsInfo, len(sys.peerClients))
g := errgroup.WithNErrs(len(sys.peerClients)) g := errgroup.WithNErrs(len(sys.peerClients))
for index, client := range sys.peerClients { for index, client := range sys.peerClients {
@ -1143,7 +1143,7 @@ func (sys *NotificationSys) OsOBDInfo(ctx context.Context) []madmin.ServerOsOBDI
index := index index := index
g.Go(func() error { g.Go(func() error {
var err error var err error
reply[index], err = sys.peerClients[index].OsOBDInfo(ctx) reply[index], err = sys.peerClients[index].OsInfo(ctx)
return err return err
}, index) }, index)
} }
@ -1161,9 +1161,9 @@ func (sys *NotificationSys) OsOBDInfo(ctx context.Context) []madmin.ServerOsOBDI
return reply return reply
} }
// MemOBDInfo - Mem OBD information // MemInfo - Mem information
func (sys *NotificationSys) MemOBDInfo(ctx context.Context) []madmin.ServerMemOBDInfo { func (sys *NotificationSys) MemInfo(ctx context.Context) []madmin.ServerMemInfo {
reply := make([]madmin.ServerMemOBDInfo, len(sys.peerClients)) reply := make([]madmin.ServerMemInfo, len(sys.peerClients))
g := errgroup.WithNErrs(len(sys.peerClients)) g := errgroup.WithNErrs(len(sys.peerClients))
for index, client := range sys.peerClients { for index, client := range sys.peerClients {
@ -1173,7 +1173,7 @@ func (sys *NotificationSys) MemOBDInfo(ctx context.Context) []madmin.ServerMemOB
index := index index := index
g.Go(func() error { g.Go(func() error {
var err error var err error
reply[index], err = sys.peerClients[index].MemOBDInfo(ctx) reply[index], err = sys.peerClients[index].MemInfo(ctx)
return err return err
}, index) }, index)
} }
@ -1191,9 +1191,9 @@ func (sys *NotificationSys) MemOBDInfo(ctx context.Context) []madmin.ServerMemOB
return reply return reply
} }
// ProcOBDInfo - Process OBD information // ProcInfo - Process information
func (sys *NotificationSys) ProcOBDInfo(ctx context.Context) []madmin.ServerProcOBDInfo { func (sys *NotificationSys) ProcInfo(ctx context.Context) []madmin.ServerProcInfo {
reply := make([]madmin.ServerProcOBDInfo, len(sys.peerClients)) reply := make([]madmin.ServerProcInfo, len(sys.peerClients))
g := errgroup.WithNErrs(len(sys.peerClients)) g := errgroup.WithNErrs(len(sys.peerClients))
for index, client := range sys.peerClients { for index, client := range sys.peerClients {
@ -1203,7 +1203,7 @@ func (sys *NotificationSys) ProcOBDInfo(ctx context.Context) []madmin.ServerProc
index := index index := index
g.Go(func() error { g.Go(func() error {
var err error var err error
reply[index], err = sys.peerClients[index].ProcOBDInfo(ctx) reply[index], err = sys.peerClients[index].ProcInfo(ctx)
return err return err
}, index) }, index)
} }

View File

@ -123,7 +123,7 @@ func (r *nullReader) Read(b []byte) (int, error) {
return len(b), nil 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 var mu sync.Mutex // mutex used to protect these slices in go-routines
latencies := []float64{} latencies := []float64{}
throughputs := []float64{} throughputs := []float64{}
@ -178,11 +178,11 @@ func (client *peerRESTClient) doNetOBDTest(ctx context.Context, dataSize int64,
progress := io.LimitReader(&nullReader{}, dataSize) 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 := newPeerRESTClient(client.host)
clnt.restClient.HealthCheckFn = nil 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 err != nil {
if errors.Is(err, context.DeadlineExceeded) { if errors.Is(err, context.DeadlineExceeded) {
slowSample() slowSample()
@ -225,8 +225,8 @@ func (client *peerRESTClient) doNetOBDTest(ctx context.Context, dataSize int64,
return info, err return info, err
} }
latency, throughput, err := xnet.ComputeOBDStats(latencies, throughputs) latency, throughput, err := xnet.ComputePerfStats(latencies, throughputs)
info = madmin.NetOBDInfo{ info = madmin.NetPerfInfo{
Latency: latency, Latency: latency,
Throughput: throughput, Throughput: throughput,
} }
@ -273,8 +273,8 @@ func maxLatencyForSizeThreads(size int64, threadCount uint) float64 {
return math.MaxFloat64 return math.MaxFloat64
} }
// NetOBDInfo - fetch Net OBD information for a remote node. // NetInfo - fetch Net information for a remote node.
func (client *peerRESTClient) NetOBDInfo(ctx context.Context) (info madmin.NetOBDInfo, err error) { func (client *peerRESTClient) NetInfo(ctx context.Context) (info madmin.NetPerfInfo, err error) {
// 100 Gbit -> 256 MiB * 50 threads // 100 Gbit -> 256 MiB * 50 threads
// 40 Gbit -> 256 MiB * 20 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 size := steps[i].size
threads := steps[i].threads 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 { if err == networkOverloaded {
continue continue
} }
@ -327,9 +327,9 @@ func (client *peerRESTClient) NetOBDInfo(ctx context.Context) (info madmin.NetOB
return info, err return info, err
} }
// DispatchNetOBDInfo - dispatch other nodes to run Net OBD. // DispatchNetInfo - dispatch other nodes to run Net info.
func (client *peerRESTClient) DispatchNetOBDInfo(ctx context.Context) (info madmin.ServerNetOBDInfo, err error) { func (client *peerRESTClient) DispatchNetInfo(ctx context.Context) (info madmin.ServerNetHealthInfo, err error) {
respBody, err := client.callWithContext(ctx, peerRESTMethodDispatchNetOBDInfo, nil, nil, -1) respBody, err := client.callWithContext(ctx, peerRESTMethodDispatchNetInfo, nil, nil, -1)
if err != nil { if err != nil {
return return
} }
@ -342,9 +342,9 @@ func (client *peerRESTClient) DispatchNetOBDInfo(ctx context.Context) (info madm
return return
} }
// DriveOBDInfo - fetch Drive OBD information for a remote node. // DriveInfo - fetch Drive information for a remote node.
func (client *peerRESTClient) DriveOBDInfo(ctx context.Context) (info madmin.ServerDrivesOBDInfo, err error) { func (client *peerRESTClient) DriveInfo(ctx context.Context) (info madmin.ServerDrivesInfo, err error) {
respBody, err := client.callWithContext(ctx, peerRESTMethodDriveOBDInfo, nil, nil, -1) respBody, err := client.callWithContext(ctx, peerRESTMethodDriveInfo, nil, nil, -1)
if err != nil { if err != nil {
return return
} }
@ -353,9 +353,9 @@ func (client *peerRESTClient) DriveOBDInfo(ctx context.Context) (info madmin.Ser
return info, err return info, err
} }
// CPUOBDInfo - fetch CPU OBD information for a remote node. // CPUInfo - fetch CPU information for a remote node.
func (client *peerRESTClient) CPUOBDInfo(ctx context.Context) (info madmin.ServerCPUOBDInfo, err error) { func (client *peerRESTClient) CPUInfo(ctx context.Context) (info madmin.ServerCPUInfo, err error) {
respBody, err := client.callWithContext(ctx, peerRESTMethodCPUOBDInfo, nil, nil, -1) respBody, err := client.callWithContext(ctx, peerRESTMethodCPUInfo, nil, nil, -1)
if err != nil { if err != nil {
return return
} }
@ -364,9 +364,9 @@ func (client *peerRESTClient) CPUOBDInfo(ctx context.Context) (info madmin.Serve
return info, err return info, err
} }
// DiskHwOBDInfo - fetch Disk HW OBD information for a remote node. // DiskHwInfo - fetch Disk HW information for a remote node.
func (client *peerRESTClient) DiskHwOBDInfo(ctx context.Context) (info madmin.ServerDiskHwOBDInfo, err error) { func (client *peerRESTClient) DiskHwInfo(ctx context.Context) (info madmin.ServerDiskHwInfo, err error) {
respBody, err := client.callWithContext(ctx, peerRESTMethodDiskHwOBDInfo, nil, nil, -1) respBody, err := client.callWithContext(ctx, peerRESTMethodDiskHwInfo, nil, nil, -1)
if err != nil { if err != nil {
return return
} }
@ -375,9 +375,9 @@ func (client *peerRESTClient) DiskHwOBDInfo(ctx context.Context) (info madmin.Se
return info, err return info, err
} }
// OsOBDInfo - fetch OsInfo OBD information for a remote node. // OsInfo - fetch OS information for a remote node.
func (client *peerRESTClient) OsOBDInfo(ctx context.Context) (info madmin.ServerOsOBDInfo, err error) { func (client *peerRESTClient) OsInfo(ctx context.Context) (info madmin.ServerOsInfo, err error) {
respBody, err := client.callWithContext(ctx, peerRESTMethodOsInfoOBDInfo, nil, nil, -1) respBody, err := client.callWithContext(ctx, peerRESTMethodOsInfo, nil, nil, -1)
if err != nil { if err != nil {
return return
} }
@ -386,9 +386,9 @@ func (client *peerRESTClient) OsOBDInfo(ctx context.Context) (info madmin.Server
return info, err return info, err
} }
// MemOBDInfo - fetch MemInfo OBD information for a remote node. // MemInfo - fetch Memory information for a remote node.
func (client *peerRESTClient) MemOBDInfo(ctx context.Context) (info madmin.ServerMemOBDInfo, err error) { func (client *peerRESTClient) MemInfo(ctx context.Context) (info madmin.ServerMemInfo, err error) {
respBody, err := client.callWithContext(ctx, peerRESTMethodMemOBDInfo, nil, nil, -1) respBody, err := client.callWithContext(ctx, peerRESTMethodMemInfo, nil, nil, -1)
if err != nil { if err != nil {
return return
} }
@ -397,9 +397,9 @@ func (client *peerRESTClient) MemOBDInfo(ctx context.Context) (info madmin.Serve
return info, err return info, err
} }
// ProcOBDInfo - fetch ProcInfo OBD information for a remote node. // ProcInfo - fetch Process information for a remote node.
func (client *peerRESTClient) ProcOBDInfo(ctx context.Context) (info madmin.ServerProcOBDInfo, err error) { func (client *peerRESTClient) ProcInfo(ctx context.Context) (info madmin.ServerProcInfo, err error) {
respBody, err := client.callWithContext(ctx, peerRESTMethodProcOBDInfo, nil, nil, -1) respBody, err := client.callWithContext(ctx, peerRESTMethodProcInfo, nil, nil, -1)
if err != nil { if err != nil {
return return
} }

View File

@ -17,7 +17,7 @@
package cmd package cmd
const ( const (
peerRESTVersion = "v10" peerRESTVersion = "v11"
peerRESTVersionPrefix = SlashSeparator + peerRESTVersion peerRESTVersionPrefix = SlashSeparator + peerRESTVersion
peerRESTPrefix = minioReservedBucketPath + "/peer" peerRESTPrefix = minioReservedBucketPath + "/peer"
peerRESTPath = peerRESTPrefix + peerRESTVersionPrefix peerRESTPath = peerRESTPrefix + peerRESTVersionPrefix
@ -26,14 +26,14 @@ const (
const ( const (
peerRESTMethodHealth = "/health" peerRESTMethodHealth = "/health"
peerRESTMethodServerInfo = "/serverinfo" peerRESTMethodServerInfo = "/serverinfo"
peerRESTMethodDriveOBDInfo = "/driveobdinfo" peerRESTMethodDriveInfo = "/driveinfo"
peerRESTMethodNetOBDInfo = "/netobdinfo" peerRESTMethodNetInfo = "/netinfo"
peerRESTMethodCPUOBDInfo = "/cpuobdinfo" peerRESTMethodCPUInfo = "/cpuinfo"
peerRESTMethodDiskHwOBDInfo = "/diskhwobdinfo" peerRESTMethodDiskHwInfo = "/diskhwinfo"
peerRESTMethodOsInfoOBDInfo = "/osinfoobdinfo" peerRESTMethodOsInfo = "/osinfo"
peerRESTMethodMemOBDInfo = "/memobdinfo" peerRESTMethodMemInfo = "/meminfo"
peerRESTMethodProcOBDInfo = "/procobdinfo" peerRESTMethodProcInfo = "/procinfo"
peerRESTMethodDispatchNetOBDInfo = "/dispatchnetobdinfo" peerRESTMethodDispatchNetInfo = "/dispatchnetinfo"
peerRESTMethodDeleteBucketMetadata = "/deletebucketmetadata" peerRESTMethodDeleteBucketMetadata = "/deletebucketmetadata"
peerRESTMethodLoadBucketMetadata = "/loadbucketmetadata" peerRESTMethodLoadBucketMetadata = "/loadbucketmetadata"
peerRESTMethodServerUpdate = "/serverupdate" peerRESTMethodServerUpdate = "/serverupdate"

View File

@ -364,8 +364,8 @@ func (s *peerRESTServer) ServerInfoHandler(w http.ResponseWriter, r *http.Reques
logger.LogIf(ctx, gob.NewEncoder(w).Encode(info)) logger.LogIf(ctx, gob.NewEncoder(w).Encode(info))
} }
func (s *peerRESTServer) NetOBDInfoHandler(w http.ResponseWriter, r *http.Request) { func (s *peerRESTServer) NetInfoHandler(w http.ResponseWriter, r *http.Request) {
ctx := newContext(r, w, "NetOBDInfo") ctx := newContext(r, w, "NetInfo")
if !s.IsValid(w, r) { if !s.IsValid(w, r) {
s.writeErrorResponse(w, errors.New("Invalid request")) s.writeErrorResponse(w, errors.New("Invalid request"))
return return
@ -388,7 +388,7 @@ func (s *peerRESTServer) NetOBDInfoHandler(w http.ResponseWriter, r *http.Reques
return return
} }
if n != r.ContentLength { 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) logger.LogIf(ctx, err)
w.Header().Set("FinalStatus", err.Error()) w.Header().Set("FinalStatus", err.Error())
@ -398,7 +398,7 @@ func (s *peerRESTServer) NetOBDInfoHandler(w http.ResponseWriter, r *http.Reques
w.(http.Flusher).Flush() 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) { if !s.IsValid(w, r) {
s.writeErrorResponse(w, errors.New("Invalid request")) s.writeErrorResponse(w, errors.New("Invalid request"))
return return
@ -406,25 +406,25 @@ func (s *peerRESTServer) DispatchNetOBDInfoHandler(w http.ResponseWriter, r *htt
done := keepHTTPResponseAlive(w) done := keepHTTPResponseAlive(w)
ctx := newContext(r, w, "DispatchNetOBDInfo") ctx := newContext(r, w, "DispatchNetInfo")
info := globalNotificationSys.NetOBDInfo(ctx) info := globalNotificationSys.NetInfo(ctx)
done(nil) done(nil)
logger.LogIf(ctx, gob.NewEncoder(w).Encode(info)) logger.LogIf(ctx, gob.NewEncoder(w).Encode(info))
w.(http.Flusher).Flush() w.(http.Flusher).Flush()
} }
// DriveOBDInfoHandler - returns Drive OBD info. // DriveInfoHandler - returns Drive info.
func (s *peerRESTServer) DriveOBDInfoHandler(w http.ResponseWriter, r *http.Request) { func (s *peerRESTServer) DriveInfoHandler(w http.ResponseWriter, r *http.Request) {
if !s.IsValid(w, r) { if !s.IsValid(w, r) {
s.writeErrorResponse(w, errors.New("Invalid request")) s.writeErrorResponse(w, errors.New("Invalid request"))
return return
} }
ctx, cancel := context.WithCancel(newContext(r, w, "DriveOBDInfo")) ctx, cancel := context.WithCancel(newContext(r, w, "DriveInfo"))
defer cancel() defer cancel()
infoSerial := getLocalDrivesOBD(ctx, false, globalEndpoints, r) infoSerial := getLocalDrives(ctx, false, globalEndpoints, r)
infoParallel := getLocalDrivesOBD(ctx, true, globalEndpoints, r) infoParallel := getLocalDrives(ctx, true, globalEndpoints, r)
errStr := "" errStr := ""
if infoSerial.Error != "" { if infoSerial.Error != "" {
@ -433,7 +433,7 @@ func (s *peerRESTServer) DriveOBDInfoHandler(w http.ResponseWriter, r *http.Requ
if infoParallel.Error != "" { if infoParallel.Error != "" {
errStr = errStr + " parallel: " + infoParallel.Error errStr = errStr + " parallel: " + infoParallel.Error
} }
info := madmin.ServerDrivesOBDInfo{ info := madmin.ServerDrivesInfo{
Addr: infoSerial.Addr, Addr: infoSerial.Addr,
Serial: infoSerial.Serial, Serial: infoSerial.Serial,
Parallel: infoParallel.Parallel, 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)) logger.LogIf(ctx, gob.NewEncoder(w).Encode(info))
} }
// CPUOBDInfoHandler - returns CPU OBD info. // CPUInfoHandler - returns CPU info.
func (s *peerRESTServer) CPUOBDInfoHandler(w http.ResponseWriter, r *http.Request) { func (s *peerRESTServer) CPUInfoHandler(w http.ResponseWriter, r *http.Request) {
if !s.IsValid(w, r) { if !s.IsValid(w, r) {
s.writeErrorResponse(w, errors.New("Invalid request")) s.writeErrorResponse(w, errors.New("Invalid request"))
return return
@ -453,14 +453,14 @@ func (s *peerRESTServer) CPUOBDInfoHandler(w http.ResponseWriter, r *http.Reques
ctx, cancel := context.WithCancel(r.Context()) ctx, cancel := context.WithCancel(r.Context())
defer cancel() defer cancel()
info := getLocalCPUOBDInfo(ctx, r) info := getLocalCPUInfo(ctx, r)
defer w.(http.Flusher).Flush() defer w.(http.Flusher).Flush()
logger.LogIf(ctx, gob.NewEncoder(w).Encode(info)) logger.LogIf(ctx, gob.NewEncoder(w).Encode(info))
} }
// DiskHwOBDInfoHandler - returns Disk HW OBD info. // DiskHwInfoHandler - returns Disk HW info.
func (s *peerRESTServer) DiskHwOBDInfoHandler(w http.ResponseWriter, r *http.Request) { func (s *peerRESTServer) DiskHwInfoHandler(w http.ResponseWriter, r *http.Request) {
if !s.IsValid(w, r) { if !s.IsValid(w, r) {
s.writeErrorResponse(w, errors.New("Invalid request")) s.writeErrorResponse(w, errors.New("Invalid request"))
return return
@ -469,14 +469,14 @@ func (s *peerRESTServer) DiskHwOBDInfoHandler(w http.ResponseWriter, r *http.Req
ctx, cancel := context.WithCancel(r.Context()) ctx, cancel := context.WithCancel(r.Context())
defer cancel() defer cancel()
info := getLocalDiskHwOBD(ctx, r) info := getLocalDiskHwInfo(ctx, r)
defer w.(http.Flusher).Flush() defer w.(http.Flusher).Flush()
logger.LogIf(ctx, gob.NewEncoder(w).Encode(info)) logger.LogIf(ctx, gob.NewEncoder(w).Encode(info))
} }
// OsOBDInfoHandler - returns Os OBD info. // OsInfoHandler - returns Os info.
func (s *peerRESTServer) OsOBDInfoHandler(w http.ResponseWriter, r *http.Request) { func (s *peerRESTServer) OsInfoHandler(w http.ResponseWriter, r *http.Request) {
if !s.IsValid(w, r) { if !s.IsValid(w, r) {
s.writeErrorResponse(w, errors.New("Invalid request")) s.writeErrorResponse(w, errors.New("Invalid request"))
return return
@ -485,14 +485,14 @@ func (s *peerRESTServer) OsOBDInfoHandler(w http.ResponseWriter, r *http.Request
ctx, cancel := context.WithCancel(r.Context()) ctx, cancel := context.WithCancel(r.Context())
defer cancel() defer cancel()
info := getLocalOsInfoOBD(ctx, r) info := getLocalOsInfo(ctx, r)
defer w.(http.Flusher).Flush() defer w.(http.Flusher).Flush()
logger.LogIf(ctx, gob.NewEncoder(w).Encode(info)) logger.LogIf(ctx, gob.NewEncoder(w).Encode(info))
} }
// ProcOBDInfoHandler - returns Proc OBD info. // ProcInfoHandler - returns Proc info.
func (s *peerRESTServer) ProcOBDInfoHandler(w http.ResponseWriter, r *http.Request) { func (s *peerRESTServer) ProcInfoHandler(w http.ResponseWriter, r *http.Request) {
if !s.IsValid(w, r) { if !s.IsValid(w, r) {
s.writeErrorResponse(w, errors.New("Invalid request")) s.writeErrorResponse(w, errors.New("Invalid request"))
return return
@ -501,14 +501,14 @@ func (s *peerRESTServer) ProcOBDInfoHandler(w http.ResponseWriter, r *http.Reque
ctx, cancel := context.WithCancel(r.Context()) ctx, cancel := context.WithCancel(r.Context())
defer cancel() defer cancel()
info := getLocalProcOBD(ctx, r) info := getLocalProcInfo(ctx, r)
defer w.(http.Flusher).Flush() defer w.(http.Flusher).Flush()
logger.LogIf(ctx, gob.NewEncoder(w).Encode(info)) logger.LogIf(ctx, gob.NewEncoder(w).Encode(info))
} }
// MemOBDInfoHandler - returns Mem OBD info. // MemInfoHandler - returns Memory info.
func (s *peerRESTServer) MemOBDInfoHandler(w http.ResponseWriter, r *http.Request) { func (s *peerRESTServer) MemInfoHandler(w http.ResponseWriter, r *http.Request) {
if !s.IsValid(w, r) { if !s.IsValid(w, r) {
s.writeErrorResponse(w, errors.New("Invalid request")) s.writeErrorResponse(w, errors.New("Invalid request"))
return return
@ -517,7 +517,7 @@ func (s *peerRESTServer) MemOBDInfoHandler(w http.ResponseWriter, r *http.Reques
ctx, cancel := context.WithCancel(r.Context()) ctx, cancel := context.WithCancel(r.Context())
defer cancel() defer cancel()
info := getLocalMemOBD(ctx, r) info := getLocalMemInfo(ctx, r)
defer w.(http.Flusher).Flush() defer w.(http.Flusher).Flush()
logger.LogIf(ctx, gob.NewEncoder(w).Encode(info)) 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 + peerRESTMethodHealth).HandlerFunc(httpTraceHdrs(server.HealthHandler))
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodGetLocks).HandlerFunc(httpTraceHdrs(server.GetLocksHandler)) 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 + peerRESTMethodServerInfo).HandlerFunc(httpTraceHdrs(server.ServerInfoHandler))
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodProcOBDInfo).HandlerFunc(httpTraceHdrs(server.ProcOBDInfoHandler)) subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodProcInfo).HandlerFunc(httpTraceHdrs(server.ProcInfoHandler))
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodMemOBDInfo).HandlerFunc(httpTraceHdrs(server.MemOBDInfoHandler)) subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodMemInfo).HandlerFunc(httpTraceHdrs(server.MemInfoHandler))
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodOsInfoOBDInfo).HandlerFunc(httpTraceHdrs(server.OsOBDInfoHandler)) subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodOsInfo).HandlerFunc(httpTraceHdrs(server.OsInfoHandler))
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodDiskHwOBDInfo).HandlerFunc(httpTraceHdrs(server.DiskHwOBDInfoHandler)) subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodDiskHwInfo).HandlerFunc(httpTraceHdrs(server.DiskHwInfoHandler))
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodCPUOBDInfo).HandlerFunc(httpTraceHdrs(server.CPUOBDInfoHandler)) subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodCPUInfo).HandlerFunc(httpTraceHdrs(server.CPUInfoHandler))
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodDriveOBDInfo).HandlerFunc(httpTraceHdrs(server.DriveOBDInfoHandler)) subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodDriveInfo).HandlerFunc(httpTraceHdrs(server.DriveInfoHandler))
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodNetOBDInfo).HandlerFunc(httpTraceHdrs(server.NetOBDInfoHandler)) subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodNetInfo).HandlerFunc(httpTraceHdrs(server.NetInfoHandler))
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodDispatchNetOBDInfo).HandlerFunc(httpTraceHdrs(server.DispatchNetOBDInfoHandler)) 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 + 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 + peerRESTMethodDeleteBucketMetadata).HandlerFunc(httpTraceHdrs(server.DeleteBucketMetadataHandler)).Queries(restQueries(peerRESTBucket)...)
subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodLoadBucketMetadata).HandlerFunc(httpTraceHdrs(server.LoadBucketMetadataHandler)).Queries(restQueries(peerRESTBucket)...) subrouter.Methods(http.MethodPost).Path(peerRESTVersionPrefix + peerRESTMethodLoadBucketMetadata).HandlerFunc(httpTraceHdrs(server.LoadBucketMetadataHandler)).Queries(restQueries(peerRESTBucket)...)

View File

@ -24,8 +24,8 @@ mc admin trace --all --verbose myminio
``` ```
### On-board Diagnostics ### Subnet Health
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 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: Example:
```sh ```sh
@ -34,7 +34,7 @@ minio server /data
The command takes no flags The command takes no flags
```sh ```sh
mc admin obd myminio mc admin subnet health myminio
``` ```
The output printed will be of the form 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 ** ** THIS FILE MAY CONTAIN SENSITIVE INFORMATION ABOUT YOUR ENVIRONMENT **
** PLEASE INSPECT CONTENTS BEFORE SHARING IT ON ANY PUBLIC FORUM ** ** 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 The gzipped output contains debugging information for your system

View File

@ -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 ```sh
@ -34,7 +34,7 @@ minio server /data
该命令不带标志 该命令不带标志
```sh ```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 ** ** THIS FILE MAY CONTAIN SENSITIVE INFORMATION ABOUT YOUR ENVIRONMENT **
** PLEASE INSPECT CONTENTS BEFORE SHARING IT ON ANY PUBLIC FORUM ** ** 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输出包含系统的调试信息 gzip输出包含系统的调试信息

View File

@ -47,8 +47,8 @@ type Throughput struct {
Max float64 `json:"max_bytes_per_sec,omitempty"` Max float64 `json:"max_bytes_per_sec,omitempty"`
} }
// GetOBDInfo about the drive // GetHealthInfo about the drive
func GetOBDInfo(ctx context.Context, drive, fsPath string) (Latency, Throughput, error) { 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 // 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. // we are exclusively writing to a new file using O_EXCL.

View File

@ -47,8 +47,8 @@ const (
KMSKeyStatusAdminAction = "admin:KMSKeyStatus" KMSKeyStatusAdminAction = "admin:KMSKeyStatus"
// ServerInfoAdminAction - allow listing server info // ServerInfoAdminAction - allow listing server info
ServerInfoAdminAction = "admin:ServerInfo" ServerInfoAdminAction = "admin:ServerInfo"
// OBDInfoAdminAction - allow obtaining cluster on-board diagnostics // HealthInfoAdminAction - allow obtaining cluster health information
OBDInfoAdminAction = "admin:OBDInfo" HealthInfoAdminAction = "admin:OBDInfo"
// BandwidthMonitorAction - allow monitoring bandwidth usage // BandwidthMonitorAction - allow monitoring bandwidth usage
BandwidthMonitorAction = "admin:BandwidthMonitor" BandwidthMonitorAction = "admin:BandwidthMonitor"
@ -132,7 +132,7 @@ var supportedAdminActions = map[AdminAction]struct{}{
ConsoleLogAdminAction: {}, ConsoleLogAdminAction: {},
KMSKeyStatusAdminAction: {}, KMSKeyStatusAdminAction: {},
ServerInfoAdminAction: {}, ServerInfoAdminAction: {},
OBDInfoAdminAction: {}, HealthInfoAdminAction: {},
BandwidthMonitorAction: {}, BandwidthMonitorAction: {},
ServerUpdateAdminAction: {}, ServerUpdateAdminAction: {},
ServiceRestartAdminAction: {}, ServiceRestartAdminAction: {},
@ -175,7 +175,7 @@ var adminActionConditionKeyMap = map[Action]condition.KeySet{
StorageInfoAdminAction: condition.NewKeySet(condition.AllSupportedAdminKeys...), StorageInfoAdminAction: condition.NewKeySet(condition.AllSupportedAdminKeys...),
ServerInfoAdminAction: condition.NewKeySet(condition.AllSupportedAdminKeys...), ServerInfoAdminAction: condition.NewKeySet(condition.AllSupportedAdminKeys...),
DataUsageInfoAdminAction: condition.NewKeySet(condition.AllSupportedAdminKeys...), DataUsageInfoAdminAction: condition.NewKeySet(condition.AllSupportedAdminKeys...),
OBDInfoAdminAction: condition.NewKeySet(condition.AllSupportedAdminKeys...), HealthInfoAdminAction: condition.NewKeySet(condition.AllSupportedAdminKeys...),
BandwidthMonitorAction: condition.NewKeySet(condition.AllSupportedAdminKeys...), BandwidthMonitorAction: condition.NewKeySet(condition.AllSupportedAdminKeys...),
TopLocksAdminAction: condition.NewKeySet(condition.AllSupportedAdminKeys...), TopLocksAdminAction: condition.NewKeySet(condition.AllSupportedAdminKeys...),
ProfilingAdminAction: condition.NewKeySet(condition.AllSupportedAdminKeys...), ProfilingAdminAction: condition.NewKeySet(condition.AllSupportedAdminKeys...),

View File

@ -75,7 +75,7 @@ var AdminDiagnostics = Policy{
Actions: NewActionSet(ProfilingAdminAction, Actions: NewActionSet(ProfilingAdminAction,
TraceAdminAction, ConsoleLogAdminAction, TraceAdminAction, ConsoleLogAdminAction,
ServerInfoAdminAction, TopLocksAdminAction, ServerInfoAdminAction, TopLocksAdminAction,
OBDInfoAdminAction, BandwidthMonitorAction), HealthInfoAdminAction, BandwidthMonitorAction),
Resources: NewResourceSet(NewResource("*", "")), Resources: NewResourceSet(NewResource("*", "")),
}, },
}, },

View File

@ -35,34 +35,34 @@ import (
"github.com/shirou/gopsutil/process" "github.com/shirou/gopsutil/process"
) )
// OBDInfo - MinIO cluster's OBD Info // HealthInfo - MinIO cluster's health Info
type OBDInfo struct { type HealthInfo struct {
TimeStamp time.Time `json:"timestamp,omitempty"` TimeStamp time.Time `json:"timestamp,omitempty"`
Error string `json:"error,omitempty"` Error string `json:"error,omitempty"`
Perf PerfOBDInfo `json:"perf,omitempty"` Perf PerfInfo `json:"perf,omitempty"`
Minio MinioOBDInfo `json:"minio,omitempty"` Minio MinioHealthInfo `json:"minio,omitempty"`
Sys SysOBDInfo `json:"sys,omitempty"` Sys SysHealthInfo `json:"sys,omitempty"`
} }
// SysOBDInfo - Includes hardware and system information of the MinIO cluster // SysHealthInfo - Includes hardware and system information of the MinIO cluster
type SysOBDInfo struct { type SysHealthInfo struct {
CPUInfo []ServerCPUOBDInfo `json:"cpus,omitempty"` CPUInfo []ServerCPUInfo `json:"cpus,omitempty"`
DiskHwInfo []ServerDiskHwOBDInfo `json:"drives,omitempty"` DiskHwInfo []ServerDiskHwInfo `json:"drives,omitempty"`
OsInfo []ServerOsOBDInfo `json:"osinfos,omitempty"` OsInfo []ServerOsInfo `json:"osinfos,omitempty"`
MemInfo []ServerMemOBDInfo `json:"meminfos,omitempty"` MemInfo []ServerMemInfo `json:"meminfos,omitempty"`
ProcInfo []ServerProcOBDInfo `json:"procinfos,omitempty"` ProcInfo []ServerProcInfo `json:"procinfos,omitempty"`
Error string `json:"error,omitempty"` Error string `json:"error,omitempty"`
} }
// ServerProcOBDInfo - Includes host process lvl information // ServerProcInfo - Includes host process lvl information
type ServerProcOBDInfo struct { type ServerProcInfo struct {
Addr string `json:"addr"` Addr string `json:"addr"`
Processes []SysOBDProcess `json:"processes,omitempty"` Processes []SysProcess `json:"processes,omitempty"`
Error string `json:"error,omitempty"` Error string `json:"error,omitempty"`
} }
// SysOBDProcess - Includes process lvl information about a single process // SysProcess - Includes process lvl information about a single process
type SysOBDProcess struct { type SysProcess struct {
Pid int32 `json:"pid"` Pid int32 `json:"pid"`
Background bool `json:"background,omitempty"` Background bool `json:"background,omitempty"`
CPUPercent float64 `json:"cpupercent,omitempty"` CPUPercent float64 `json:"cpupercent,omitempty"`
@ -84,29 +84,27 @@ type SysOBDProcess struct {
NumCtxSwitches *process.NumCtxSwitchesStat `json:"numctxswitches,omitempty"` NumCtxSwitches *process.NumCtxSwitchesStat `json:"numctxswitches,omitempty"`
NumFds int32 `json:"numfds,omitempty"` NumFds int32 `json:"numfds,omitempty"`
NumThreads int32 `json:"numthreads,omitempty"` NumThreads int32 `json:"numthreads,omitempty"`
OpenFiles []process.OpenFilesStat `json:"openfiles,omitempty"`
PageFaults *process.PageFaultsStat `json:"pagefaults,omitempty"` PageFaults *process.PageFaultsStat `json:"pagefaults,omitempty"`
Parent int32 `json:"parent,omitempty"` Parent int32 `json:"parent,omitempty"`
Ppid int32 `json:"ppid,omitempty"` Ppid int32 `json:"ppid,omitempty"`
Rlimit []process.RlimitStat `json:"rlimit,omitempty"` Rlimit []process.RlimitStat `json:"rlimit,omitempty"`
Status string `json:"status,omitempty"` Status string `json:"status,omitempty"`
Tgid int32 `json:"tgid,omitempty"` Tgid int32 `json:"tgid,omitempty"`
Threads map[int32]*cpu.TimesStat `json:"threadstats,omitempty"`
Times *cpu.TimesStat `json:"cputimes,omitempty"` Times *cpu.TimesStat `json:"cputimes,omitempty"`
Uids []int32 `json:"uids,omitempty"` Uids []int32 `json:"uids,omitempty"`
Username string `json:"username,omitempty"` Username string `json:"username,omitempty"`
} }
// ServerMemOBDInfo - Includes host virtual and swap mem information // ServerMemInfo - Includes host virtual and swap mem information
type ServerMemOBDInfo struct { type ServerMemInfo struct {
Addr string `json:"addr"` Addr string `json:"addr"`
SwapMem *mem.SwapMemoryStat `json:"swap,omitempty"` SwapMem *mem.SwapMemoryStat `json:"swap,omitempty"`
VirtualMem *mem.VirtualMemoryStat `json:"virtualmem,omitempty"` VirtualMem *mem.VirtualMemoryStat `json:"virtualmem,omitempty"`
Error string `json:"error,omitempty"` Error string `json:"error,omitempty"`
} }
// ServerOsOBDInfo - Includes host os information // ServerOsInfo - Includes host os information
type ServerOsOBDInfo struct { type ServerOsInfo struct {
Addr string `json:"addr"` Addr string `json:"addr"`
Info *host.InfoStat `json:"info,omitempty"` Info *host.InfoStat `json:"info,omitempty"`
Sensors []host.TemperatureStat `json:"sensors,omitempty"` Sensors []host.TemperatureStat `json:"sensors,omitempty"`
@ -114,115 +112,115 @@ type ServerOsOBDInfo struct {
Error string `json:"error,omitempty"` Error string `json:"error,omitempty"`
} }
// ServerCPUOBDInfo - Includes cpu and timer stats of each node of the MinIO cluster // ServerCPUInfo - Includes cpu and timer stats of each node of the MinIO cluster
type ServerCPUOBDInfo struct { type ServerCPUInfo struct {
Addr string `json:"addr"` Addr string `json:"addr"`
CPUStat []cpu.InfoStat `json:"cpu,omitempty"` CPUStat []cpu.InfoStat `json:"cpu,omitempty"`
TimeStat []cpu.TimesStat `json:"time,omitempty"` TimeStat []cpu.TimesStat `json:"time,omitempty"`
Error string `json:"error,omitempty"` Error string `json:"error,omitempty"`
} }
// MinioOBDInfo - Includes MinIO confifuration information // MinioHealthInfo - Includes MinIO confifuration information
type MinioOBDInfo struct { type MinioHealthInfo struct {
Info InfoMessage `json:"info,omitempty"` Info InfoMessage `json:"info,omitempty"`
Config interface{} `json:"config,omitempty"` Config interface{} `json:"config,omitempty"`
Error string `json:"error,omitempty"` Error string `json:"error,omitempty"`
} }
// PerfOBDInfo - Includes Drive and Net perf info for the entire MinIO cluster // PerfInfo - Includes Drive and Net perf info for the entire MinIO cluster
type PerfOBDInfo struct { type PerfInfo struct {
DriveInfo []ServerDrivesOBDInfo `json:"drives,omitempty"` DriveInfo []ServerDrivesInfo `json:"drives,omitempty"`
Net []ServerNetOBDInfo `json:"net,omitempty"` Net []ServerNetHealthInfo `json:"net,omitempty"`
NetParallel ServerNetOBDInfo `json:"net_parallel,omitempty"` NetParallel ServerNetHealthInfo `json:"net_parallel,omitempty"`
Error string `json:"error,omitempty"` Error string `json:"error,omitempty"`
} }
// ServerDrivesOBDInfo - Drive OBD info about all drives in a single MinIO node // ServerDrivesInfo - Drive info about all drives in a single MinIO node
type ServerDrivesOBDInfo struct { type ServerDrivesInfo struct {
Addr string `json:"addr"` Addr string `json:"addr"`
Serial []DriveOBDInfo `json:"serial,omitempty"` Serial []DrivePerfInfo `json:"serial,omitempty"`
Parallel []DriveOBDInfo `json:"parallel,omitempty"` Parallel []DrivePerfInfo `json:"parallel,omitempty"`
Error string `json:"error,omitempty"` Error string `json:"error,omitempty"`
} }
// DriveOBDInfo - Stats about a single drive in a MinIO node // DrivePerfInfo - Stats about a single drive in a MinIO node
type DriveOBDInfo struct { type DrivePerfInfo struct {
Path string `json:"endpoint"` Path string `json:"endpoint"`
Latency disk.Latency `json:"latency,omitempty"` Latency disk.Latency `json:"latency,omitempty"`
Throughput disk.Throughput `json:"throughput,omitempty"` Throughput disk.Throughput `json:"throughput,omitempty"`
Error string `json:"error,omitempty"` Error string `json:"error,omitempty"`
} }
// ServerNetOBDInfo - Network OBD info about a single MinIO node // ServerNetHealthInfo - Network health info about a single MinIO node
type ServerNetOBDInfo struct { type ServerNetHealthInfo struct {
Addr string `json:"addr"` Addr string `json:"addr"`
Net []NetOBDInfo `json:"net,omitempty"` Net []NetPerfInfo `json:"net,omitempty"`
Error string `json:"error,omitempty"` Error string `json:"error,omitempty"`
} }
// NetOBDInfo - one-to-one network connectivity Stats between 2 MinIO nodes // NetPerfInfo - one-to-one network connectivity Stats between 2 MinIO nodes
type NetOBDInfo struct { type NetPerfInfo struct {
Addr string `json:"remote"` Addr string `json:"remote"`
Latency net.Latency `json:"latency,omitempty"` Latency net.Latency `json:"latency,omitempty"`
Throughput net.Throughput `json:"throughput,omitempty"` Throughput net.Throughput `json:"throughput,omitempty"`
Error string `json:"error,omitempty"` Error string `json:"error,omitempty"`
} }
// OBDDataType - Typed OBD data types // HealthDataType - Typed Health data types
type OBDDataType string type HealthDataType string
// OBDDataTypes // HealthDataTypes
const ( const (
OBDDataTypePerfDrive OBDDataType = "perfdrive" HealthDataTypePerfDrive HealthDataType = "perfdrive"
OBDDataTypePerfNet OBDDataType = "perfnet" HealthDataTypePerfNet HealthDataType = "perfnet"
OBDDataTypeMinioInfo OBDDataType = "minioinfo" HealthDataTypeMinioInfo HealthDataType = "minioinfo"
OBDDataTypeMinioConfig OBDDataType = "minioconfig" HealthDataTypeMinioConfig HealthDataType = "minioconfig"
OBDDataTypeSysCPU OBDDataType = "syscpu" HealthDataTypeSysCPU HealthDataType = "syscpu"
OBDDataTypeSysDiskHw OBDDataType = "sysdiskhw" HealthDataTypeSysDiskHw HealthDataType = "sysdiskhw"
OBDDataTypeSysDocker OBDDataType = "sysdocker" // is this really needed? HealthDataTypeSysDocker HealthDataType = "sysdocker" // is this really needed?
OBDDataTypeSysOsInfo OBDDataType = "sysosinfo" HealthDataTypeSysOsInfo HealthDataType = "sysosinfo"
OBDDataTypeSysLoad OBDDataType = "sysload" // provides very little info. Making it TBD HealthDataTypeSysLoad HealthDataType = "sysload" // provides very little info. Making it TBD
OBDDataTypeSysMem OBDDataType = "sysmem" HealthDataTypeSysMem HealthDataType = "sysmem"
OBDDataTypeSysNet OBDDataType = "sysnet" HealthDataTypeSysNet HealthDataType = "sysnet"
OBDDataTypeSysProcess OBDDataType = "sysprocess" HealthDataTypeSysProcess HealthDataType = "sysprocess"
) )
// OBDDataTypesMap - Map of OBD datatypes // HealthDataTypesMap - Map of Health datatypes
var OBDDataTypesMap = map[string]OBDDataType{ var HealthDataTypesMap = map[string]HealthDataType{
"perfdrive": OBDDataTypePerfDrive, "perfdrive": HealthDataTypePerfDrive,
"perfnet": OBDDataTypePerfNet, "perfnet": HealthDataTypePerfNet,
"minioinfo": OBDDataTypeMinioInfo, "minioinfo": HealthDataTypeMinioInfo,
"minioconfig": OBDDataTypeMinioConfig, "minioconfig": HealthDataTypeMinioConfig,
"syscpu": OBDDataTypeSysCPU, "syscpu": HealthDataTypeSysCPU,
"sysdiskhw": OBDDataTypeSysDiskHw, "sysdiskhw": HealthDataTypeSysDiskHw,
"sysdocker": OBDDataTypeSysDocker, "sysdocker": HealthDataTypeSysDocker,
"sysosinfo": OBDDataTypeSysOsInfo, "sysosinfo": HealthDataTypeSysOsInfo,
"sysload": OBDDataTypeSysLoad, "sysload": HealthDataTypeSysLoad,
"sysmem": OBDDataTypeSysMem, "sysmem": HealthDataTypeSysMem,
"sysnet": OBDDataTypeSysNet, "sysnet": HealthDataTypeSysNet,
"sysprocess": OBDDataTypeSysProcess, "sysprocess": HealthDataTypeSysProcess,
} }
// OBDDataTypesList - List of OBD datatypes // HealthDataTypesList - List of Health datatypes
var OBDDataTypesList = []OBDDataType{ var HealthDataTypesList = []HealthDataType{
OBDDataTypePerfDrive, HealthDataTypePerfDrive,
OBDDataTypePerfNet, HealthDataTypePerfNet,
OBDDataTypeMinioInfo, HealthDataTypeMinioInfo,
OBDDataTypeMinioConfig, HealthDataTypeMinioConfig,
OBDDataTypeSysCPU, HealthDataTypeSysCPU,
OBDDataTypeSysDiskHw, HealthDataTypeSysDiskHw,
OBDDataTypeSysDocker, HealthDataTypeSysDocker,
OBDDataTypeSysOsInfo, HealthDataTypeSysOsInfo,
OBDDataTypeSysLoad, HealthDataTypeSysLoad,
OBDDataTypeSysMem, HealthDataTypeSysMem,
OBDDataTypeSysNet, HealthDataTypeSysNet,
OBDDataTypeSysProcess, HealthDataTypeSysProcess,
} }
// ServerOBDInfo - Connect to a minio server and call OBD Info Management API // ServerHealthInfo - Connect to a minio server and call Health Info Management API
// to fetch server's information represented by OBDInfo structure // to fetch server's information represented by HealthInfo structure
func (adm *AdminClient) ServerOBDInfo(ctx context.Context, obdDataTypes []OBDDataType, deadline time.Duration) <-chan OBDInfo { func (adm *AdminClient) ServerHealthInfo(ctx context.Context, healthDataTypes []HealthDataType, deadline time.Duration) <-chan HealthInfo {
respChan := make(chan OBDInfo) respChan := make(chan HealthInfo)
go func() { go func() {
v := url.Values{} v := url.Values{}
@ -230,37 +228,37 @@ func (adm *AdminClient) ServerOBDInfo(ctx context.Context, obdDataTypes []OBDDat
deadline.Truncate(1*time.Second).String()) deadline.Truncate(1*time.Second).String())
// start with all set to false // start with all set to false
for _, d := range OBDDataTypesList { for _, d := range HealthDataTypesList {
v.Set(string(d), "false") v.Set(string(d), "false")
} }
// only 'trueify' user provided values // only 'trueify' user provided values
for _, d := range obdDataTypes { for _, d := range healthDataTypes {
v.Set(string(d), "true") v.Set(string(d), "true")
} }
var OBDInfoMessage OBDInfo var healthInfoMessage HealthInfo
OBDInfoMessage.TimeStamp = time.Now() healthInfoMessage.TimeStamp = time.Now()
if v.Get(string(OBDDataTypeMinioInfo)) == "true" { if v.Get(string(HealthDataTypeMinioInfo)) == "true" {
info, err := adm.ServerInfo(ctx) info, err := adm.ServerInfo(ctx)
if err != nil { if err != nil {
respChan <- OBDInfo{ respChan <- HealthInfo{
Error: err.Error(), Error: err.Error(),
} }
return return
} }
OBDInfoMessage.Minio.Info = info healthInfoMessage.Minio.Info = info
respChan <- OBDInfoMessage respChan <- healthInfoMessage
} }
resp, err := adm.executeMethod(ctx, "GET", requestData{ resp, err := adm.executeMethod(ctx, "GET", requestData{
relPath: adminAPIPrefix + "/obdinfo", relPath: adminAPIPrefix + "/healthinfo",
queryValues: v, queryValues: v,
}) })
defer closeResponse(resp) defer closeResponse(resp)
if err != nil { if err != nil {
respChan <- OBDInfo{ respChan <- HealthInfo{
Error: err.Error(), Error: err.Error(),
} }
close(respChan) close(respChan)
@ -269,7 +267,7 @@ func (adm *AdminClient) ServerOBDInfo(ctx context.Context, obdDataTypes []OBDDat
// Check response http status code // Check response http status code
if resp.StatusCode != http.StatusOK { if resp.StatusCode != http.StatusOK {
respChan <- OBDInfo{ respChan <- HealthInfo{
Error: httpRespToErrorResponse(resp).Error(), Error: httpRespToErrorResponse(resp).Error(),
} }
return return
@ -278,21 +276,21 @@ func (adm *AdminClient) ServerOBDInfo(ctx context.Context, obdDataTypes []OBDDat
// Unmarshal the server's json response // Unmarshal the server's json response
decoder := json.NewDecoder(resp.Body) decoder := json.NewDecoder(resp.Body)
for { for {
err := decoder.Decode(&OBDInfoMessage) err := decoder.Decode(&healthInfoMessage)
OBDInfoMessage.TimeStamp = time.Now() healthInfoMessage.TimeStamp = time.Now()
if err == io.EOF { if err == io.EOF {
break break
} }
if err != nil { if err != nil {
respChan <- OBDInfo{ respChan <- HealthInfo{
Error: err.Error(), Error: err.Error(),
} }
} }
respChan <- OBDInfoMessage respChan <- healthInfoMessage
} }
respChan <- OBDInfoMessage respChan <- healthInfoMessage
close(respChan) close(respChan)
}() }()
return respChan return respChan

View File

@ -24,8 +24,8 @@ import (
diskhw "github.com/shirou/gopsutil/disk" diskhw "github.com/shirou/gopsutil/disk"
) )
// ServerDiskHwOBDInfo - Includes usage counters, disk counters and partitions // ServerDiskHwInfo - Includes usage counters, disk counters and partitions
type ServerDiskHwOBDInfo struct { type ServerDiskHwInfo struct {
Addr string `json:"addr"` Addr string `json:"addr"`
Usage []*diskhw.UsageStat `json:"usages,omitempty"` Usage []*diskhw.UsageStat `json:"usages,omitempty"`
Partitions []PartitionStat `json:"partitions,omitempty"` Partitions []PartitionStat `json:"partitions,omitempty"`

View File

@ -19,8 +19,8 @@
package madmin package madmin
// ServerDiskHwOBDInfo - Includes usage counters, disk counters and partitions // ServerDiskHwInfo - Includes usage counters, disk counters and partitions
type ServerDiskHwOBDInfo struct { type ServerDiskHwInfo struct {
Addr string `json:"addr"` Addr string `json:"addr"`
Error string `json:"error,omitempty"` Error string `json:"error,omitempty"`
} }

View File

@ -41,8 +41,8 @@ type Throughput struct {
Max float64 `json:"max_bytes_per_sec,omitempty"` Max float64 `json:"max_bytes_per_sec,omitempty"`
} }
// ComputeOBDStats takes arrays of Latency & Throughput to compute Statistics // ComputePerfStats takes arrays of Latency & Throughput to compute Statistics
func ComputeOBDStats(latencies, throughputs []float64) (Latency, Throughput, error) { func ComputePerfStats(latencies, throughputs []float64) (Latency, Throughput, error) {
var avgLatency float64 var avgLatency float64
var percentile50Latency float64 var percentile50Latency float64
var percentile90Latency float64 var percentile90Latency float64