|
|
@ -1497,22 +1497,13 @@ func (a adminAPIHandlers) ServerInfoHandler(w http.ResponseWriter, r *http.Reque |
|
|
|
|
|
|
|
|
|
|
|
defer logger.AuditLog(w, r, "ServerInfo", mustGetClaimsFromToken(r)) |
|
|
|
defer logger.AuditLog(w, r, "ServerInfo", mustGetClaimsFromToken(r)) |
|
|
|
|
|
|
|
|
|
|
|
objectAPI, _ := validateAdminReq(ctx, w, r, iampolicy.ServerInfoAdminAction) |
|
|
|
// Validate request signature.
|
|
|
|
if objectAPI == nil { |
|
|
|
_, adminAPIErr := checkAdminRequestAuth(ctx, r, iampolicy.ServerInfoAdminAction, "") |
|
|
|
|
|
|
|
if adminAPIErr != ErrNone { |
|
|
|
|
|
|
|
writeErrorResponseJSON(ctx, w, errorCodes.ToAPIErr(adminAPIErr), r.URL) |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
buckets := madmin.Buckets{} |
|
|
|
|
|
|
|
objects := madmin.Objects{} |
|
|
|
|
|
|
|
usage := madmin.Usage{} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dataUsageInfo, err := loadDataUsageFromBackend(ctx, objectAPI) |
|
|
|
|
|
|
|
if err == nil { |
|
|
|
|
|
|
|
buckets = madmin.Buckets{Count: dataUsageInfo.BucketsCount} |
|
|
|
|
|
|
|
objects = madmin.Objects{Count: dataUsageInfo.ObjectsTotalCount} |
|
|
|
|
|
|
|
usage = madmin.Usage{Size: dataUsageInfo.ObjectsTotalSize} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vault := fetchVaultStatus() |
|
|
|
vault := fetchVaultStatus() |
|
|
|
|
|
|
|
|
|
|
|
ldap := madmin.LDAP{} |
|
|
|
ldap := madmin.LDAP{} |
|
|
@ -1534,30 +1525,53 @@ func (a adminAPIHandlers) ServerInfoHandler(w http.ResponseWriter, r *http.Reque |
|
|
|
// Get the notification target info
|
|
|
|
// Get the notification target info
|
|
|
|
notifyTarget := fetchLambdaInfo() |
|
|
|
notifyTarget := fetchLambdaInfo() |
|
|
|
|
|
|
|
|
|
|
|
// Fetching the Storage information, ignore any errors.
|
|
|
|
server := getLocalServerProperty(globalEndpoints, r) |
|
|
|
storageInfo, _ := objectAPI.StorageInfo(ctx, false) |
|
|
|
servers := globalNotificationSys.ServerInfo() |
|
|
|
|
|
|
|
servers = append(servers, server) |
|
|
|
|
|
|
|
|
|
|
|
var backend interface{} |
|
|
|
var backend interface{} |
|
|
|
if storageInfo.Backend.Type == BackendType(madmin.Erasure) { |
|
|
|
mode := madmin.ObjectLayerInitializing |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
buckets := madmin.Buckets{} |
|
|
|
|
|
|
|
objects := madmin.Objects{} |
|
|
|
|
|
|
|
usage := madmin.Usage{} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
objectAPI := newObjectLayerFn() |
|
|
|
|
|
|
|
if objectAPI != nil { |
|
|
|
|
|
|
|
mode = madmin.ObjectLayerOnline |
|
|
|
|
|
|
|
// Load data usage
|
|
|
|
|
|
|
|
dataUsageInfo, err := loadDataUsageFromBackend(ctx, objectAPI) |
|
|
|
|
|
|
|
if err == nil { |
|
|
|
|
|
|
|
buckets = madmin.Buckets{Count: dataUsageInfo.BucketsCount} |
|
|
|
|
|
|
|
objects = madmin.Objects{Count: dataUsageInfo.ObjectsTotalCount} |
|
|
|
|
|
|
|
usage = madmin.Usage{Size: dataUsageInfo.ObjectsTotalSize} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Fetching the backend information
|
|
|
|
|
|
|
|
backendInfo := objectAPI.BackendInfo() |
|
|
|
|
|
|
|
if backendInfo.Type == BackendType(madmin.Erasure) { |
|
|
|
|
|
|
|
// Calculate the number of online/offline disks of all nodes
|
|
|
|
|
|
|
|
var allDisks []madmin.Disk |
|
|
|
|
|
|
|
for _, s := range servers { |
|
|
|
|
|
|
|
allDisks = append(allDisks, s.Disks...) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
onlineDisks, offlineDisks := getOnlineOfflineDisksStats(allDisks) |
|
|
|
|
|
|
|
|
|
|
|
backend = madmin.ErasureBackend{ |
|
|
|
backend = madmin.ErasureBackend{ |
|
|
|
Type: madmin.ErasureType, |
|
|
|
Type: madmin.ErasureType, |
|
|
|
OnlineDisks: storageInfo.Backend.OnlineDisks.Sum(), |
|
|
|
OnlineDisks: onlineDisks.Sum(), |
|
|
|
OfflineDisks: storageInfo.Backend.OfflineDisks.Sum(), |
|
|
|
OfflineDisks: offlineDisks.Sum(), |
|
|
|
StandardSCData: storageInfo.Backend.StandardSCData, |
|
|
|
StandardSCData: backendInfo.StandardSCData, |
|
|
|
StandardSCParity: storageInfo.Backend.StandardSCParity, |
|
|
|
StandardSCParity: backendInfo.StandardSCParity, |
|
|
|
RRSCData: storageInfo.Backend.RRSCData, |
|
|
|
RRSCData: backendInfo.RRSCData, |
|
|
|
RRSCParity: storageInfo.Backend.RRSCParity, |
|
|
|
RRSCParity: backendInfo.RRSCParity, |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
backend = madmin.FSBackend{ |
|
|
|
backend = madmin.FSBackend{ |
|
|
|
Type: madmin.FsType, |
|
|
|
Type: madmin.FsType, |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
mode := "online" |
|
|
|
|
|
|
|
server := getLocalServerProperty(globalEndpoints, r) |
|
|
|
|
|
|
|
servers := globalNotificationSys.ServerInfo() |
|
|
|
|
|
|
|
servers = append(servers, server) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
domain := globalDomainNames |
|
|
|
domain := globalDomainNames |
|
|
|
services := madmin.Services{ |
|
|
|
services := madmin.Services{ |
|
|
@ -1568,25 +1582,6 @@ func (a adminAPIHandlers) ServerInfoHandler(w http.ResponseWriter, r *http.Reque |
|
|
|
Notifications: notifyTarget, |
|
|
|
Notifications: notifyTarget, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// find all disks which belong to each respective endpoints
|
|
|
|
|
|
|
|
for i := range servers { |
|
|
|
|
|
|
|
for _, disk := range storageInfo.Disks { |
|
|
|
|
|
|
|
if strings.Contains(disk.Endpoint, servers[i].Endpoint) { |
|
|
|
|
|
|
|
servers[i].Disks = append(servers[i].Disks, disk) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// add all the disks local to this server.
|
|
|
|
|
|
|
|
for _, disk := range storageInfo.Disks { |
|
|
|
|
|
|
|
if disk.DrivePath == "" && disk.Endpoint == "" { |
|
|
|
|
|
|
|
continue |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if disk.Endpoint == disk.DrivePath { |
|
|
|
|
|
|
|
servers[len(servers)-1].Disks = append(servers[len(servers)-1].Disks, disk) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
infoMsg := madmin.InfoMessage{ |
|
|
|
infoMsg := madmin.InfoMessage{ |
|
|
|
Mode: mode, |
|
|
|
Mode: mode, |
|
|
|
Domain: domain, |
|
|
|
Domain: domain, |
|
|
|