new flag to disable all default collectors (#1460)
* new flag to disable all default collectors Signed-off-by: Paul Gier <pgier@redhat.com> Co-authored-by: Ben Kochie <superq@gmail.com>
This commit is contained in:
parent
3e1b0f1bee
commit
b40954dce5
3 changed files with 36 additions and 5 deletions
|
|
@ -29,7 +29,7 @@ import (
|
|||
"github.com/prometheus/common/version"
|
||||
"github.com/prometheus/node_exporter/collector"
|
||||
"github.com/prometheus/node_exporter/https"
|
||||
"gopkg.in/alecthomas/kingpin.v2"
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
// handler wraps an unfiltered http.Handler but uses a filtered handler,
|
||||
|
|
@ -153,6 +153,10 @@ func main() {
|
|||
"web.max-requests",
|
||||
"Maximum number of parallel scrape requests. Use 0 to disable.",
|
||||
).Default("40").Int()
|
||||
disableDefaultCollectors = kingpin.Flag(
|
||||
"collector.disable-defaults",
|
||||
"Set all collectors to disabled by default.",
|
||||
).Default("false").Bool()
|
||||
configFile = kingpin.Flag(
|
||||
"web.config",
|
||||
"Path to config yaml file that can enable TLS or authentication.",
|
||||
|
|
@ -166,6 +170,9 @@ func main() {
|
|||
kingpin.Parse()
|
||||
logger := promlog.New(promlogConfig)
|
||||
|
||||
if *disableDefaultCollectors {
|
||||
collector.DisableDefaultCollectors()
|
||||
}
|
||||
level.Info(logger).Log("msg", "Starting node_exporter", "version", version.Info())
|
||||
level.Info(logger).Log("msg", "Build context", "build_context", version.BuildContext())
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue