예제 #1
0
func GetFileSystemList75() []string {
	result := []string{}
	volumes := []sigar.FileSystem{}

	if runtime.GOOS == "windows" {
		volumes = getWindowsDrives()
	} else {
		fslist := sigar.FileSystemList{}
		fslist.Get()
		volumes = fslist.List
	}

	for _, volume := range volumes {
		dirName := volume.DirName
		usage := sigar.FileSystemUsage{}
		usage.Get(dirName)

		if usage.UsePercent() >= 75 {
			result = append(result, fmt.Sprintf("%s (%s)",
				dirName,
				sigar.FormatPercent(usage.UsePercent())))
		}
	}
	return result
}
예제 #2
0
파일: helper.go 프로젝트: andrewkroh/beats
func GetFileSystemList() ([]sigar.FileSystem, error) {

	fss := sigar.FileSystemList{}
	err := fss.Get()
	if err != nil {
		return nil, err
	}

	return fss.List, nil
}
예제 #3
0
파일: df.go 프로젝트: ChongFeng/beats
func main() {
	fslist := gosigar.FileSystemList{}
	fslist.Get()

	fmt.Fprintf(os.Stdout, output_format,
		"Filesystem", "Size", "Used", "Avail", "Use%", "Mounted on")

	for _, fs := range fslist.List {
		dir_name := fs.DirName

		usage := gosigar.FileSystemUsage{}

		usage.Get(dir_name)

		fmt.Fprintf(os.Stdout, output_format,
			fs.DevName,
			gosigar.FormatSize(usage.Total),
			gosigar.FormatSize(usage.Used),
			gosigar.FormatSize(usage.Avail),
			gosigar.FormatPercent(usage.UsePercent()),
			dir_name)
	}
}