Update web config file flag to match upstream

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
This commit is contained in:
Julien Pivotto
2021-02-24 00:23:38 +01:00
parent 795cc5ca85
commit 2262b88fac
4 changed files with 8 additions and 8 deletions

View File

@@ -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.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. | `--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` `--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 ## Installation
The latest release can be downloaded from the [releases page](https://github.com/prometheus-community/windows_exporter/releases). The latest release can be downloaded from the [releases page](https://github.com/prometheus-community/windows_exporter/releases).

View File

@@ -23,7 +23,8 @@ import (
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp" "github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/prometheus/common/version" "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" "gopkg.in/alecthomas/kingpin.v2"
) )
@@ -259,10 +260,7 @@ func main() {
"config.file", "config.file",
"YAML configuration file to use. Values set in this file will be overriden by CLI flags.", "YAML configuration file to use. Values set in this file will be overriden by CLI flags.",
).String() ).String()
httpsConfig = kingpin.Flag( webConfig = webflag.AddFlags(kingpin.CommandLine)
"web.config",
"[EXPERIMENTAL] Path to config yaml file that can enable TLS or authentication.",
).Default("").String()
listenAddress = kingpin.Flag( listenAddress = kingpin.Flag(
"telemetry.addr", "telemetry.addr",
"host:port for exporter.", "host:port for exporter.",
@@ -404,7 +402,7 @@ func main() {
go func() { go func() {
log.Infoln("Starting server on", *listenAddress) log.Infoln("Starting server on", *listenAddress)
server := &http.Server{Addr: *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) log.Fatalf("cannot start windows_exporter: %s", err)
} }
}() }()

2
go.mod
View File

@@ -14,7 +14,7 @@ require (
github.com/prometheus/client_golang v1.8.0 github.com/prometheus/client_golang v1.8.0
github.com/prometheus/client_model v0.2.0 github.com/prometheus/client_model v0.2.0
github.com/prometheus/common v0.15.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 github.com/sirupsen/logrus v1.6.0
golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211 golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect

2
go.sum
View File

@@ -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/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 h1:O7Bw+ZKEMzW7vD10IuVF70b8EE4JIG7BvHFj9UKz49g=
github.com/prometheus/exporter-toolkit v0.4.0/go.mod h1:OCkM4805mmisBhLmVFw858QYi3v0wKdY6/UxrT0pZVg= 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-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 h1:9a8MnZMP0X2nLJdBg+pBmGgkJlSaKC2KaQmTCk1XDtE=
github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=