From time to time I’m experiencing Connection timed out errors in cPanel > Sent Summary and I need a way to run MTR at that exact time to troubleshoot the network problem.
For this I can create a new script, mtr.sh:
/usr/sbin/mtr -r -c 2 domain.com >> /root/mtr.log
- -r option puts mtr in report mode
- -c option prints statistics and exit
and set cron to run it every minute
* * * * * sh /root/mtr.sh
so the next time that error occurs I simply grep the mtr.log file for that time.
Another, more complicated solution involves using a python script that is called by smokeping – running only when the problem occurs.