diff --git a/README.md b/README.md index be3b9f21..39ee7d29 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,7 @@ Flag | Description | Default value `--collectors.enabled` | Comma-separated list of collectors to use. Use `[defaults]` as a placeholder for all the collectors enabled by default." | `[defaults]` `--collectors.print` | If true, print available collectors and exit. | `--scrape.timeout-margin` | Seconds to subtract from the timeout allowed by the client. Tune to allow for overhead or high loads. | `0.5` -`--web.config` | A [web config][web_config] for setting up TLS and Auth | None +`--web.config.file` | A [web config][web_config] for setting up TLS and Auth | None ## Installation The latest release can be downloaded from the [releases page](https://github.com/prometheus-community/windows_exporter/releases). diff --git a/exporter.go b/exporter.go index f474d9fe..0e37fde1 100644 --- a/exporter.go +++ b/exporter.go @@ -23,7 +23,8 @@ import ( "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promhttp" "github.com/prometheus/common/version" - "github.com/prometheus/exporter-toolkit/https" + "github.com/prometheus/exporter-toolkit/web" + webflag "github.com/prometheus/exporter-toolkit/web/kingpinflag" "gopkg.in/alecthomas/kingpin.v2" ) @@ -259,10 +260,7 @@ func main() { "config.file", "YAML configuration file to use. Values set in this file will be overriden by CLI flags.", ).String() - httpsConfig = kingpin.Flag( - "web.config", - "[EXPERIMENTAL] Path to config yaml file that can enable TLS or authentication.", - ).Default("").String() + webConfig = webflag.AddFlags(kingpin.CommandLine) listenAddress = kingpin.Flag( "telemetry.addr", "host:port for exporter.", @@ -404,7 +402,7 @@ func main() { go func() { log.Infoln("Starting server on", *listenAddress) server := &http.Server{Addr: *listenAddress} - if err := https.Listen(server, *httpsConfig, log.NewToolkitAdapter()); err != nil { + if err := web.ListenAndServe(server, *webConfig, log.NewToolkitAdapter()); err != nil { log.Fatalf("cannot start windows_exporter: %s", err) } }() diff --git a/go.mod b/go.mod index be9ada88..033c6c92 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( github.com/prometheus/client_golang v1.8.0 github.com/prometheus/client_model v0.2.0 github.com/prometheus/common v0.15.0 - github.com/prometheus/exporter-toolkit v0.4.0 + github.com/prometheus/exporter-toolkit v0.5.1 github.com/sirupsen/logrus v1.6.0 golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211 golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect diff --git a/go.sum b/go.sum index 1a0348cd..3d778e00 100644 --- a/go.sum +++ b/go.sum @@ -261,6 +261,8 @@ github.com/prometheus/common v0.15.0 h1:4fgOnadei3EZvgRwxJ7RMpG1k1pOZth5Pc13tysp github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= github.com/prometheus/exporter-toolkit v0.4.0 h1:O7Bw+ZKEMzW7vD10IuVF70b8EE4JIG7BvHFj9UKz49g= github.com/prometheus/exporter-toolkit v0.4.0/go.mod h1:OCkM4805mmisBhLmVFw858QYi3v0wKdY6/UxrT0pZVg= +github.com/prometheus/exporter-toolkit v0.5.1 h1:9eqgis5er9xN613ZSADjypCJaDGj9ZlcWBvsIHa8/3c= +github.com/prometheus/exporter-toolkit v0.5.1/go.mod h1:OCkM4805mmisBhLmVFw858QYi3v0wKdY6/UxrT0pZVg= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a h1:9a8MnZMP0X2nLJdBg+pBmGgkJlSaKC2KaQmTCk1XDtE= github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=