summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorBen Kochie <superq@gmail.com>2021-02-16 10:35:11 +0100
committerBen Kochie <superq@gmail.com>2021-02-16 20:38:43 +0100
commita300cf87a12644b49b260287f0b26d2800049b34 (patch)
treecd72b2da062990c4954377533f19cbf10d5b1419 /cmd
parent8051e6a158cefecf085b53d4c9cacb6a0d705d52 (diff)
downloadgitlab-shell-a300cf87a12644b49b260287f0b26d2800049b34.tar.gz
Add monitoring endpoint to sshd
Add a basic monitoring endpoint to the sshd command. * Listen on localhost port 9122 by default. * Integrate build/version info. * Update example config. https://gitlab.com/gitlab-org/gitlab-shell/-/issues/121 Signed-off-by: Ben Kochie <superq@gmail.com>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/gitlab-sshd/main.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/cmd/gitlab-sshd/main.go b/cmd/gitlab-sshd/main.go
index 443c142..04d6888 100644
--- a/cmd/gitlab-sshd/main.go
+++ b/cmd/gitlab-sshd/main.go
@@ -9,10 +9,16 @@ import (
"gitlab.com/gitlab-org/gitlab-shell/internal/config"
"gitlab.com/gitlab-org/gitlab-shell/internal/logger"
"gitlab.com/gitlab-org/gitlab-shell/internal/sshd"
+ "gitlab.com/gitlab-org/labkit/monitoring"
)
var (
configDir = flag.String("config-dir", "", "The directory the config is in")
+
+ // BuildTime signifies the time the binary was build.
+ BuildTime = "2021-02-16T09:28:07+01:00" // Set at build time in the Makefile
+ // Version is the current version of GitLab Shell sshd.
+ Version = "(unknown version)" // Set at build time in the Makefile
)
func overrideConfigFromEnvironment(cfg *config.Config) {
@@ -50,6 +56,18 @@ func main() {
}
logger.ConfigureStandalone(cfg)
+ // Startup monitoring endpoint.
+ if cfg.Server.WebListen != "" {
+ go func() {
+ log.Fatal(
+ monitoring.Start(
+ monitoring.WithListenerAddress(cfg.Server.WebListen),
+ monitoring.WithBuildInformation(Version, BuildTime),
+ ),
+ )
+ }()
+ }
+
if err := sshd.Run(cfg); err != nil {
log.Fatalf("Failed to start GitLab built-in sshd: %v", err)
}