Derek-K / telegraf-speedtest

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

Telegraf send data to influxdb only for one plugin #9

Open hamzaelfajjaj opened 3 years ago

hamzaelfajjaj commented 3 years ago

Hello Derek-K Fist let me thank you about this useful plugin, I have just an issue here, I have a Telegraf.conf file who had already one plugin working well, I add your plugin config, I test it using telegraf -test, working I can see the result from speedtest, but the issue is , this result is not sent to InfluxDB, even I have another plugin in the same config file and the data is sent to the InfluxDB, Any idea ?

hamzaelfajjaj commented 3 years ago

Hello Derek-K Fist let me thank you about this useful plugin, I have just an issue here, I have a Telegraf.conf file who had already one plugin working well, I add your plugin config, I test it using telegraf -test, working I can see the result from speedtest, but the issue is , this result is not sent to InfluxDB, even I have another plugin in the same config file and the data is sent to the InfluxDB, Any idea ?

The issue is solved, It was related to user permission, and speedtest license agreement, Even we run it using the telegraf username and accept the license for the first time running he still asking us every time to accept it again , I solved this issue using something like this : --accept-license --accept-gdpr

[[inputs.exec]] commands = ["/usr/bin/speedtest -f json-pretty --accept-license --accept-gdpr"] name_override = "Speedtest"

Thanks

joydashy commented 3 years ago

Oh thanks! This what I needed as well to fix this error:

2021-08-07T12:55:02Z E! [inputs.exec] Error in plugin: exec: exit status 1 for command '/usr/bin/speedtest -f json-pretty': ==============================================================================...

pootedesu commented 2 years ago

Here is what I did to fix the problem:

  1. First, switch to root user sudo su -
  2. Create the .config directory and set telegraf as the owner cd /etc/telegraf sudo mkdir .config sudo chown telegraf:telegraf .config/
  3. Switch to telegraph user and run speedtest sudo -u telegraf -s speedtest

When you run speedtest it tries to create the license file in the /etc/telegraf/.config directory. You may already have this directory if you already use telegraf but I didn't as it was a fresh install of InfluxDB and Telegraf.