Browse Source

Add prometheus to alltxt2http

master
Sebastian Denz 4 years ago
parent
commit
a27ee0b8cc
  1. 8
      cmd/alltxt2http/main.go

8
cmd/alltxt2http/main.go

@ -20,6 +20,7 @@ import (
// "github.com/tzneal/ham-go/dxcc" // "github.com/tzneal/ham-go/dxcc"
// "github.com/denzs/wsjtx-dashboards/shared/httpstuff" // "github.com/denzs/wsjtx-dashboards/shared/httpstuff"
"github.com/hpcloud/tail" "github.com/hpcloud/tail"
"github.com/prometheus/client_golang/prometheus/promhttp"
) )
var alltxt string var alltxt string
@ -55,6 +56,13 @@ func init() {
FullTimestamp: true, FullTimestamp: true,
} }
log.SetFormatter(formatter) 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) { func getTimestampFromDb() (int64, bool) {

Loading…
Cancel
Save