change memoer check output
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
a1d2a82742
commit
b5196312d2
2 changed files with 23 additions and 6 deletions
|
@ -15,11 +15,14 @@ type Memory struct {
|
|||
func (h Memory) Execute() (ok bool, data interface{}, err error) {
|
||||
memory, err := memory.Get()
|
||||
p := float64(100) / float64(memory.Total) * float64(memory.Used)
|
||||
res := make(map[string]interface{})
|
||||
res["row"] = memory
|
||||
res["ram"] = p
|
||||
if p > h.Config.Max {
|
||||
return false, memory, nil
|
||||
return false, res, nil
|
||||
}
|
||||
|
||||
return true, memory,nil
|
||||
return true, res,nil
|
||||
}
|
||||
|
||||
func (h Memory) Name() string {
|
||||
|
|
|
@ -30,12 +30,11 @@
|
|||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<div class="card-header" id="ramtitle">
|
||||
Check RAM
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">Check ram</h5>
|
||||
<p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
|
||||
<p class="card-text" id="rampercent">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -76,11 +75,26 @@
|
|||
$("#hddtitle").addClass("bg-danger");
|
||||
$("#hddtitle").removeClass("bg-success");
|
||||
}
|
||||
|
||||
//ram
|
||||
|
||||
if (o.Checks["Memory usage"].success) {
|
||||
$("#ramtitle").addClass("bg-success");
|
||||
$("#ramtitle").removeClass("bg-error");
|
||||
} else {
|
||||
$("#ramtitle").addClass("bg-danger");
|
||||
$("#ramtitle").removeClass("bg-success");
|
||||
}
|
||||
|
||||
$("#rampercent").empty()
|
||||
$("#rampercent").append('<b>Ram</b><br><div class="progress"><div class="progress-bar" role="progressbar" style="width: '+o.Checks["Memory usage"].data["ram"]+'%;" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100">' +o.Checks["Memory usage"].data["ram"]+ '%</div></div>');
|
||||
|
||||
|
||||
console.log(keys)
|
||||
console.log(o.Checks["Disc space"].success)
|
||||
|
||||
|
||||
setTimeout("getData();", 2000);
|
||||
setTimeout("getData();", 10000);
|
||||
}
|
||||
getData();
|
||||
</script>
|
||||
|
|
Loading…
Reference in a new issue