From a27ee0b8ccd3ece10938d7d35041b46d155a1121 Mon Sep 17 00:00:00 2001 From: Sebastian Denz Date: Wed, 17 Mar 2021 21:55:22 +0100 Subject: [PATCH] Add prometheus to alltxt2http --- cmd/alltxt2http/main.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmd/alltxt2http/main.go b/cmd/alltxt2http/main.go index 9da1ae7..bfc17dc 100644 --- a/cmd/alltxt2http/main.go +++ b/cmd/alltxt2http/main.go @@ -20,6 +20,7 @@ import ( // "github.com/tzneal/ham-go/dxcc" // "github.com/denzs/wsjtx-dashboards/shared/httpstuff" "github.com/hpcloud/tail" + "github.com/prometheus/client_golang/prometheus/promhttp" ) var alltxt string @@ -55,6 +56,13 @@ func init() { FullTimestamp: true, } log.SetFormatter(formatter) + + log.Info("prometheus exporter enabled..") + go func () { + server := http.NewServeMux() + server.Handle("/metrics", promhttp.Handler()) + http.ListenAndServe(":9123", server) + } () } func getTimestampFromDb() (int64, bool) {