As a continuation to my previous global blog HTTP response time monitoring, let's continue with tracerouting. Apart from extremely small modification, for this feature, I cannot take the credit, but it belongs to this guy. It's time to add some fancy mtr data to Zabbix! For those who do not know, mtr is an enhanced version of the traditional traceroute command, showing you the network hops from your machine to some destination.
Add the template to Zabbix
Taking the instructions directly from the template author:
- Copy the script file mtr.sh to the ExternalScripts folder on your Zabbix Server or Proxy.
- Make the script executable:
chmod +x mtr.sh
- Import the Template by IP or Template by DNS to your Zabbix Server.
Well, that was easy. But, as I did setup my global monitoring with five Zabbix agents hanging around, I needed to do extremely small modification to the mtr.sh script.
Instead of the original
#!/bin/bash
MTR=$(which mtr)
IP=$1
$MTR -r -c3 -w -b -p -j $IP
... it is now
#!/bin/bash
MTR=$(which mtr)
IP=$1
OUTBOUNDINTERFACE=$2
$MTR -r -c3 -w -b -p -j $IP -a $OUTBOUNDINTERFACE
With that modification, mtr uses any IP address that's configured on server for its outbound connections instead of the primary interface.
Tune the template in Zabbix
The mtr template has exactly one item and to make the above script modification to work, I needed to modify the template just a tiiny tiny bit: added the {$OUTBOUNDINTERFACE} macro there as the second parameter for mtr.sh and ....
... added the said macro to each of my probe hosts.
The results
As a result, I can now see how the packets travel around the world. I hope they remember to snap some photos of the virtual destinations they travel to...
Actually following the traceroute in time series format can be very useful, as you can visually see the exact spot when something changed, and then compare what was the change.
Using Grafana's Zabbix plugin, you can then for example see the individual hops and their state over time in a bit different format. I'm sure that this template has it uses in the actual business monitoring, too. Next time, we'll take a look at DNS monitoring.
Add new comment