f-29: watchdog: call this one #29
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
parent
d8ece59d1c
commit
1ce84ffd58
1 changed files with 10 additions and 0 deletions
|
|
@ -1,15 +1,19 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
|
"time"
|
||||||
|
|
||||||
agentapi "git.g3e.fr/syonad/two/internal/api/agent"
|
agentapi "git.g3e.fr/syonad/two/internal/api/agent"
|
||||||
configuration "git.g3e.fr/syonad/two/internal/config/agent"
|
configuration "git.g3e.fr/syonad/two/internal/config/agent"
|
||||||
dispatcher "git.g3e.fr/syonad/two/internal/dispatcher/agent"
|
dispatcher "git.g3e.fr/syonad/two/internal/dispatcher/agent"
|
||||||
"git.g3e.fr/syonad/two/internal/migration"
|
"git.g3e.fr/syonad/two/internal/migration"
|
||||||
agentmetrics "git.g3e.fr/syonad/two/internal/prometheus/agent"
|
agentmetrics "git.g3e.fr/syonad/two/internal/prometheus/agent"
|
||||||
|
"git.g3e.fr/syonad/two/internal/watchdog"
|
||||||
|
"git.g3e.fr/syonad/two/internal/watchdog/notify"
|
||||||
"git.g3e.fr/syonad/two/pkg/db/kv"
|
"git.g3e.fr/syonad/two/pkg/db/kv"
|
||||||
"git.g3e.fr/syonad/two/pkg/logger"
|
"git.g3e.fr/syonad/two/pkg/logger"
|
||||||
promserver "git.g3e.fr/syonad/two/pkg/prometheus"
|
promserver "git.g3e.fr/syonad/two/pkg/prometheus"
|
||||||
|
|
@ -63,6 +67,12 @@ func main() {
|
||||||
adminAddr := fmt.Sprintf("%s:%d", cfg.Admin.Address, cfg.Admin.Port)
|
adminAddr := fmt.Sprintf("%s:%d", cfg.Admin.Address, cfg.Admin.Port)
|
||||||
go kv.NewAdminServer(db, log.With(slog.String("component", "admin"))).Start(adminAddr)
|
go kv.NewAdminServer(db, log.With(slog.String("component", "admin"))).Start(adminAddr)
|
||||||
}
|
}
|
||||||
|
if cfg.Watchdog.Enabled {
|
||||||
|
wlog := log.With(slog.String("component", "watchdog"))
|
||||||
|
go watchdog.New(db, cfg, notify.NewStderr(wlog), wlog,
|
||||||
|
time.Duration(cfg.Watchdog.IntervalSeconds)*time.Second,
|
||||||
|
).Run(context.Background())
|
||||||
|
}
|
||||||
|
|
||||||
select {}
|
select {}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue