disk

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 14, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	B  = 1
	KB = 1024 * B
	MB = 1024 * KB
	GB = 1024 * MB
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DiskInfo

type DiskInfo struct {
	Path              string  `json:"path"`              //挂着点
	Device            string  `json:"device"`            //设备名称
	Fstype            string  `json:"fstype"`            //文件系统类型
	Total             uint64  `json:"total"`             //总计大小(MB)
	Free              uint64  `json:"free"`              //剩余大小(MB)
	Used              uint64  `json:"used"`              //已使用大小(MB)
	UsedPercent       float64 `json:"usedPercent"`       //使用率
	InodesTotal       uint64  `json:"inodesTotal"`       //inode统计大小
	InodesUsed        uint64  `json:"inodesUsed"`        //inode已使用大小
	InodesFree        uint64  `json:"inodesFree"`        //inode剩余大小
	InodesUsedPercent float64 `json:"inodesUsedPercent"` //inode使用率
	LastTime          string  `json:"lastTime"`          //采集时间
}

func GetAllDiskInfo

func GetAllDiskInfo(all bool) []*DiskInfo

GetAllDiskInfo Partitions returns disk partitions. If all is false, returns physical devices only (e.g. hard disks, cd-rom drives, USB keys) and ignore all others (e.g. memory partitions such as /dev/shm)

func GetAllPhysicalDiskInfo

func GetAllPhysicalDiskInfo() []*DiskInfo

GetAllDiskInfo 获取所有物理磁盘信息 Partitions returns disk partitions. If all is false, returns physical devices only (e.g. hard disks, cd-rom drives, USB keys) and ignore all others (e.g. memory partitions such as /dev/shm)

func GetDiskInfo

func GetDiskInfo() *DiskInfo

获取根路径磁盘信息

func GetDiskInfoByPath

func GetDiskInfoByPath(path string) *DiskInfo

获取磁盘信息

func NewDiskInfo

func NewDiskInfo() *DiskInfo

func (DiskInfo) String

func (o DiskInfo) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL