Add more metrics

This commit is contained in:
2021-10-29 01:45:47 +02:00
parent e7074257b1
commit 0560e2a76c
3 changed files with 73 additions and 13 deletions

View File

@@ -82,7 +82,17 @@ func ActionServe(c *cli.Context) error {
return fmt.Errorf("Invalid store configured")
}
s = store.NewMetricsCollectingStore(s)
// Setup interrupt handling
interruptChan := make(chan os.Signal, 1)
signal.Notify(interruptChan, os.Interrupt)
rootCtx, rootCancel := context.WithCancel(c.Context)
defer rootCancel()
serversCtx, serversCancel := context.WithCancel(rootCtx)
defer serversCancel()
// Setup metrics collection
s = store.NewMetricsCollectingStore(rootCtx, s)
// Setup honeypot
hs, err := ssh.NewHoneypotServer(cfg.Honeypot, s)
@@ -109,13 +119,6 @@ func ActionServe(c *cli.Context) error {
web.TLSConfig = tlsConfig
}
// Setup interrupt handling
interruptChan := make(chan os.Signal, 1)
signal.Notify(interruptChan, os.Interrupt)
rootCtx, rootCancel := context.WithCancel(c.Context)
serversCtx, serversCancel := context.WithCancel(rootCtx)
// Setup portlistener, if configured
if cfg.Ports.Enable {
portsCtx, cancel := context.WithCancel(rootCtx)