[GO][ADD] Added a new collector for detect-internet

This commit is contained in:
BuildTools
2020-12-02 03:04:18 +01:00
parent 34a486986b
commit bc05385e81
4 changed files with 96 additions and 3 deletions

10
main.go
View File

@@ -51,8 +51,8 @@ var (
withWlanIF = flag.Bool("with-wlanif", false, "retrieves wlan interface metrics")
withMonitor = flag.Bool("with-monitor", false, "retrieves ethernet interface monitor info")
withIpsec = flag.Bool("with-ipsec", false, "retrieves ipsec metrics")
cfg *config.Config
withInternet = flag.Bool("with-internet", false, "retrieves detect-internet interfaces")
cfg *config.Config
appVersion = "DEVELOPMENT"
shortSha = "0xDEADBEEF"
@@ -241,12 +241,16 @@ func collectorOptions() []collector.Option {
opts = append(opts, collector.WithIpsec())
}
if *withInternet || cfg.Features.Internet {
opts = append(opts, collector.WithInternet())
}
if *timeout != collector.DefaultTimeout {
opts = append(opts, collector.WithTimeout(*timeout))
}
if *tls || cfg.Features.TLS {
fmt.Printf("TLS activated\n");
fmt.Printf("TLS activated\n")
opts = append(opts, collector.WithTLS(*insecure))
}