Skip to content

Commit

Permalink
Add simple health check (#37)
Browse files Browse the repository at this point in the history
* Add simple health check

Useful to check health status of a running container using a `livenessProbe` in a
Kubernetes Pod.

* Change health endpoint to /-/healthy
  • Loading branch information
marctc authored and discordianfish committed Aug 27, 2018
1 parent bb22ffa commit 4ce558e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion nginx_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@ func main() {
</body>
</html>`))
})

http.HandleFunc("/-/healthy", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(200)
w.Write([]byte("ok"))
})
log.Fatal(http.ListenAndServe(*listeningAddress, nil))
}

0 comments on commit 4ce558e

Please sign in to comment.