Adding TLS to node exporter - cleaner version (#1277)
Add support for https connections. Signed-off-by: ksherryBAE <kieran.sherry@baesystems.com> Signed-off-by: James Ritchie <james.g.ritchie@baesystems.com> Signed-off-by: Simon Pasquier <spasquie@redhat.com> Signed-off-by: Ben RIdley <benridley29@gmail.com>
This commit is contained in:
parent
20fe5bfb5b
commit
aede04172c
52 changed files with 11430 additions and 2 deletions
|
|
@ -24,6 +24,7 @@ import (
|
|||
"github.com/prometheus/common/log"
|
||||
"github.com/prometheus/common/version"
|
||||
"github.com/prometheus/node_exporter/collector"
|
||||
"github.com/prometheus/node_exporter/https"
|
||||
"gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
|
|
@ -147,6 +148,10 @@ func main() {
|
|||
"web.max-requests",
|
||||
"Maximum number of parallel scrape requests. Use 0 to disable.",
|
||||
).Default("40").Int()
|
||||
configFile = kingpin.Flag(
|
||||
"web.config",
|
||||
"Path to config yaml file that can enable TLS or authentication.",
|
||||
).Default("").String()
|
||||
)
|
||||
|
||||
log.AddFlags(kingpin.CommandLine)
|
||||
|
|
@ -169,7 +174,8 @@ func main() {
|
|||
})
|
||||
|
||||
log.Infoln("Listening on", *listenAddress)
|
||||
if err := http.ListenAndServe(*listenAddress, nil); err != nil {
|
||||
server := &http.Server{Addr: *listenAddress}
|
||||
if err := https.Listen(server, *configFile); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue