From 03692868f0809ea34cae370a8570edcaacfeedb7 Mon Sep 17 00:00:00 2001 From: Peter Fern Date: Fri, 14 Dec 2018 19:30:32 +1100 Subject: [PATCH] Display index page at root URL. This is nice for browsers, but also allows monitoring that the service is up (by looking for a valid HTTP response), without needing to render the full collection. --- main.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/main.go b/main.go index eaae6b1..b2900f9 100644 --- a/main.go +++ b/main.go @@ -84,6 +84,15 @@ func main() { log.Printf("Initialization succesful. Listening on :%s\n", *port) http.HandleFunc("/metrics", metricsHandler) + http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + w.Write([]byte(` + ZFS Exporter + +

ZFS Exporter

+

Metrics

+ + `)) + }) http.ListenAndServe(":"+*port, nil) }