You need to install Ookla's version of speedtest-cli and NOT the unofficial python tool.
- Install speedtest-cli
- Create /etc/zabbix/bin:mkdir -p /etc/zabbix/bin
- Copy zbx-speedtest.shto/etc/zabbix/bin
- Make it executable: chmod +x /etc/zabbix/bin/zbx-speedtest.sh
- Install the systemd service and timer: cp systemd/{zabbix-speedtest.service,zabbix-speedtest.timer} /etc/systemd/system
- Start and enable the timer: systemctl enable --now zabbix-speedtest.timer
- Import the zabbix-agent config: cp zabbix_agentd.d/speedtest.conf /etc/zabbix/zabbix_agentd.conf.d
- Restart zabbix-agent: systemctl restart zabbix-agent
- Import template_speedtest.xmlon your Zabbix server
- Install speedtest-cli
- Create /etc/zabbix/bin:mkdir -p /etc/zabbix/bin
- Copy zbx-speedtest-debian.shto/etc/zabbix/bin/zbx-speedtest.sh
- Make it executable: chmod +x /etc/zabbix/bin/zbx-speedtest.sh
- Install the systemd service and timer: cp systemd/{zabbix-speedtest-debian.service,zabbix-speedtest.timer} /etc/systemd/system; mv /etc/systemd/system/zabbix-speedtest{-debian,}.service
- Start and enable the timer: systemctl enable --now zabbix-speedtest.timer
- Import the zabbix-agent config: cp zabbix_agentd.d/speedtest.conf /etc/zabbix/zabbix_agentd.conf.d
- Restart zabbix-agent: systemctl restart zabbix-agent
- Import template_speedtest.xmlon your Zabbix server
- Install speedtest-cli by placing the binary in your $PATH
- Copy zbx-speedtest.shto/etc/zabbix_agentd.conf.d/bin
- Make it executable: chmod +x /etc/zabbix_agentd.conf.d/bin/zbx-speedtest.sh
- Import the zabbix-agent config: cp zabbix_agentd.d/speedtest.openwrt.conf /etc/zabbix_agentd.conf.d
- Restart zabbix-agent: /etc/init.d/zabbix-agentd restart
- Install the cron job: crontab -e-> Add the content ofsystemd/speedtest.crontab
- Import template_speedtest.xmlon your Zabbix server
Check out pschmitt/speedtest:cron on Docker Hub
- You must mount zbx-speedtest.shinside your zabbix-agent container
- It also needs to have access to speedtest data volume
Below is an example docker-compose.yaml.
NOTE: pschmitt/zabbix-agent2 contains jq which is required by zbx-speedtest.sh.
---
version: "3.7"
services:
  speedtest:
    image: pschmitt/speedtest:cron
    volumes:
      - "./data/speedtest:/data"
    environment:
      - INTERVAL=300
  zabbix-agent:
    image: pschmitt/zabbix-agent2:latest
    restart: unless-stopped
    hostname: ${HOSTNAME}
    privileged: true
    network_mode: host
    pid: host
    volumes:
      - "./config/bin:/zabbix/bin:ro"
      - "./config/zabbix_agentd.d:/etc/zabbix/zabbix_agentd.d:ro"
      - "./data/speedtest:/data/speedtest:ro"
    environment:
      - ZBX_HOSTNAMEITEM=system.hostname
      - ZBX_SERVER_HOST=zabbix.example.com