Derek-K / telegraf-speedtest

Using official SpeedTest.net cli for telegraf
GNU General Public License v3.0
32 stars 10 forks source link

Not writing to the database #3

Closed sukumarpatel closed 4 years ago

sukumarpatel commented 4 years ago

I am running telegraf in a docker. The docker config is as below telegraf: container_name: telegraf image: telegraf:latest network_mode: "host" volumes:

My input config is as below

[[inputs.exec]] commands = ["/etc/telegraf/speedtest -s 10637 -f json-pretty"] name_override = "Speedtest" timeout = "1m" interval = "10m" data_format = "json" json_string_fields = [ "interface_externalIp", "server_name", "server_location", "server_host", "server_ip", "result_url" ] name_suffix = "_speed"

[[outputs.influxdb]] database = "speed_metrics" urls = ["http://localhost:8086"] namepass = ["*_speed"]

If I run the command /etc/telegraf/speedtest -s 10637 -f json-pretty from within the container via ssh, it runs successfully. However there is no logs in InfluxDB

ThomasWilla commented 4 years ago

Hello sukumarpatel,

please try the following command. The manuel accepting license dose not save. commands = ["/usr/bin/speedtest -f json-pretty --accept-license --accept-gdpr"]

Regards, Thomas

Derek-K commented 4 years ago

@sukumarpatel , when you manually run the speedtest command, is it the same user that runs your telegraf?

sukumarpatel commented 4 years ago

It's running in docker. I logged in to the container via bash and ran the command as root. I assume the user would be the same when docker is running.

I will try the accept license command.

Derek-K commented 4 years ago

It's running in docker. I logged in to the container via bash and ran the command as root. I assume the user would be the same when docker is running.

I will try the accept license command.

You may also find this #1 helpful.

Derek-K commented 4 years ago

Humm... I just tested -s 10637, from where I am located, it took ~50s for speedtest to complete. Unless you are closer to the test server in Mumbai, India and have faster connections, otherwise I would suggest increasing the timeout value to, say, 2m.

sukumarpatel commented 4 years ago

Right. I'll try that as well

sukumarpatel commented 4 years ago

It's completing in 20 seconds for me