Skip to content

Instantly share code, notes, and snippets.

@jk
Last active March 14, 2021 17:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jk/933841aed593848680a61bc4b7294df6 to your computer and use it in GitHub Desktop.
Save jk/933841aed593848680a61bc4b7294df6 to your computer and use it in GitHub Desktop.
Telegraf Speedtest
#!/bin/bash
curl -sL https://repos.influxdata.com/influxdb.key | sudo apt-key add -
echo "deb https://repos.influxdata.com/debian stretch stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
sudo apt-get update
sudo apt install -y telegraf
# Add this to /etc/telegraf/telegraf.conf
[[inputs.exec]]
commands = [
"/usr/local/bin/speedtest-cli --json"
]
timeout = "1m"
interval = "10m"
name_suffix = "_speedtest"
data_format = "json"
tag_keys = [
"client_isp",
"client_ip",
"server_id",
"server_name",
"server_country",
"server_cc"
]
#!/bin/bash
wget -O speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py
chmod a+x speedtest-cli
sudo mv speedtest-cli /usr/local/bin
#!/bin/bash
sudo systemctl enable telegraf
sudo systemctl restart telegraf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment