Skip to content

Commit

Permalink
cmd/derpprobe: add /healthz endpoint
Browse files Browse the repository at this point in the history
For a customer that wants to run their own DERP prober, let's add a
/healthz endpoint that can be used to monitor derpprobe itself.

Updates tailscale#6526

Signed-off-by: Andrew Dunham <[email protected]>
Change-Id: Iba315c999fc0b1a93d8c503c07cc733b4c8d5b6b
  • Loading branch information
andrew-d committed Oct 15, 2024
1 parent 5f22f72 commit 2aa9125
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/derpprobe/derpprobe.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ func main() {
prober.WithPageLink("Prober metrics", "/debug/varz"),
prober.WithProbeLink("Run Probe", "/debug/probe-run?name={{.Name}}"),
), tsweb.HandlerOptions{Logf: log.Printf}))
mux.Handle("/healthz", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "text/plain")
w.WriteHeader(http.StatusOK)
w.Write([]byte("ok\n"))
}))
log.Printf("Listening on %s", *listen)
log.Fatal(http.ListenAndServe(*listen, mux))
}
Expand Down

0 comments on commit 2aa9125

Please sign in to comment.