Skip to content

Commit

Permalink
better index
Browse files Browse the repository at this point in the history
  • Loading branch information
dundee committed Apr 6, 2021
1 parent d903517 commit 8d5c05b
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions exporter/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func RunServer(addr string) {
http.Handle("/", http.HandlerFunc(serveIndex))
http.Handle("/metrics", promhttp.Handler())

log.Printf("Listening on %s", addr)
log.Printf("Providing metrics at http://%s/metrics", addr)
err := http.ListenAndServe(addr, nil)
if err != nil {
log.Fatal("ListenAndServe:", err)
Expand All @@ -92,11 +92,22 @@ func RunServer(addr string) {

func serveIndex(w http.ResponseWriter, req *http.Request) {
w.Header().Set("Content-type", "text/html")
res := `<!DOCTYPE>
<html>
res := `<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Disk Usage Prometheus Exporter</title>
</head>
<body>
<h1>go DiskUsage("Prometheus Exporter")</h1>
<a href="/metrics">Metrics</a>
<h1>Disk Usage Prometheus Exporter</h1>
<p>
<a href="/metrics">Metrics</a>
</p>
<p>
<a href="https://github.com/dundee/disk_usage_exporter">Homepage</a>
</p>
</body>
</html>
`
fmt.Fprint(w, res)
Expand Down

0 comments on commit 8d5c05b

Please sign in to comment.