You've already forked postgres_exporter
mirror of
https://github.com/prometheus-community/postgres_exporter.git
synced 2025-08-08 04:42:07 +03:00
Update exporter-toolkit
Update to the latest exporter-toolkit * Enables multi-listener and systemd socket activation. * Bump Go to 1.19. * Remove `PG_EXPORTER_WEB_LISTEN_ADDRESS` env var because this is now a repeatable flag. Signed-off-by: SuperQ <superq@gmail.com>
This commit is contained in:
@@ -27,7 +27,7 @@ import (
|
||||
"github.com/prometheus/common/promlog/flag"
|
||||
"github.com/prometheus/common/version"
|
||||
"github.com/prometheus/exporter-toolkit/web"
|
||||
webflag "github.com/prometheus/exporter-toolkit/web/kingpinflag"
|
||||
"github.com/prometheus/exporter-toolkit/web/kingpinflag"
|
||||
"gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
@@ -37,8 +37,7 @@ var (
|
||||
}
|
||||
|
||||
configFile = kingpin.Flag("config.file", "Postgres exporter configuration file.").Default("postgres_exporter.yml").String()
|
||||
listenAddress = kingpin.Flag("web.listen-address", "Address to listen on for web interface and telemetry.").Default(":9187").Envar("PG_EXPORTER_WEB_LISTEN_ADDRESS").String()
|
||||
webConfig = webflag.AddFlags(kingpin.CommandLine)
|
||||
webConfig = kingpinflag.AddFlags(kingpin.CommandLine, ":9187")
|
||||
metricPath = kingpin.Flag("web.telemetry-path", "Path under which to expose metrics.").Default("/metrics").Envar("PG_EXPORTER_WEB_TELEMETRY_PATH").String()
|
||||
disableDefaultMetrics = kingpin.Flag("disable-default-metrics", "Do not include default metrics.").Default("false").Envar("PG_EXPORTER_DISABLE_DEFAULT_METRICS").Bool()
|
||||
disableSettingsMetrics = kingpin.Flag("disable-settings-metrics", "Do not include pg_settings metrics.").Default("false").Envar("PG_EXPORTER_DISABLE_SETTINGS_METRICS").Bool()
|
||||
@@ -146,9 +145,8 @@ func main() {
|
||||
|
||||
http.HandleFunc("/probe", handleProbe(logger))
|
||||
|
||||
level.Info(logger).Log("msg", "Listening on address", "address", *listenAddress)
|
||||
srv := &http.Server{Addr: *listenAddress}
|
||||
if err := web.ListenAndServe(srv, *webConfig, logger); err != nil {
|
||||
srv := &http.Server{}
|
||||
if err := web.ListenAndServe(srv, webConfig, logger); err != nil {
|
||||
level.Error(logger).Log("msg", "Error running HTTP server", "err", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
Reference in New Issue
Block a user