25 lines
370 B
Go
25 lines
370 B
Go
|
package checks
|
||
|
|
||
|
import "github.com/shirou/gopsutil/disk"
|
||
|
|
||
|
type HDD struct {
|
||
|
|
||
|
}
|
||
|
|
||
|
func (h HDD) Execute() (ok bool, err error) {
|
||
|
parts, _ := disk.Partitions(true)
|
||
|
|
||
|
for _, p := range parts {
|
||
|
device := p.Mountpoint
|
||
|
s, _ := disk.Usage(device)
|
||
|
if s.UsedPercent > 80 {
|
||
|
return false, nil
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return true, nil
|
||
|
}
|
||
|
|
||
|
func (h HDD) Name() string {
|
||
|
return "Disc space"
|
||
|
}
|