{"id":196,"date":"2017-03-05T21:25:44","date_gmt":"2017-03-05T20:25:44","guid":{"rendered":"https:\/\/jeremyverda.net\/?p=196"},"modified":"2019-02-05T22:27:40","modified_gmt":"2019-02-05T21:27:40","slug":"traceroute-with-zabbix-and-mtr","status":"publish","type":"post","link":"https:\/\/jeremyverda.net\/traceroute-with-zabbix-and-mtr\/","title":{"rendered":"Traceroute with Zabbix and MTR"},"content":{"rendered":"
At the company I work for, we are using Zabbix to monitor our infrastructure and in some case we are using “traceroute” to keep an eye on our network from different locations.<\/p>\n
By keeping a traceroute history, it can help you to understand some networking problem by example when you are facing packet loss from some location.<\/p>\n
To keep this history in Zabbix, we are using “MTR<\/a>” instead of the traditional “traceroute” command.<\/p>\n Here is a small explanation of what MTR is, taken from the Github page of the project :<\/p>\n mtr combines the functionality of the ‘traceroute’ and ‘ping’ programs <\/em> As mtr starts, it investigates the network connection between the host<\/em> Here is an example of the command output :<\/p>\n <\/p>\n MTR is installed on our Zabbix proxies and on the main server.<\/p>\n Under Debian, the command to install MTR is :<\/p>\n As we are using proxies and active agents, the remote commands are not supported. So we have deployed a local script on the server and proxies.<\/p>\n Here is the local script :<\/p>\n This local script is named “mtrtrace.sh<\/strong>” and is saved under the “externalscripts<\/strong>” directory of Zabbix. The path can be found in the proxy or server configuration file under the following configuration key : “ExternalScripts<\/strong>“. Under Debian it’s “\/usr\/lib\/zabbix\/externalscripts<\/strong>“.<\/p>\n Once you have created the file, you have to allow Zabbix to execute it by using the following commands :<\/p>\n Then import the following template in Zabbix web interface and link it to a host :<\/p>\n If you prefer to add it in an existing template, here are the settings :<\/p>\n <\/p>\n It will use the first ” IP address” in the “Agent interfaces” part of the host configuration.<\/p>\n You will find the history of data under the application “Traceroute<\/b>” and in the item ” MTR Trace<\/strong>” on the “L<\/strong>atest data<\/strong>” tab of the configured host.<\/p>\n Here is an example of data from this tab :<\/p>\n <\/p>\n Please note that, it’s recommended to increase the “Timeout<\/strong>” value in the Zabbix Server and Proxies configuration files to use this script. On my side it takes 10 seconds in average to be completely executed.<\/p>\n","protected":false},"excerpt":{"rendered":" At the company I work for, we are using Zabbix to monitor our infrastructure and in some case we are using “traceroute” to keep an eye on our network from different locations. By keeping a traceroute history, it can help Read More …<\/a><\/p>\n","protected":false},"author":1,"featured_media":203,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","footnotes":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[4,16],"tags":[23,7,17],"jetpack_publicize_connections":[],"yoast_head":"\n
\n in a single network diagnostic tool.<\/em><\/p>\n
\n mtr runs on and a user-specified destination host. After it<\/em>
\n determines the address of each network hop between the machines, <\/em>
\n it sends a sequence of ICMP ECHO requests to each one to determine the <\/em>
\n quality of the link to each machine. As it does this, it prints<\/em>
\n running statistics about each machine. <\/em><\/p><\/blockquote>\nsudo aptitude install mtr<\/pre>\n
#!\/usr\/bin\/env bash\nIP=$1\nmtr -r -c3 -w -b $IP\n<\/pre>\n
chmod +x mtrtrace.sh\nchown zabbix:zabbix mtrtrace.sh\n<\/pre>\n
\n