diff --git a/cmd/postgres_exporter/main.go b/cmd/postgres_exporter/main.go index 093ddd30..d444dabb 100644 --- a/cmd/postgres_exporter/main.go +++ b/cmd/postgres_exporter/main.go @@ -166,6 +166,13 @@ func main() { } http.HandleFunc("/probe", handleProbe(logger, excludedDatabases)) + http.HandleFunc("/-/reload", func(w http.ResponseWriter, r *http.Request) { + if err := c.ReloadConfig(*configFile, logger); err != nil { + level.Warn(logger).Log("msg", "Error reloading config", "file", *configFile, "error", err) + return + } + _, _ = w.Write([]byte(`ok`)) + }) srv := &http.Server{} if err := web.ListenAndServe(srv, webConfig, logger); err != nil {