Giter Site home page Giter Site logo

pschmitt / zabbix-template-speedtest Goto Github PK

View Code? Open in Web Editor NEW
31.0 5.0 20.0 6.95 MB

Speedtest template for zabbix

License: GNU General Public License v3.0

Shell 100.00%
zabbix speedtest monitoring bandwidth bandwidth-monitor zabbix-speedtest speedtest-template

zabbix-template-speedtest's Introduction

Zabbix Speedtest template

Dependencies

⚠️ Warning

You need to install Ookla's version of speedtest-cli and NOT the unofficial python tool.

Installation (Generic x86_64)

  • Install speedtest-cli
  • Create /etc/zabbix/bin: mkdir -p /etc/zabbix/bin
  • Copy zbx-speedtest.sh to /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.xml on your Zabbix server

Installation (Debian/Ubuntu)

  • Install speedtest-cli
  • Create /etc/zabbix/bin: mkdir -p /etc/zabbix/bin
  • Copy zbx-speedtest-debian.sh to /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.xml on your Zabbix server

Installation (OpenWRT)

  • Install speedtest-cli by placing the binary in your $PATH
  • Copy zbx-speedtest.sh to /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 of systemd/speedtest.crontab
  • Import template_speedtest.xml on your Zabbix server

Installation (Docker)

Speedtest in a container

Check out pschmitt/speedtest:cron on Docker Hub

Zabbix-agent

  • You must mount zbx-speedtest.sh inside 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

zabbix-template-speedtest's People

Contributors

pschmitt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

zabbix-template-speedtest's Issues

speedtest.sh line 12

Ubuntu server Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-112-generic x86_64);

speedtest.sh[20968]: /etc/zabbix/bin/speedtest.sh: 12: /etc/zabbix/bin/speedtest.sh: [[: not found

changed line 12 from [[ double]] to [single], still works stable.
if [ -e "$LOCK_FILE" ]

gruss,
Rosen

monitoring multiple ISP lines

Hi,

Thank you so much for the work you have done on this, really awesome!

Can you please help on how to monitor multiple ISP lines. The script works perfectly, but I need to be able to monitor multiple lines, is it I have to install linux+zabbix_agent on a different place and allow that machine through the FW on that ISP line in order to be able to monitor that specific line? I am not sure if this is how you planned this excellent piece of art :)
Do you have better ideas? I am all ears to be honest.

thanks a lot

On Zabbix 6.4.6 i get "Unsupported key items" in every item

Hello, on Debian 12 and Zabbix 6.4.6 running I managed to import the template and followed seamlessly all the setup steps. Great! I linked the template to my Zabbix server but all items row are showing the infamous red "i" saying "unsupported key item". Am I missing something?

Server_ID Not found

Getting the following issue when the script runs:
/etc/zabbix/script/speedtest.sh: 9: /etc/zabbix/script/speedtest.sh: SERVER_ID[0]=3997: not found

It doesn't matter what the server ID is set to.

Issues on Ubuntu 18.04.3 LTS

Firstly noticed the file zbx-speedtest.sh used to have #!/usr/bin/env bash as per:
#2

But this change reverted when the sh script was updated.

Also in zabbix-speedtest.service User is zabbix-agent. On Ubuntu the default Zabbix user is just zabbix so might want to mention in the README.md the need to change this value to the right user on Ubuntu systems.

Thanks for the great work, all working here with those changes.

renamed speedtest

seems like you renamed speedtest to speedtest-linux-amd64

This makes your readme very hard to follow but more importantly, theres a bug in speedtest.sh on line 23 as its referencing "speedtest".

Unless I have mine completely setup wrong, I dont think your master will build as is

Unable to import the template.

I know it's a pretty old project and I'm not sure if you check it or not !

We are not able to import the template ,
Error: Invalid parameter "/1/request_method": value must be 0.

Please advise

No DATA in Zabbix

Hello Philipp,

I don't know if your project is still being followed.

My problem is that I have no data in Zabbix and Grafana, the zbx-speedtest.sh script is ok manually - no error

I have debian10, zabbix 5.2.1, grafana 7.3.3
The template import is ok, I can see the metrics well but no data appears in Grafana.

I created a Dashboard in Zabbix but no data

I have been following your Debian installation and have not encountered any problems.

Can you help me try to see more clearly :-)

