Zabbix Template Net MTR (My traceroute)

A Zabbix template for mtr (My traceroute). It uses all the new features from Zabbix 4.4 and 5.0 with Master Items, JSONpath processing and Dependent items.
This template was built on Zabbix 5.0.x and Debian 9 & 10 amd64 with mtr-tiny.

Template Net MTR

Installation

  1. Copy the script file mtr.sh to the ExternalScripts folder on your Zabbix Server or Proxy.
  2. Make the script executable: chmod +x mtr.sh
  3. Import the Template to your Zabbix Server.
  4. Link the template to the target host. From there on Zabbix Server or Proxy will discover and monitor the hops between itself and the target’s HOST IP using the {HOST.IP} macro.

Notes

These files and templates were tested and created on Zabbix 4.4 & 5.0 and Debian Linux 9 & 10 amd64 with the package mtr-tiny.
The XML file provided is exported from Zabbix 5.0.3.
This template creates a Master item, which executes the script and receives the MTR JSON output. From there on we have a Low-Level-Discovery rule, that discovery three item prototypes:

  • Name of each Hop
  • Average RTT(ms) of each Hop
  • ICMP Loss% of each Hop

There are no Trigger or Graph prototypes in this template at the moment.
Parts of this Template are directly related to a reddit discussion, which gave me a very good starting point.

Example / Screenshot

Latest data
Latest data

Changelog

  • 01 October 2020: initial commit.

Author: Marco

Marco is an IT-System administrator and IT-Consultant with 10+ years experience. He is specialized in the delivery of virtual Apps and Desktops with Citrix solutions. In 2017 he has been awarded Citrix Technology Advocate by Citrix for his community work (#CTA). His second core area is availability & performance monitoring with Zabbix, a leading open-source solution. His employer is the German IT-Company ANAXCO, which is developing a Transport Management Software (TMS) based on Microsoft Dynamics AX. More about Marco

5 thoughts on “Zabbix Template Net MTR (My traceroute)”

  1. Just 1 question

    Copy the script file mtr.sh to the ExternalScripts folder on your Zabbix Server or Proxy.
    Make the script executable: chmod +x mtr.sh

    How and where to this in docker ?

  2. I thank you for the beautiful work, but I do not understand how to add the IP where I want to use the MTR.

    In the tutorial the point that I have difficulties is .4

    Link the model to the target host. From there, the Zabbix Server or Proxy will discover and monitor the hops between themselves and the target’s host IP using {HOST. IP} macro.

    1. In Zabbix, when you create a host, you have to create an interface, which contains an IP or DNS name. https://www.zabbix.com/documentation/current/manual/config/hosts/host
      Most of the time, the interface will be of type “Agent” configured with an IP address.
      This IP address, can be referenced in items, via the MACRO {HOST.IP}. https://www.zabbix.com/documentation/current/manual/appendix/macros/supported_by_location
      So if you want to use this template, create a new host, give it an interface with the IP you want to monitor, and the template will pick that address automatically.
      An alternative would be, to modify the templates master item, which is called “MTR Trace Master” and has an item key called “mtr.sh[{HOST.IP}]”, which you might change into: mtr.sh[1.2.3.4]
      Let me know if this helps.

  3. Hi Marco,

    Thanks for this. Does this work against windows OS agents? I am repeatedly getting “Failed to execute command “/usr/lib/zabbix/externalscripts/mtr.sh ‘1.2.3.4’”: Timeout while executing a shell script.” Even though it runs fine on the proxy

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.