Commit 4f6e4f73 authored by Pavel Trukhanov's avatar Pavel Trukhanov Committed by Nikolay Sivko

disk_usage as in psutil

parent 79f4358f
......@@ -16,14 +16,14 @@ func DiskUsage(path string) (*DiskUsageStat, error) {
ret := &DiskUsageStat{
Path: path,
Total: (uint64(stat.Blocks) * uint64(bsize)),
Free: (uint64(stat.Bfree) * uint64(bsize)),
Free: (uint64(stat.Bavail) * uint64(bsize)),
InodesTotal: (uint64(stat.Files)),
InodesFree: (uint64(stat.Ffree)),
}
ret.InodesUsed = (ret.InodesTotal - ret.InodesFree)
ret.InodesUsedPercent = (float64(ret.InodesUsed) / float64(ret.InodesTotal)) * 100.0
ret.Used = (ret.Total - ret.Free)
ret.Used = (uint64(stat.Blocks) - uint64(stat.Bfree)) * uint64(bsize)
ret.UsedPercent = (float64(ret.Used) / float64(ret.Total)) * 100.0
return ret, nil
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment