From 75b5f8be36ef673d75ab08b86b988bd58920f59b Mon Sep 17 00:00:00 2001 From: Steve Brunton Date: Mon, 3 Feb 2020 22:00:00 -0500 Subject: [PATCH] added DHCPL collection to configs and collectors (#69) --- config/config.go | 1 + main.go | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/config/config.go b/config/config.go index d1c048a..12f60f3 100644 --- a/config/config.go +++ b/config/config.go @@ -13,6 +13,7 @@ type Config struct { Features struct { BGP bool `yaml:"bgp,omitempty"` DHCP bool `yaml:"dhcp,omitempty"` + DHCPL bool `yaml:"dhcpl,omitemptu"` DHCPv6 bool `yaml:"dhcpv6,omitempty"` Routes bool `yaml:"routes,omitempty"` POE bool `yaml:"poe,omitempty"` diff --git a/main.go b/main.go index 8fdbb93..08748dd 100644 --- a/main.go +++ b/main.go @@ -39,6 +39,7 @@ var ( withBgp = flag.Bool("with-bgp", false, "retrieves BGP routing infrormation") withRoutes = flag.Bool("with-routes", false, "retrieves routing table information") withDHCP = flag.Bool("with-dhcp", false, "retrieves DHCP server metrics") + withDHCPL = flag.Bool("with-dhcpl", false, "retrieves DHCP server lease metrics") withDHCPv6 = flag.Bool("with-dhcpv6", false, "retrieves DHCPv6 server metrics") withPOE = flag.Bool("with-poe", false, "retrieves PoE metrics") withPools = flag.Bool("with-pools", false, "retrieves IP(v6) pool metrics") @@ -189,6 +190,10 @@ func collectorOptions() []collector.Option { opts = append(opts, collector.WithDHCP()) } + if *withDHCPL || cfg.Features.DHCPL { + opts = append(opts, collector.WithDHCPL()) + } + if *withDHCPv6 || cfg.Features.DHCPv6 { opts = append(opts, collector.WithDHCPv6()) }