Skip to content

Commit bb5de34

Browse files
committed
Add /healthz endpoint
Signed-off-by: Markus Blaschke <[email protected]>
1 parent 89ddb69 commit bb5de34

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

main.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,13 @@ func initArgparser() {
9090

9191
// start and handle prometheus handler
9292
func startHttpServer(exporter *AlertmanagerElasticsearchExporter) {
93+
// healthz
94+
http.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) {
95+
if _, err := fmt.Fprint(w, "Ok"); err != nil {
96+
daemonLogger.Error(err)
97+
}
98+
})
99+
93100
http.HandleFunc("/webhook", http.HandlerFunc(exporter.HttpHandler))
94101
http.Handle("/metrics", promhttp.Handler())
95102
daemonLogger.Fatal(http.ListenAndServe(opts.ServerBind, nil))

0 commit comments

Comments
 (0)