Check your internet speed with Zabbix

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.

{$NO_SPDTST_DATA_SECS}

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<
Hasan

Published by Hasan Altin

I don't see any difference between the one who doesn't share its knowledge or the one who doesn't share its bread.

6 comments on “Check your internet speed with Zabbix”

Why the cronjob? You can start the shell script from the zabbix agent with a user parameter. That way the whole process is controlled by zabbix

Great tutorial. I have followed it from start to finish but i don’t know how and where to view the resulting graph in zabbix server. Can you please guide me?

Hello, you can use latest data to see the details or can create a graph widget on the dashboard using the data sets upload and download bandwith as you can see below.

That is very possible. You need to run a powershell script and you need to read the output via agent. I haven’t done any research and I would do like this If I needed.

Leave a Reply

Your email address will not be published. Required fields are marked *