예제 #1
0
파일: collect.go 프로젝트: vadv/ostent
func _getmem(kind string, in sigar.Swap) operating.Memory {
	total, approxtotal, _ := format.HumanBandback(in.Total)
	used, approxused, _ := format.HumanBandback(in.Used)

	return operating.Memory{
		Kind:       operating.Field(kind),
		Total:      total,
		Used:       used,
		Free:       format.HumanB(in.Free),
		UsePercent: format.FormatPercent(approxused, approxtotal),
	}
}
예제 #2
0
파일: index.go 프로젝트: vadv/ostent
func FormatDFinodes(md operating.MetricDF) operating.DiskInodes {
	var (
		diskInodes = md.Inodes.Snapshot().Value()
		diskIused  = md.Iused.Snapshot().Value()
		diskIfree  = md.Ifree.Snapshot().Value()
	)
	itotal, approxitotal, _ := format.HumanBandback(uint64(diskInodes))
	iused, approxiused, _ := format.HumanBandback(uint64(diskIused))
	return operating.DiskInodes{
		DiskMeta:    diskMeta(md),
		Inodes:      itotal,
		Iused:       iused,
		Ifree:       format.HumanB(uint64(diskIfree)),
		IusePercent: format.FormatPercent(approxiused, approxitotal),
	}
}
예제 #3
0
파일: index.go 프로젝트: vadv/ostent
func FormatDFbytes(md operating.MetricDF) operating.DiskBytes {
	var (
		diskTotal = md.Total.Snapshot().Value()
		diskUsed  = md.Used.Snapshot().Value()
		diskAvail = md.Avail.Snapshot().Value()
	)
	total, approxtotal, _ := format.HumanBandback(uint64(diskTotal))
	used, approxused, _ := format.HumanBandback(uint64(diskUsed))
	return operating.DiskBytes{
		DiskMeta:   diskMeta(md),
		Total:      total,
		Used:       used,
		Avail:      format.HumanB(uint64(diskAvail)),
		UsePercent: format.FormatPercent(approxused, approxtotal),
	}
}