Thanks for your time and help.

Piboxx

unsuported item key

Jai redémarrer le service vérifier les mise a jour et installer avec 2 méthode différente cela ne résout rien
dans interface web jai toujours les elements en unsuported item key
merci d'avance pour l'aide

Sometimes speedtest hangs

I found that in my setup, once in a great while, the speedtest run with --run, will hang. Not sure why, but it does.

However, if I edit the script, so instead of running just speedtest, I run timeout 5m speedtest (works on debian) then even if it does hang, timeout kills it and my monitor keeps working.

Minor instruction fix for debian

For debian (maybe others?), you should mention that you need to install bc and jq for the service to function properly. Super happy with this BTW, thanks!

Adding speed.latency to template

Philip,

This is not an issue, but an addition request.
Again thank you very much for a very good template for zabbix. It helps me very much indeed.
I was looking at the template and you have 6 items under the template, Download, Upload, Jitter, Ping, Server and Timestamp. I would like to add Latency to this list.
I have looked at the json output and latency does exist, next to jitter. So I tried to clone jitter and just replace the work jitter with latency, but this did not work.
I tried adding the item to the zabbix server, but this showed as "not supported"
latencyitem
I tried to figure out where and how the template was extracting the delivered entities but could not, so would very much appreciate your guidance with adding latency to this template.

Thanks
Lawrence

