Add bucket and object count along with total object size (#8639)

master
Ashish Kumar Sinha 5 years ago committed by Harshavardhana
parent c364f0af6c
commit abc266caa1
  1. 21
      cmd/admin-handlers.go
  2. 4
      pkg/madmin/info-commands.go

@ -1307,12 +1307,20 @@ func (a adminAPIHandlers) ServerInfoHandler(w http.ResponseWriter, r *http.Reque
return return
} }
infoMsg := madmin.InfoMessage{} buckets := madmin.Buckets{}
vault := madmin.Vault{} objects := madmin.Objects{}
if GlobalKMS != nil { usage := madmin.Usage{}
vault = fetchVaultStatus(cfg)
dataUsageInfo, err := loadDataUsageFromBackend(ctx, objectAPI)
if err == nil {
buckets = madmin.Buckets{Count: dataUsageInfo.BucketsCount}
objects = madmin.Objects{Count: dataUsageInfo.ObjectsCount}
usage = madmin.Usage{Size: dataUsageInfo.ObjectsTotalSize}
} }
infoMsg := madmin.InfoMessage{}
vault := fetchVaultStatus(cfg)
ldap := madmin.LDAP{} ldap := madmin.LDAP{}
if globalLDAPConfig.Enabled { if globalLDAPConfig.Enabled {
ldapConn, err := globalLDAPConfig.Connect() ldapConn, err := globalLDAPConfig.Connect()
@ -1407,9 +1415,6 @@ func (a adminAPIHandlers) ServerInfoHandler(w http.ResponseWriter, r *http.Reque
} }
domain := globalDomainNames domain := globalDomainNames
buckets := madmin.Buckets{}
objects := madmin.Objects{}
usage := madmin.Usage{}
services := madmin.Services{ services := madmin.Services{
Vault: vault, Vault: vault,
LDAP: ldap, LDAP: ldap,
@ -1446,7 +1451,7 @@ func (a adminAPIHandlers) ServerInfoHandler(w http.ResponseWriter, r *http.Reque
func fetchLambdaInfo(cfg config.Config) []map[string][]madmin.TargetIDStatus { func fetchLambdaInfo(cfg config.Config) []map[string][]madmin.TargetIDStatus {
lambdaMap := make(map[string][]madmin.TargetIDStatus) lambdaMap := make(map[string][]madmin.TargetIDStatus)
targetList, _ := notify.GetNotificationTargets(cfg, GlobalServiceDoneCh, globalRootCAs) targetList, _ := notify.GetNotificationTargets(cfg, GlobalServiceDoneCh, NewCustomHTTPTransport())
for targetID, target := range targetList.TargetMap() { for targetID, target := range targetList.TargetMap() {
targetIDStatus := make(map[string]madmin.Status) targetIDStatus := make(map[string]madmin.Status)

@ -408,12 +408,12 @@ type Services struct {
// Buckets contains the number of buckets // Buckets contains the number of buckets
type Buckets struct { type Buckets struct {
Count int `json:"count,omitempty"` Count uint64 `json:"count,omitempty"`
} }
// Objects contains the number of objects // Objects contains the number of objects
type Objects struct { type Objects struct {
Count int `json:"count,omitempty"` Count uint64 `json:"count,omitempty"`
} }
// Usage contains the tottal size used // Usage contains the tottal size used

Loading…
Cancel
Save