From 26d4bf1195c52a696c0f2f9a18d304dfc193dded Mon Sep 17 00:00:00 2001 From: Ulric Qin Date: Tue, 19 Apr 2022 18:57:43 +0800 Subject: [PATCH] add some debug log --- conf/input.ping/ping.toml | 12 ++++++------ inputs/ping/ping.go | 6 ++++++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/conf/input.ping/ping.toml b/conf/input.ping/ping.toml index 021b5d3..13f3382 100644 --- a/conf/input.ping/ping.toml +++ b/conf/input.ping/ping.toml @@ -3,12 +3,12 @@ [[instances]] # send ping packets to -targets = [ - "www.baidu.com", - "127.0.0.1", - "10.4.5.6", - "10.4.5.7" -] +# targets = [ +# "www.baidu.com", +# "127.0.0.1", +# "10.4.5.6", +# "10.4.5.7" +# ] # # append some labels for series # labels = { region="cloud", product="n9e" } diff --git a/inputs/ping/ping.go b/inputs/ping/ping.go index d245d90..00120b8 100644 --- a/inputs/ping/ping.go +++ b/inputs/ping/ping.go @@ -143,6 +143,12 @@ func (p *Ping) gatherOnce(slist *list.SafeList, ins *PingInstance) { } } + if config.Config.DebugMode { + if len(ins.Targets) == 0 { + log.Println("D! ping targets empty") + } + } + wg := new(sync.WaitGroup) for _, target := range ins.Targets { wg.Add(1)