mirror of
https://github.com/steinhobelgruen/netatmo-exporter.git
synced 2024-11-24 02:13:55 +00:00
Use updated Prometheus handler.
This commit is contained in:
parent
69f1b5db51
commit
af0f4f2b10
3
main.go
3
main.go
|
@ -7,6 +7,7 @@ import (
|
||||||
|
|
||||||
netatmo "github.com/exzz/netatmo-api-go"
|
netatmo "github.com/exzz/netatmo-api-go"
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
|
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -26,7 +27,7 @@ func main() {
|
||||||
}
|
}
|
||||||
prometheus.MustRegister(metrics)
|
prometheus.MustRegister(metrics)
|
||||||
|
|
||||||
http.Handle("/metrics", prometheus.UninstrumentedHandler())
|
http.Handle("/metrics", promhttp.HandlerFor(prometheus.DefaultGatherer, promhttp.HandlerOpts{}))
|
||||||
http.Handle("/", http.RedirectHandler("/metrics", http.StatusFound))
|
http.Handle("/", http.RedirectHandler("/metrics", http.StatusFound))
|
||||||
|
|
||||||
log.Printf("Listen on %s...", cfg.Addr)
|
log.Printf("Listen on %s...", cfg.Addr)
|
||||||
|
|
Loading…
Reference in a new issue