Data
All checks were successful
continuous-integration/drone/push Build is passing

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) { func (h HDD) Execute() (ok bool, data interface{}, err error) {
success := true
parts, _ := disk.Partitions(true) parts, _ := disk.Partitions(true)
log.Debug().Int("max_percent", h.Config.MaxPercent).Msg("Execute HDD Check") log.Debug().Int("max_percent", h.Config.MaxPercent).Msg("Execute HDD Check")
usage := make(map[string]float64)
for _, p := range parts { for _, p := range parts {
device := p.Mountpoint device := p.Mountpoint
s, _ := disk.Usage(device) s, _ := disk.Usage(device)
usage[device] = s.UsedPercent
if s.UsedPercent > float64(h.Config.MaxPercent) { 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 { 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() memory, err := memory.Get()
p := float64(100) / float64(memory.Total) * float64(memory.Used) p := float64(100) / float64(memory.Total) * float64(memory.Used)
if p > h.Config.Max { 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 { func (h Memory) Name() string {