mirror of
https://github.com/minio/minio.git
synced 2024-12-24 22:25:54 -05:00
Expose total and available disk space (#7453)
This commit is contained in:
parent
979309148e
commit
0188009c7e
@ -251,6 +251,8 @@ func (fs *FSObjects) StorageInfo(ctx context.Context) StorageInfo {
|
||||
}
|
||||
storageInfo := StorageInfo{
|
||||
Used: used,
|
||||
Total: di.Total,
|
||||
Available: di.Free,
|
||||
}
|
||||
storageInfo.Backend.Type = BackendFS
|
||||
return storageInfo
|
||||
|
@ -142,6 +142,26 @@ func (c *minioCollector) Collect(ch chan<- prometheus.Metric) {
|
||||
float64(s.Used),
|
||||
)
|
||||
|
||||
// Total disk available space seen by Minio server instance
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
prometheus.NewDesc(
|
||||
prometheus.BuildFQName("minio", "disk", "storage_available_bytes"),
|
||||
"Total disk available space seen by Minio server instance",
|
||||
nil, nil),
|
||||
prometheus.GaugeValue,
|
||||
float64(s.Available),
|
||||
)
|
||||
|
||||
// Total disk space seen by Minio server instance
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
prometheus.NewDesc(
|
||||
prometheus.BuildFQName("minio", "disk", "storage_total_bytes"),
|
||||
"Total disk space seen by Minio server instance",
|
||||
nil, nil),
|
||||
prometheus.GaugeValue,
|
||||
float64(s.Total),
|
||||
)
|
||||
|
||||
// Minio Total Disk/Offline Disk
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
prometheus.NewDesc(
|
||||
|
@ -41,6 +41,10 @@ const (
|
||||
type StorageInfo struct {
|
||||
Used uint64 // Used total used per tenant.
|
||||
|
||||
Total uint64 // Total disk space.
|
||||
|
||||
Available uint64 // Total disk space available.
|
||||
|
||||
// Backend type.
|
||||
Backend struct {
|
||||
// Represents various backend types, currently on FS and Erasure.
|
||||
|
@ -307,6 +307,8 @@ func (s *xlSets) StorageInfo(ctx context.Context) StorageInfo {
|
||||
for _, set := range s.sets {
|
||||
lstorageInfo := set.StorageInfo(ctx)
|
||||
storageInfo.Used = storageInfo.Used + lstorageInfo.Used
|
||||
storageInfo.Total = storageInfo.Total + lstorageInfo.Total
|
||||
storageInfo.Available = storageInfo.Available + lstorageInfo.Available
|
||||
storageInfo.Backend.OnlineDisks = storageInfo.Backend.OnlineDisks + lstorageInfo.Backend.OnlineDisks
|
||||
storageInfo.Backend.OfflineDisks = storageInfo.Backend.OfflineDisks + lstorageInfo.Backend.OfflineDisks
|
||||
}
|
||||
|
@ -120,10 +120,12 @@ func getStorageInfo(disks []StorageAPI) StorageInfo {
|
||||
return StorageInfo{}
|
||||
}
|
||||
|
||||
// Combine all disks to get total usage.
|
||||
var used uint64
|
||||
// Combine all disks to get total usage
|
||||
var used, total, available uint64
|
||||
for _, di := range validDisksInfo {
|
||||
used = used + di.Used
|
||||
total = total + di.Total
|
||||
available = available + di.Free
|
||||
}
|
||||
|
||||
_, sscParity := getRedundancyCount(standardStorageClass, len(disks))
|
||||
@ -131,7 +133,10 @@ func getStorageInfo(disks []StorageAPI) StorageInfo {
|
||||
|
||||
storageInfo := StorageInfo{
|
||||
Used: used,
|
||||
Total: total,
|
||||
Available: available,
|
||||
}
|
||||
|
||||
storageInfo.Backend.Type = BackendErasure
|
||||
storageInfo.Backend.OnlineDisks = onlineDisks
|
||||
storageInfo.Backend.OfflineDisks = offlineDisks
|
||||
|
@ -131,63 +131,64 @@ Sends a service action command to service - possible actions are restarting and
|
||||
Fetches information for all cluster nodes, such as server properties, storage information, network statistics, etc.
|
||||
|
||||
| Param | Type | Description |
|
||||
|---|---|---|
|
||||
|`si.Addr` | _string_ | Address of the server the following information is retrieved from. |
|
||||
|`si.ConnStats` | _ServerConnStats_ | Connection statistics from the given server. |
|
||||
|`si.HTTPStats` | _ServerHTTPStats_ | HTTP connection statistics from the given server. |
|
||||
|`si.Properties` | _ServerProperties_ | Server properties such as region, notification targets. |
|
||||
|`si.Data.StorageInfo.Total` | _int64_ | Total disk space. |
|
||||
|`si.Data.StorageInfo.Free` | _int64_ | Free disk space. |
|
||||
|`si.Data.StorageInfo.Backend`| _struct{}_ | Represents backend type embedded structure. |
|
||||
|---------------------------------|--------------------|--------------------------------------------------------------------|
|
||||
| `si.Addr` | _string_ | Address of the server the following information is retrieved from. |
|
||||
| `si.ConnStats` | _ServerConnStats_ | Connection statistics from the given server. |
|
||||
| `si.HTTPStats` | _ServerHTTPStats_ | HTTP connection statistics from the given server. |
|
||||
| `si.Properties` | _ServerProperties_ | Server properties such as region, notification targets. |
|
||||
| `si.Data.StorageInfo.Used` | _int64_ | Used disk space. |
|
||||
| `si.Data.StorageInfo.Total` | _int64_ | Total disk space. |
|
||||
| `si.Data.StorageInfo.Available` | _int64_ | Available disk space. |
|
||||
| `si.Data.StorageInfo.Backend` | _struct{}_ | Represents backend type embedded structure. |
|
||||
|
||||
| Param | Type | Description |
|
||||
|---|---|---|
|
||||
|`ServerProperties.Uptime`| _time.Duration_ | Total duration in seconds since server is running. |
|
||||
|`ServerProperties.Version`| _string_ | Current server version. |
|
||||
|`ServerProperties.CommitID` | _string_ | Current server commitID. |
|
||||
|`ServerProperties.Region` | _string_ | Configured server region. |
|
||||
|`ServerProperties.SQSARN` | _[]string_ | List of notification target ARNs. |
|
||||
|-----------------------------|-----------------|----------------------------------------------------|
|
||||
| `ServerProperties.Uptime` | _time.Duration_ | Total duration in seconds since server is running. |
|
||||
| `ServerProperties.Version` | _string_ | Current server version. |
|
||||
| `ServerProperties.CommitID` | _string_ | Current server commitID. |
|
||||
| `ServerProperties.Region` | _string_ | Configured server region. |
|
||||
| `ServerProperties.SQSARN` | _[]string_ | List of notification target ARNs. |
|
||||
|
||||
| Param | Type | Description |
|
||||
|---|---|---|
|
||||
|`ServerConnStats.TotalInputBytes` | _uint64_ | Total bytes received by the server. |
|
||||
|`ServerConnStats.TotalOutputBytes` | _uint64_ | Total bytes sent by the server. |
|
||||
|------------------------------------|----------|-------------------------------------|
|
||||
| `ServerConnStats.TotalInputBytes` | _uint64_ | Total bytes received by the server. |
|
||||
| `ServerConnStats.TotalOutputBytes` | _uint64_ | Total bytes sent by the server. |
|
||||
|
||||
| Param | Type | Description |
|
||||
|---|---|---|
|
||||
|`ServerHTTPStats.TotalHEADStats`| _ServerHTTPMethodStats_ | Total statistics regarding HEAD operations |
|
||||
|`ServerHTTPStats.SuccessHEADStats`| _ServerHTTPMethodStats_ | Total statistics regarding successful HEAD operations |
|
||||
|`ServerHTTPStats.TotalGETStats`| _ServerHTTPMethodStats_ | Total statistics regarding GET operations |
|
||||
|`ServerHTTPStats.SuccessGETStats`| _ServerHTTPMethodStats_ | Total statistics regarding successful GET operations |
|
||||
|`ServerHTTPStats.TotalPUTStats`| _ServerHTTPMethodStats_ | Total statistics regarding PUT operations |
|
||||
|`ServerHTTPStats.SuccessPUTStats`| _ServerHTTPMethodStats_ | Total statistics regarding successful PUT operations |
|
||||
|`ServerHTTPStats.TotalPOSTStats`| _ServerHTTPMethodStats_ | Total statistics regarding POST operations |
|
||||
|`ServerHTTPStats.SuccessPOSTStats`| _ServerHTTPMethodStats_ | Total statistics regarding successful POST operations |
|
||||
|`ServerHTTPStats.TotalDELETEStats`| _ServerHTTPMethodStats_ | Total statistics regarding DELETE operations |
|
||||
|`ServerHTTPStats.SuccessDELETEStats`| _ServerHTTPMethodStats_ | Total statistics regarding successful DELETE operations |
|
||||
|--------------------------------------|-------------------------|---------------------------------------------------------|
|
||||
| `ServerHTTPStats.TotalHEADStats` | _ServerHTTPMethodStats_ | Total statistics regarding HEAD operations |
|
||||
| `ServerHTTPStats.SuccessHEADStats` | _ServerHTTPMethodStats_ | Total statistics regarding successful HEAD operations |
|
||||
| `ServerHTTPStats.TotalGETStats` | _ServerHTTPMethodStats_ | Total statistics regarding GET operations |
|
||||
| `ServerHTTPStats.SuccessGETStats` | _ServerHTTPMethodStats_ | Total statistics regarding successful GET operations |
|
||||
| `ServerHTTPStats.TotalPUTStats` | _ServerHTTPMethodStats_ | Total statistics regarding PUT operations |
|
||||
| `ServerHTTPStats.SuccessPUTStats` | _ServerHTTPMethodStats_ | Total statistics regarding successful PUT operations |
|
||||
| `ServerHTTPStats.TotalPOSTStats` | _ServerHTTPMethodStats_ | Total statistics regarding POST operations |
|
||||
| `ServerHTTPStats.SuccessPOSTStats` | _ServerHTTPMethodStats_ | Total statistics regarding successful POST operations |
|
||||
| `ServerHTTPStats.TotalDELETEStats` | _ServerHTTPMethodStats_ | Total statistics regarding DELETE operations |
|
||||
| `ServerHTTPStats.SuccessDELETEStats` | _ServerHTTPMethodStats_ | Total statistics regarding successful DELETE operations |
|
||||
|
||||
|
||||
| Param | Type | Description |
|
||||
|---|---|---|
|
||||
|`ServerHTTPMethodStats.Count` | _uint64_ | Total number of operations. |
|
||||
|`ServerHTTPMethodStats.AvgDuration` | _string_ | Average duration of Count number of operations. |
|
||||
|-------------------------------------|----------|-------------------------------------------------|
|
||||
| `ServerHTTPMethodStats.Count` | _uint64_ | Total number of operations. |
|
||||
| `ServerHTTPMethodStats.AvgDuration` | _string_ | Average duration of Count number of operations. |
|
||||
|
||||
| Param | Type | Description |
|
||||
|---|---|---|
|
||||
|`Backend.Type` | _BackendType_ | Type of backend used by the server currently only FS or Erasure. |
|
||||
|`Backend.OnlineDisks`| _int_ | Total number of disks online (only applies to Erasure backend), is empty for FS. |
|
||||
|`Backend.OfflineDisks` | _int_ | Total number of disks offline (only applies to Erasure backend), is empty for FS. |
|
||||
|`Backend.StandardSCData` | _int_ | Data disks set for standard storage class, is empty for FS. |
|
||||
|`Backend.StandardSCParity` | _int_ | Parity disks set for standard storage class, is empty for FS. |
|
||||
|`Backend.RRSCData` | _int_ | Data disks set for reduced redundancy storage class, is empty for FS. |
|
||||
|`Backend.RRSCParity` | _int_ | Parity disks set for reduced redundancy storage class, is empty for FS. |
|
||||
|`Backend.Sets` | _[][]DriveInfo_ | Represents topology of drives in erasure coded sets. |
|
||||
|----------------------------|-----------------|-----------------------------------------------------------------------------------|
|
||||
| `Backend.Type` | _BackendType_ | Type of backend used by the server currently only FS or Erasure. |
|
||||
| `Backend.OnlineDisks` | _int_ | Total number of disks online (only applies to Erasure backend), is empty for FS. |
|
||||
| `Backend.OfflineDisks` | _int_ | Total number of disks offline (only applies to Erasure backend), is empty for FS. |
|
||||
| `Backend.StandardSCData` | _int_ | Data disks set for standard storage class, is empty for FS. |
|
||||
| `Backend.StandardSCParity` | _int_ | Parity disks set for standard storage class, is empty for FS. |
|
||||
| `Backend.RRSCData` | _int_ | Data disks set for reduced redundancy storage class, is empty for FS. |
|
||||
| `Backend.RRSCParity` | _int_ | Parity disks set for reduced redundancy storage class, is empty for FS. |
|
||||
| `Backend.Sets` | _[][]DriveInfo_ | Represents topology of drives in erasure coded sets. |
|
||||
|
||||
| Param | Type | Description |
|
||||
|---|---|---|
|
||||
|`DriveInfo.UUID`| _string_ | Unique ID for each disk provisioned by server format. |
|
||||
|`DriveInfo.Endpoint` | _string_ | Endpoint location of the remote/local disk. |
|
||||
|`DriveInfo.State` | _string_ | Current state of the disk at endpoint. |
|
||||
|----------------------|----------|-------------------------------------------------------|
|
||||
| `DriveInfo.UUID` | _string_ | Unique ID for each disk provisioned by server format. |
|
||||
| `DriveInfo.Endpoint` | _string_ | Endpoint location of the remote/local disk. |
|
||||
| `DriveInfo.State` | _string_ | Current state of the disk at endpoint. |
|
||||
|
||||
__Example__
|
||||
|
||||
|
@ -51,6 +51,10 @@ type DriveInfo HealDriveInfo
|
||||
type StorageInfo struct {
|
||||
Used uint64 // Total used spaced per tenant.
|
||||
|
||||
Available uint64 // Total available space.
|
||||
|
||||
Total uint64 // Total disk space.
|
||||
|
||||
// Backend type.
|
||||
Backend struct {
|
||||
// Represents various backend types, currently on FS and Erasure.
|
||||
|
Loading…
Reference in New Issue
Block a user