Sunday, March 28, 2010

Ubuntu && Speedtouch DSL Router - Metrics

Usage:
spiros@lapdog:~/$ speedtouch.sh [1] [2]



1: times to run query
2: delay between queries
Example:



spiros@lapdog:~/$ speedtouch.sh 50 5|grep Margin
The above will result in printing 50 times (every 5 seconds each repetition) the Signal/Noise Ratio 
e.g. 
Margin       (dB)            :        18.0             34.0
Margin       (dB)            :        18.0             34.0
Margin       (dB)            :        18.0             32.5



Margin       (dB)            :        18.0             32.5
....

Example 2:






spiros@lapdog:~/$ speedtouch.sh 50 5|grep Margin>>Margin.txt
The above example stores Margin to text file Margin.txt for further analysis.
Bash Script:
# = = = = = = = = = = = = = = = = =
# GPL v2 - http://www.gnu.org/licenses/gpl-2.0.html
(sleep .25; #delay 250ms
echo Administrator; echo -e "\r"; sleep .25; #your username with delay 250ms
echo yourpassword;echo -e "\r"; sleep .25; #your password with delay 250ms
for i in `seq 1 $1`; #script argument 1 - repetition of query
    do
        echo ":adsl info expand enabled" ; #the query to run to router
        echo -e "\r";
        sleep $2; #script argument 2 - time to run query
    done
echo "exit" ; echo -e "\r") | telnet 192.168.1.254 #router ip address






# = = = = = = = = = = = = = = = = =

  • Don't forget to chmod the script to +x.
  • You must change the password.
  • Be carefull were you put the *.sh file. Password is stored in plain text format.
  • Tested on Alcatel Speedtouch ST780.
  • Should work with a little tweak on many other telnet-able modems/routers.

No comments: