From 47bdfa7bec64057ad766dc5110bcb5eb284add35 Mon Sep 17 00:00:00 2001 From: Cody Lee Date: Wed, 23 Nov 2022 19:15:55 -0600 Subject: [PATCH] disable check --- integrations/datadogunifi/datadog.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/integrations/datadogunifi/datadog.go b/integrations/datadogunifi/datadog.go index d074b0e1..37630cc1 100644 --- a/integrations/datadogunifi/datadog.go +++ b/integrations/datadogunifi/datadog.go @@ -28,7 +28,7 @@ type Config struct { DeadPorts bool `json:"dead_ports,omitempty" toml:"dead_ports,omitempty" xml:"dead_ports,omitempty" yaml:"dead_ports,omitempty"` // Disable when true disables this output plugin - Disable bool `json:"disable" toml:"disable" xml:"disable,attr" yaml:"disable"` + Disable *bool `json:"disable" toml:"disable" xml:"disable,attr" yaml:"disable"` // Address determines how to talk to the Datadog agent Address string `json:"address" toml:"address" xml:"address,attr" yaml:"address"` @@ -191,11 +191,12 @@ func (u *DatadogUnifi) setConfigDefaults() { // Run runs a ticker to poll the unifi server and update Datadog. func (u *DatadogUnifi) Run(c poller.Collect) error { u.Collector = c - if u.Disable { + disabled := u.Disable == nil || *u.Disable == true + if disabled { u.LogDebugf("Datadog config is disabled, output is disabled.") return nil } - if u.Config == nil && !u.Disable { + if u.Config == nil && !disabled { u.LogErrorf("DataDog config is missing and is not disabled: Datadog output is disabled!") return nil }