Few days ago I helped my friend to write a web-based MTR, and here is the script:
<form action="index.php" method="get"> Address <input type=text name=address /> Counter <input type=text name=counter size=4 value=15> <input type=submit value=go /> </form> <?php if (strlen($_GET[address]) > 0 && $_GET[address] != 'localhost' && $_GET[address] != '127.0.0.1' && $_GET[address] != '127.0.0.0/8' && $_GET[counter] <= 50) { $output = shell_exec('mtr '.$_GET[address].' -r -c '.$_GET[counter]); echo "<pre>$output</pre>"; } ?>
The script will execute shell command similar to:
$ mtr <host> -r -c <counter>
Any chance you could make a small addition to openwrt mtr so that it can run inside of a script?