mirror of
https://github.com/fankes/komari-agent.git
synced 2025-10-19 19:19:23 +08:00
feat: 启动时输出监控的文件夹和网卡名
This commit is contained in:
@@ -90,3 +90,27 @@ func isPhysicalDisk(part disk.PartitionStat) bool {
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func DiskList() ([]string, error) {
|
||||
diskList := []string{}
|
||||
if flags.IncludeMountpoints != "" {
|
||||
includeMounts := strings.Split(flags.IncludeMountpoints, ";")
|
||||
for _, mountpoint := range includeMounts {
|
||||
mountpoint = strings.TrimSpace(mountpoint)
|
||||
if mountpoint != "" {
|
||||
diskList = append(diskList, mountpoint)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
usage, err := disk.Partitions(false)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, part := range usage {
|
||||
if isPhysicalDisk(part) {
|
||||
diskList = append(diskList, part.Mountpoint)
|
||||
}
|
||||
}
|
||||
}
|
||||
return diskList, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user