disk.go 1.3 KB
Newer Older
S
Shirou WAKAYAMA 已提交
1
package disk
W
WAKAYAMA Shirou 已提交
2

3 4 5 6
import (
	"encoding/json"
)

W
WAKAYAMA Shirou 已提交
7
type DiskUsageStat struct {
W
WAKAYAMA Shirou 已提交
8
	Path              string  `json:"path"`
9
	Fstype            string  `json:"fstype"`
W
WAKAYAMA Shirou 已提交
10 11 12
	Total             uint64  `json:"total"`
	Free              uint64  `json:"free"`
	Used              uint64  `json:"used"`
13 14 15 16 17
	UsedPercent       float64 `json:"used_percent"`
	InodesTotal       uint64  `json:"inodes_total"`
	InodesUsed        uint64  `json:"inodes_used"`
	InodesFree        uint64  `json:"inodes_free"`
	InodesUsedPercent float64 `json:"inodes_used_percent"`
W
WAKAYAMA Shirou 已提交
18 19
}

W
WAKAYAMA Shirou 已提交
20
type DiskPartitionStat struct {
21 22 23 24 25 26
	Device     string `json:"device"`
	Mountpoint string `json:"mountpoint"`
	Fstype     string `json:"fstype"`
	Opts       string `json:"opts"`
}

W
WAKAYAMA Shirou 已提交
27
type DiskIOCountersStat struct {
28 29 30 31 32 33
	ReadCount    uint64 `json:"read_count"`
	WriteCount   uint64 `json:"write_count"`
	ReadBytes    uint64 `json:"read_bytes"`
	WriteBytes   uint64 `json:"write_bytes"`
	ReadTime     uint64 `json:"read_time"`
	WriteTime    uint64 `json:"write_time"`
34
	Name         string `json:"name"`
35 36
	IoTime       uint64 `json:"io_time"`
	SerialNumber string `json:"serial_number"`
W
WAKAYAMA Shirou 已提交
37
}
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52

func (d DiskUsageStat) String() string {
	s, _ := json.Marshal(d)
	return string(s)
}

func (d DiskPartitionStat) String() string {
	s, _ := json.Marshal(d)
	return string(s)
}

func (d DiskIOCountersStat) String() string {
	s, _ := json.Marshal(d)
	return string(s)
}