mirror of
https://github.com/minio/minio.git
synced 2025-04-24 04:10:43 -04:00
Add free inode metric for Prometheus (#12225)
This commit is contained in:
parent
2fd9c13b50
commit
776589f0da
@ -197,6 +197,7 @@ func getDisksInfo(disks []StorageAPI, endpoints []string) (disksInfo []madmin.Di
|
|||||||
RootDisk: info.RootDisk,
|
RootDisk: info.RootDisk,
|
||||||
Healing: info.Healing,
|
Healing: info.Healing,
|
||||||
State: diskErrToDriveState(err),
|
State: diskErrToDriveState(err),
|
||||||
|
FreeInodes: info.FreeInodes,
|
||||||
}
|
}
|
||||||
di.PoolIndex, di.SetIndex, di.DiskIndex = disks[index].GetDiskLoc()
|
di.PoolIndex, di.SetIndex, di.DiskIndex = disks[index].GetDiskLoc()
|
||||||
if info.Healing {
|
if info.Healing {
|
||||||
|
@ -93,6 +93,7 @@ const (
|
|||||||
timestampTotal MetricName = "timestamp_total"
|
timestampTotal MetricName = "timestamp_total"
|
||||||
writeTotal MetricName = "write_total"
|
writeTotal MetricName = "write_total"
|
||||||
total MetricName = "total"
|
total MetricName = "total"
|
||||||
|
freeInodes MetricName = "free_inodes"
|
||||||
|
|
||||||
failedCount MetricName = "failed_count"
|
failedCount MetricName = "failed_count"
|
||||||
failedBytes MetricName = "failed_bytes"
|
failedBytes MetricName = "failed_bytes"
|
||||||
@ -352,6 +353,16 @@ func getClusterDisksTotalMD() MetricDescription {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getClusterDisksFreeInodes() MetricDescription {
|
||||||
|
return MetricDescription{
|
||||||
|
Namespace: clusterMetricNamespace,
|
||||||
|
Subsystem: diskSubsystem,
|
||||||
|
Name: freeInodes,
|
||||||
|
Help: "Total free inodes.",
|
||||||
|
Type: gaugeMetric,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func getNodeDiskTotalBytesMD() MetricDescription {
|
func getNodeDiskTotalBytesMD() MetricDescription {
|
||||||
return MetricDescription{
|
return MetricDescription{
|
||||||
Namespace: nodeMetricNamespace,
|
Namespace: nodeMetricNamespace,
|
||||||
@ -1386,6 +1397,12 @@ func getLocalStorageMetrics() MetricsGroup {
|
|||||||
Value: float64(disk.TotalSpace),
|
Value: float64(disk.TotalSpace),
|
||||||
VariableLabels: map[string]string{"disk": disk.DrivePath},
|
VariableLabels: map[string]string{"disk": disk.DrivePath},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
metrics = append(metrics, Metric{
|
||||||
|
Description: getClusterDisksFreeInodes(),
|
||||||
|
Value: float64(disk.FreeInodes),
|
||||||
|
VariableLabels: map[string]string{"disk": disk.DrivePath},
|
||||||
|
})
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
},
|
},
|
||||||
|
@ -32,6 +32,7 @@ type DiskInfo struct {
|
|||||||
Free uint64
|
Free uint64
|
||||||
Used uint64
|
Used uint64
|
||||||
UsedInodes uint64
|
UsedInodes uint64
|
||||||
|
FreeInodes uint64
|
||||||
FSType string
|
FSType string
|
||||||
RootDisk bool
|
RootDisk bool
|
||||||
Healing bool
|
Healing bool
|
||||||
|
@ -14,8 +14,8 @@ func (z *DiskInfo) DecodeMsg(dc *msgp.Reader) (err error) {
|
|||||||
err = msgp.WrapError(err)
|
err = msgp.WrapError(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if zb0001 != 12 {
|
if zb0001 != 13 {
|
||||||
err = msgp.ArrayError{Wanted: 12, Got: zb0001}
|
err = msgp.ArrayError{Wanted: 13, Got: zb0001}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
z.Total, err = dc.ReadUint64()
|
z.Total, err = dc.ReadUint64()
|
||||||
@ -38,6 +38,11 @@ func (z *DiskInfo) DecodeMsg(dc *msgp.Reader) (err error) {
|
|||||||
err = msgp.WrapError(err, "UsedInodes")
|
err = msgp.WrapError(err, "UsedInodes")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
z.FreeInodes, err = dc.ReadUint64()
|
||||||
|
if err != nil {
|
||||||
|
err = msgp.WrapError(err, "FreeInodes")
|
||||||
|
return
|
||||||
|
}
|
||||||
z.FSType, err = dc.ReadString()
|
z.FSType, err = dc.ReadString()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = msgp.WrapError(err, "FSType")
|
err = msgp.WrapError(err, "FSType")
|
||||||
@ -83,8 +88,8 @@ func (z *DiskInfo) DecodeMsg(dc *msgp.Reader) (err error) {
|
|||||||
|
|
||||||
// EncodeMsg implements msgp.Encodable
|
// EncodeMsg implements msgp.Encodable
|
||||||
func (z *DiskInfo) EncodeMsg(en *msgp.Writer) (err error) {
|
func (z *DiskInfo) EncodeMsg(en *msgp.Writer) (err error) {
|
||||||
// array header, size 12
|
// array header, size 13
|
||||||
err = en.Append(0x9c)
|
err = en.Append(0x9d)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -108,6 +113,11 @@ func (z *DiskInfo) EncodeMsg(en *msgp.Writer) (err error) {
|
|||||||
err = msgp.WrapError(err, "UsedInodes")
|
err = msgp.WrapError(err, "UsedInodes")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
err = en.WriteUint64(z.FreeInodes)
|
||||||
|
if err != nil {
|
||||||
|
err = msgp.WrapError(err, "FreeInodes")
|
||||||
|
return
|
||||||
|
}
|
||||||
err = en.WriteString(z.FSType)
|
err = en.WriteString(z.FSType)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = msgp.WrapError(err, "FSType")
|
err = msgp.WrapError(err, "FSType")
|
||||||
@ -154,12 +164,13 @@ func (z *DiskInfo) EncodeMsg(en *msgp.Writer) (err error) {
|
|||||||
// MarshalMsg implements msgp.Marshaler
|
// MarshalMsg implements msgp.Marshaler
|
||||||
func (z *DiskInfo) MarshalMsg(b []byte) (o []byte, err error) {
|
func (z *DiskInfo) MarshalMsg(b []byte) (o []byte, err error) {
|
||||||
o = msgp.Require(b, z.Msgsize())
|
o = msgp.Require(b, z.Msgsize())
|
||||||
// array header, size 12
|
// array header, size 13
|
||||||
o = append(o, 0x9c)
|
o = append(o, 0x9d)
|
||||||
o = msgp.AppendUint64(o, z.Total)
|
o = msgp.AppendUint64(o, z.Total)
|
||||||
o = msgp.AppendUint64(o, z.Free)
|
o = msgp.AppendUint64(o, z.Free)
|
||||||
o = msgp.AppendUint64(o, z.Used)
|
o = msgp.AppendUint64(o, z.Used)
|
||||||
o = msgp.AppendUint64(o, z.UsedInodes)
|
o = msgp.AppendUint64(o, z.UsedInodes)
|
||||||
|
o = msgp.AppendUint64(o, z.FreeInodes)
|
||||||
o = msgp.AppendString(o, z.FSType)
|
o = msgp.AppendString(o, z.FSType)
|
||||||
o = msgp.AppendBool(o, z.RootDisk)
|
o = msgp.AppendBool(o, z.RootDisk)
|
||||||
o = msgp.AppendBool(o, z.Healing)
|
o = msgp.AppendBool(o, z.Healing)
|
||||||
@ -183,8 +194,8 @@ func (z *DiskInfo) UnmarshalMsg(bts []byte) (o []byte, err error) {
|
|||||||
err = msgp.WrapError(err)
|
err = msgp.WrapError(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if zb0001 != 12 {
|
if zb0001 != 13 {
|
||||||
err = msgp.ArrayError{Wanted: 12, Got: zb0001}
|
err = msgp.ArrayError{Wanted: 13, Got: zb0001}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
z.Total, bts, err = msgp.ReadUint64Bytes(bts)
|
z.Total, bts, err = msgp.ReadUint64Bytes(bts)
|
||||||
@ -207,6 +218,11 @@ func (z *DiskInfo) UnmarshalMsg(bts []byte) (o []byte, err error) {
|
|||||||
err = msgp.WrapError(err, "UsedInodes")
|
err = msgp.WrapError(err, "UsedInodes")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
z.FreeInodes, bts, err = msgp.ReadUint64Bytes(bts)
|
||||||
|
if err != nil {
|
||||||
|
err = msgp.WrapError(err, "FreeInodes")
|
||||||
|
return
|
||||||
|
}
|
||||||
z.FSType, bts, err = msgp.ReadStringBytes(bts)
|
z.FSType, bts, err = msgp.ReadStringBytes(bts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = msgp.WrapError(err, "FSType")
|
err = msgp.WrapError(err, "FSType")
|
||||||
@ -253,7 +269,7 @@ func (z *DiskInfo) UnmarshalMsg(bts []byte) (o []byte, err error) {
|
|||||||
|
|
||||||
// Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
|
// Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
|
||||||
func (z *DiskInfo) Msgsize() (s int) {
|
func (z *DiskInfo) Msgsize() (s int) {
|
||||||
s = 1 + msgp.Uint64Size + msgp.Uint64Size + msgp.Uint64Size + msgp.Uint64Size + msgp.StringPrefixSize + len(z.FSType) + msgp.BoolSize + msgp.BoolSize + msgp.StringPrefixSize + len(z.Endpoint) + msgp.StringPrefixSize + len(z.MountPath) + msgp.StringPrefixSize + len(z.ID) + z.Metrics.Msgsize() + msgp.StringPrefixSize + len(z.Error)
|
s = 1 + msgp.Uint64Size + msgp.Uint64Size + msgp.Uint64Size + msgp.Uint64Size + msgp.Uint64Size + msgp.StringPrefixSize + len(z.FSType) + msgp.BoolSize + msgp.BoolSize + msgp.StringPrefixSize + len(z.Endpoint) + msgp.StringPrefixSize + len(z.MountPath) + msgp.StringPrefixSize + len(z.ID) + z.Metrics.Msgsize() + msgp.StringPrefixSize + len(z.Error)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
const (
|
const (
|
||||||
storageRESTVersion = "v32" // Added transition related information to FileInfo
|
storageRESTVersion = "v33" // Added transition related information to FileInfo
|
||||||
storageRESTVersionPrefix = SlashSeparator + storageRESTVersion
|
storageRESTVersionPrefix = SlashSeparator + storageRESTVersion
|
||||||
storageRESTPrefix = minioReservedBucketPath + "/storage"
|
storageRESTPrefix = minioReservedBucketPath + "/storage"
|
||||||
)
|
)
|
||||||
|
@ -471,6 +471,7 @@ func (s *xlStorage) DiskInfo(context.Context) (info DiskInfo, err error) {
|
|||||||
dcinfo.Free = di.Free
|
dcinfo.Free = di.Free
|
||||||
dcinfo.Used = di.Used
|
dcinfo.Used = di.Used
|
||||||
dcinfo.UsedInodes = di.Files - di.Ffree
|
dcinfo.UsedInodes = di.Files - di.Ffree
|
||||||
|
dcinfo.FreeInodes = di.Ffree
|
||||||
dcinfo.FSType = di.FSType
|
dcinfo.FSType = di.FSType
|
||||||
|
|
||||||
diskID, err := s.GetDiskID()
|
diskID, err := s.GetDiskID()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user