mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-02-22 20:56:36 +00:00
Add HTTPS configuration
Add the exporter-toolkit https package to allow configuring TLS and auth. Signed-off-by: Ben Kochie <superq@gmail.com> Signed-off-by: Calle Pettersson <carlpett@users.noreply.github.com>
This commit is contained in:
committed by
Calle Pettersson
parent
4b66473d2e
commit
cdc81b03d5
10
exporter.go
10
exporter.go
@@ -23,6 +23,7 @@ import (
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
"github.com/prometheus/common/log"
|
||||
"github.com/prometheus/common/version"
|
||||
"github.com/prometheus/exporter-toolkit/https"
|
||||
"gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
@@ -258,6 +259,10 @@ 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()
|
||||
listenAddress = kingpin.Flag(
|
||||
"telemetry.addr",
|
||||
"host:port for exporter.",
|
||||
@@ -398,7 +403,10 @@ func main() {
|
||||
|
||||
go func() {
|
||||
log.Infoln("Starting server on", *listenAddress)
|
||||
log.Fatalf("cannot start windows_exporter: %s", http.ListenAndServe(*listenAddress, nil))
|
||||
server := &http.Server{Addr: *listenAddress}
|
||||
if err := https.Listen(server, *httpsConfig, logger); err != nil {
|
||||
log.Fatalf("cannot start windows_exporter: %s", err)
|
||||
}
|
||||
}()
|
||||
|
||||
for {
|
||||
|
||||
Reference in New Issue
Block a user