telegraf icon indicating copy to clipboard operation
telegraf copied to clipboard

internet_speed: Support blacklisting or chosing servers

Open KoffeinKaio opened this issue 3 years ago • 1 comments

Use Case

My ISP provieds its own speedtest server, which is of course selected frist for lowest latency/distance. Thing is, they cheat. It gets routet ISP-internal and provides the full line speeds, not the one to the internet.

Expected behavior

I kinda want something like

[[inputs.internet_speed]]
  ## Sets if runs file download test
  interval = "30m"
  excluded_servers = "193894,203049,390484"

or (allowed servers)

[[inputs.internet_speed]]
  ## Sets if runs file download test
  interval = "30m"
  servers = "193894,203049,390484"

Actual behavior

as far as I can see, its not supported to chose or exclude servers

Additional info

If someone could point me where to do the code changes, I might implement it myself.

KoffeinKaio avatar Aug 04 '22 18:08 KoffeinKaio

Hi @KoffeinKaio, are those six digit server numbers you are using the same as the ID from the speedtest-go module?

https://github.com/showwin/speedtest-go/blob/4800c78e8fdd4afecb98147ff95049db14288a8a/speedtest/server.go#L34

If so, it looks like telegraf could be changed to remove them from the list of servers here

https://github.com/influxdata/telegraf/blob/master/plugins/inputs/internet_speed/internet_speed.go#L41

We would need to be careful not to remove all the servers from the list or warn the user if they did, but it seems like that would possible.

Are you able to put together a PR to make this code change?

reimda avatar Aug 04 '22 20:08 reimda

I would love this to be a feature too. May be able to attempt to create a PR, though I haven't worked that much with go before, and never with the speedtest-go library.

theS1LV3R avatar Jan 25 '23 21:01 theS1LV3R

@KoffeinKaio

Can you try one of the test artifacts on https://github.com/influxdata/telegraf/pull/12617 and use the server_id_exclude option to ignore certain servers?

Thanks!

powersj avatar Feb 03 '23 21:02 powersj