This article shows you how to implement speedtest on zabbix. This scrips is taken and used from zabbix repository on gitgub. You can find the all necessary files here.
curl -s https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.rpm.sh | sudo bash sudo yum install speedtest yum install zabbix-sender
I assume that you installed speedtest package on your zabbix server then run the speedtest command and arrove the aggreement typing YES like in the picture below.
Now, let’s import the template and neccessary script to our zabbix server. In this case I do all necessary installtion on my zabbix proxy but it doesnt matter you can do the same process on the other distros. Do not forget to set TimeOut=30 in your zabbix_agentd.conf file.
After importing template to your zabbix server find the host that you want to assign the template and set the macro as shown below.
Create a new folder in your zabbix folder and name it scripts and upload record_speedtest.sh to scripts folder then give execute command for this file. Then change the 8th. and 11th line in record_speedtest.sh file as shown below. I use localhost ip address because it is a zabbix proxy server, you can use your own. Type your host name in the parameter of SPDHOST, mine is COOKPRX.
chmod +x /etc/zabbix/scripts/record_speedtest.sh
One more thing left to finish implementation. Let’s create a cron job to run it. Type crontab -e and insert the command which is given below. This job will run your script each 5 minutes. My sh script name is speedtest.sh because I changed it. You can use it default one in the github.
*/5 * * * * /etc/zabbix/scripts/record_speedtest.sh >> /tmp/speedtest.log 2>&1
Let’s run the speedtest command to get the result asap. Then each 5 minutes cron job will run this script and you can follow the result via your zabbix server as shown picture below.
Thanks for your time reading.
Have a good day<