The Need for (Internet) Speed… graph

Another one of more or less useful “projects” that got my attention was enabling Zabbix (while monitoring everything else) to also keep track of my Internet speed. There are sources on the Internet that tell you how (easy it is) to do it, but I was not that lucky – had issues trying to set it up. 🤷‍♂️🙂

 

What I’m using:
– Zabbix 7 (installed on Ubuntu 24.04)
(https://www.zabbix.com/download?os_distribution=ubuntu)
– Speedtest CLI by Ookla
(https://www.speedtest.net/apps/cli)
– some scripts

 

So, Zabbix is installed and working, no big surprise there.

 

Next thing we need to install is Speedtest CLI by Ookla – it’s a simple installation… sort of.
Installing it directly on Zabbix server.

(copy/paste from Ookla’s site – https://www.speedtest.net/apps/cli):

This usually works, but didn’t work for me. 🙂

Something cannot be found… hmmm… maybe if we look for “jammy Release”? 🤔

That (= changing “noble” to “jammy” in the sources list file) fixed it! Yaay! And now we can install speedtest:

If all goes well, we can check the version:

And we can test it couple of times manually, to see if it’s working:

 

Cool! This works! 🙂
Now the tough part – how can I make Zabbix pick it up?!

 

Let’s just say that the “normal and direct way” didn’t work that well (Speedtest tool was probably hitting timeouts on the Zabbix side, and had issues in delivering results to Zabbix – seen the timeout errors).

 

So, another solution was necessary – to work around the timeout errors, I’m actually running the Speedtest tool, store/cache data temporarily, and then Zabbix picks it up when it’s in the mood to do so. As I’m doing measurements every 15 minutes or so, there is plenty of time to pick the numbers up and not run into timeouts.

 

Solution is (relatively) simple:

– script that runs and stores/caches measurements (speedtest-cache.sh)
– systemd service and timer that run the script in 15-minute intervals (zabbix-speedtest.service, zabbix-speedtest.timer)
– script that reads measurements from the Zabbix side (speedtest-read.sh)
– Zabbix items representing measured values (template-speedtest-cache.xml)
– widget/graph that shows data in Zabbix

 

And here it is:
/usr/lib/zabbix/externalscripts/speedtest-cache.sh:

/etc/systemd/system/zabbix-speedtest.service:

/etc/systemd/system/zabbix-speedtest.timer:

/usr/lib/zabbix/externalscripts/speedtest-read.sh:

(manually imported) template-speedtest-cache.xml:

Added all the scripts, timers and services, fixed all the permissions, checked that I have data, and now my Internet Speed Monitor widget looks like this (it’s not much, but hey! 🙂):

Cheers!

P.S. I’m not a Zabbix expert, and I’m not responsible if this “solution” causes you any troubles!

P.P.S. Don’t just copy everything from the Internet! It’s full of bad people (and code)! 😉

Leave a Comment.