[[: not found

On debian 10 I hed these issues

/etc/zabbix/bin/zbx-speedtest.sh: 135: /etc/zabbix/bin/zbx-speedtest.sh: [[: not found
/etc/zabbix/bin/zbx-speedtest.sh: 137: /etc/zabbix/bin/zbx-speedtest.sh: [[: not found
/etc/zabbix/bin/zbx-speedtest.sh: 61: /etc/zabbix/bin/zbx-speedtest.sh: [[: not found

I could fix them by changing like this

61: [ "$(( now - data_ts ))" -gt "$MAX_AGE" ]
135: if [ "$ACTION" != "run" ]
137: if [ "$MAX_AGE" -gt 0 ] && data_is_outdated

Les items ne fonctionnent pas.

Bonjour,

Chaque 5 minutes le speedtest est bien fait et enregistrer dans speedtest.json, mais quand je demande le graphique (sur grafana).
Je n'ai rien qui s'affiche, pas de courbe.

Merci.
Nathan G.

Ubuntu 20.04.1 LTS & Zabbix Unsupported item key and "Data is outdated. MAX_AGE is set to 3600 seconds. Please update with --run."

OS

Distributor ID: Ubuntu
Description: Ubuntu 20.04.1 LTS
Release: 20.04
Codename: focal

Prerequisites

Speedtest

speedtest-cli 2.1.2
Python 3.8.2 (default, Jul 16 2020, 14:00:26) [GCC 9.3.0]

bc

bc 1.07.1
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006, 2008, 2012-2017 Free Software Foundation, Inc.

jq

jq-1.6

Zabbix

etc/zabbix/zabbix_agentd.d# zabbix_server --version
zabbix_server (Zabbix) 5.0.4

SSH script

SSH script is owned by zabbix:zabbix

I followed the Ubuntu instructions template is imported. When I manually try to execute test in zabbix_server.log I have following entries.

4297:20201002:104305.054 error reason for "zabbix.home:net.isp.speedtest" changed: Unsupported item key.
  4297:20201002:105145.606 error reason for "zabbix.home:speedtest.download" changed: Value of type "string" is not suitable for value type "Numeric (float)". Value "Data is outdated. MAX_AGE is set to 3600 seconds. Please update with --run."
  4295:20201002:105515.958 item "zabbix.home:speedtest.download" became not supported: Value of type "string" is not suitable for value type "Numeric (float)". Value "Data is outdated. MAX_AGE is set to 3600 seconds. Please update with --run."
  4296:20201002:105843.248 item "zabbix.home:speedtest.jitter" became not supported: Value of type "string" is not suitable for value type "Numeric (float)". Value "Data is outdated. MAX_AGE is set to 3600 seconds. Please update with --run."
  4296:20201002:105844.255 item "zabbix.home:speedtest.ping" became not supported: Value of type "string" is not suitable for value type "Numeric (float)". Value "Data is outdated. MAX_AGE is set to 3600 seconds. Please update with --run."
  4296:20201002:105846.267 item "zabbix.home:speedtest.timestamp" became not supported: Value of type "string" is not suitable for value type "Numeric (unsigned)". Value "Data is outdated. MAX_AGE is set to 3600 seconds. Please update with --run."
  4297:20201002:105847.274 item "zabbix.home:speedtest.upload" became not supported: Value of type "string" is not suitable for value type "Numeric (float)". Value "Data is outdated. MAX_AGE is set to 3600 seconds. Please update with --run."

I guess it refers to this line https://github.com/pschmitt/zabbix-template-speedtest/blame/598a8274cbbed505a080e36c51968cc9ab733040/zbx-speedtest-debian.sh#L140

What could be an issue here?

Best regards
Wojciech

Zabbix no colect data

Hello,

I need help again,

zbx-speedtest-debian.sh script - OK
speedtest.json - OK

0 infos in zabbix and grafana

image

Using Ookla's speedtest command line interface - success.

The github version of speedtest-cli has issues that cause it to return incorrect values in some cases. I obtained the "official" version of the speedtest command line interface from Ookla (https://www.speedtest.net/apps/cli) and have it working like a champ on my system now. It did require changes to the script, some additional directories/permissions to make it all work, but working it is. I don't mind sharing, if anyone is interested.

zbx-speedtest.sh[9436]: usage: speedtest Errors

This was all working without any issues and then it broke. I have tried removing it completely from zabbix and reinstalling it. All without success.

I have some issues with permissions and then found the info about manually deleting the speedtest.json and speedtest.json.new. After manually removing these files from the /tmp/ dir, the error changed. Below is what I am seeing in the syslog file.

Dec 22 14:25:03 kodi systemd[1]: Started Run a speedtest.
Dec 22 14:25:03 kodi zbx-speedtest.sh[9730]: usage: speedtest [-h] [--no-download] [--no-upload] [--single] [--bytes]
Dec 22 14:25:03 kodi zbx-speedtest.sh[9730]: [--share] [--simple] [--csv] [--csv-delimiter CSV_DELIMITER]
Dec 22 14:25:03 kodi zbx-speedtest.sh[9730]: [--csv-header] [--json] [--list] [--server SERVER]
Dec 22 14:25:03 kodi zbx-speedtest.sh[9730]: [--exclude EXCLUDE] [--mini MINI] [--source SOURCE]
Dec 22 14:25:03 kodi zbx-speedtest.sh[9730]: [--timeout TIMEOUT] [--secure] [--no-pre-allocate]
Dec 22 14:25:03 kodi zbx-speedtest.sh[9730]: [--version]
Dec 22 14:25:03 kodi zbx-speedtest.sh[9730]: speedtest: error: unrecognized arguments: --accept-license --accept-gdpr -f json
Dec 22 14:25:03 kodi systemd[1]: zabbix-speedtest.service: Succeeded.

FYI: I am running this all on Ubuntu 20.04. I am currently using the debian version of the script. zbx-speedtest-debian.sh

After the test has run, I am seeing no data in the graph.
Any ideas why this is happening.
Thanks
Lawrence

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.