Skip to content

Commit

Permalink
Merge pull request #2 from yanboer/release-v0.12.1
Browse files Browse the repository at this point in the history
web.listenAddress
  • Loading branch information
zlianzhuang authored Jun 5, 2023
2 parents d915932 + 925a782 commit 3d71182
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmd/postgres_exporter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ var (
Config: &config.Config{},
}

listenAddress = kingpin.Flag("web.listenAddress", "Address to listen on for web interface and telemetry.").Default(":9187").Envar("PG_EXPORTER_WEB_LISTEN_ADDRESS").Strings()
configFile = kingpin.Flag("config.file", "Postgres exporter configuration file.").Default("postgres_exporter.yml").String()
webConfig = kingpinflag.AddFlags(kingpin.CommandLine, ":9187")
metricsPath = kingpin.Flag("web.telemetry-path", "Path under which to expose metrics.").Default("/metrics").Envar("PG_EXPORTER_WEB_TELEMETRY_PATH").String()
Expand Down Expand Up @@ -156,6 +157,8 @@ func main() {

http.HandleFunc("/probe", handleProbe(logger, excludedDatabases))

// set WebListenAddresses from PG_EXPORTER_WEB_LISTEN_ADDRESS env or --web.listenAddress param
webConfig.WebListenAddresses = listenAddress
srv := &http.Server{}
if err := web.ListenAndServe(srv, webConfig, logger); err != nil {
level.Error(logger).Log("msg", "Error running HTTP server", "err", err)
Expand Down

0 comments on commit 3d71182

Please sign in to comment.