Data
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Kekskurse 2021-09-20 13:55:47 +02:00
parent df1f08922b
commit 7643c96afb
Signed by: kekskurse
GPG Key ID: 728ACCB59341E7E4
2 changed files with 8 additions and 5 deletions

View File

@ -14,18 +14,21 @@ type HDD struct {
}
func (h HDD) Execute() (ok bool, data interface{}, err error) {
success := true
parts, _ := disk.Partitions(true)
log.Debug().Int("max_percent", h.Config.MaxPercent).Msg("Execute HDD Check")
usage := make(map[string]float64)
for _, p := range parts {
device := p.Mountpoint
s, _ := disk.Usage(device)
usage[device] = s.UsedPercent
if s.UsedPercent > float64(h.Config.MaxPercent) {
return false, nil,nil
success = false
//return false, parts,nil
}
}
return true, nil,nil
return success, usage,nil
}
func (h HDD) Name() string {

View File

@ -16,10 +16,10 @@ func (h Memory) Execute() (ok bool, data interface{}, err error) {
memory, err := memory.Get()
p := float64(100) / float64(memory.Total) * float64(memory.Used)
if p > h.Config.Max {
return false, nil, nil
return false, memory, nil
}
return true, nil,nil
return true, memory,nil
}
func (h Memory) Name() string {