diff options
-rw-r--r-- | cmd/moncheck/main.go | 5 | ||||
-rw-r--r-- | moncheck.conf.example | 9 |
2 files changed, 11 insertions, 3 deletions
diff --git a/cmd/moncheck/main.go b/cmd/moncheck/main.go index 2c3ca27..28b177e 100644 --- a/cmd/moncheck/main.go +++ b/cmd/moncheck/main.go @@ -31,6 +31,7 @@ type ( Timeout string `json:"timeout"` Wait string `json:"wait"` Path []string `json:"path"` + Workers int `json:"workers"` } States []int @@ -43,7 +44,7 @@ func main() { if err != nil { log.Fatalf("could not read config: %s", err) } - config := Config{Timeout: "30s", Wait: "30s"} + config := Config{Timeout: "30s", Wait: "30s", Workers: 25} if err := json.Unmarshal(raw, &config); err != nil { log.Fatalf("could not parse config: %s", err) } @@ -66,7 +67,7 @@ func main() { log.Fatalf("could not open database connection: %s", err) } - for i := 0; i < 25; i++ { + for i := 0; i < config.Workers; i++ { go check(i, db, waitDuration, timeout) } wg := sync.WaitGroup{} diff --git a/moncheck.conf.example b/moncheck.conf.example index 2e8991d..6d8a69a 100644 --- a/moncheck.conf.example +++ b/moncheck.conf.example @@ -1,5 +1,12 @@ { "db": "user=moncheck dbname=monzero", "timeout": "5s", - "wait": "5s" + "wait": "5s", + "path": [ + "/bin", + "/sbin", + "/usr/bin", + "/usr/sbin" + ], + "workers": 25 } |