diff --git a/config.yml b/config.yml
index ba4ff73..011bd31 100644
--- a/config.yml
+++ b/config.yml
@@ -10,3 +10,4 @@ checks:
max_load_15: 5
memory:
max: 100
+ max_swap: 80
diff --git a/internal/pkg/checks/memory.go b/internal/pkg/checks/memory.go
index 97cac53..fcdba5e 100644
--- a/internal/pkg/checks/memory.go
+++ b/internal/pkg/checks/memory.go
@@ -6,6 +6,7 @@ import (
type MemoryConfig struct {
Max float64 `yaml:"max"`
+ MaxSwap float64 `yaml:"max_swap"`
}
type Memory struct {
@@ -15,12 +16,17 @@ 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)
+ ps := float64(100) / float64(memory.SwapTotal) * float64(memory.SwapUsed)
res := make(map[string]interface{})
res["row"] = memory
res["ram"] = p
+ res["swap"] = ps
if p > h.Config.Max {
return false, res, nil
}
+ if ps > h.Config.MaxSwap {
+ return false, res, nil
+ }
return true, res,nil
}
diff --git a/template/index.html b/template/index.html
index d237671..27249d5 100644
--- a/template/index.html
+++ b/template/index.html
@@ -51,6 +51,8 @@
if(data.responseText != "") {
handleData(data)
}
+
+ setTimeout("getData();", 10000);
});
}
@@ -88,13 +90,14 @@
$("#rampercent").empty()
$("#rampercent").append('Ram