looking-glass icon indicating copy to clipboard operation
looking-glass copied to clipboard

Mikrotik Traceroute

Open agent-squirrel opened this issue 4 years ago • 2 comments

The Traceroute tool on Mikrotik ROS operates like an MTR and continually updates the console with metrics. This can be avoided with count=1 but if the traceroute encounters a blank hop for any reason, the router rewrites the console anyway. If running the traceroute with no controlling terminal, as in the case of an LG, the result gets output in chunks and only the final chunk is actually useful.

A solution is to explode the resultant string data into an array using the blank line between each chunk as a deliminator and then takes the final index as the resultant string.

Adding $filtered = end(explode("\n\n",trim($filtered))); Somewhere before the filtered output is returned has fixed this issue on our install of LG. We have added it just before return preg_replace('/(?:\n|\r\n|\r)$/D', '', $filtered);

agent-squirrel avatar Jul 06 '20 06:07 agent-squirrel

Can confirm the above fix works, great stuff @agent-squirrel

safnz avatar Jul 20 '20 21:07 safnz