Skip to content

Commit

Permalink
Display index page at root URL.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
pdf committed Dec 14, 2018
1 parent 7a46cad commit 0369286
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(`<html>
<head><title>ZFS Exporter</title></head>
<body>
<h1>ZFS Exporter</h1>
<p><a href="/metrics">Metrics</a></p>
</body>
</html>`))
})
http.ListenAndServe(":"+*port, nil)

}
Expand Down

0 comments on commit 0369286

Please sign in to comment.