<!doctype linuxdoc system>

<!-- $Id: speedtouchgraphinghowto.sgml,v 1.13 2005/12/21 09:04:00 koos Exp $ -->

<article>

<!-- Title information -->

<title>Generating Alcatel Speedtouch graphs micro-howto
<author>Koos van den Hout &lt;koos@kzdoos.xs4all.nl&gt;&nl;
<date>$Date: 2005/12/21 09:04:00 $
<abstract>
This document tries to describe how to generate graphs of the line-quality
as measured by Alcatel "Speedtouch Home" ADSL modems.
</abstract>

<toc>

<sect>Disclaimer
<p>
Given clashes I have seen with Alcatel about publishing data about Alcatel
modems I need to add a disclaimer.
<p>
This document is written as an independent article. I am not in any way
connected to Alcatel other then as a user of an Alcatel Speedtouch modem.
Doing things as published here may already be something Alcatel does not
approve of.

<sect>About this document
<p>
People with Alcatel Speedtouch ADSL modems have probably at one time or
another visited the pages 
<url name="SDSC's Self-Help Guide to the Alcatel Speed Touch Home ADSL modem."
url="http://security.sdsc.edu/self-help/alcatel/"> and wondered how to make
those carrier graphs mentioned there themselves. Those carrier graphs can be helpful in
determining causes of line problems and getting your phone company to
repair your phoneline instead of making you install the drivers again.
Unfortunately,
<url name="the FAQ"
url="http://security.sdsc.edu/self-help/alcatel/faq.shtml"> keeps telling:
<it>Q: How do I generate one of those nifty charts? A: That information will be forthcoming soon.</it> so I decided to find out for myself.
<p>
This document is written for an audience which understands enough of
Unix to be able to write scripts and make things run from the crontab
regularly and be able to install extra software if needed. All the scripts
and software described here might be available on a Microsoft Windows
platform too but as I have no experience with so I can't describe that.
<p>
Additions/improvements to this document are welcome at the above e-mail
address.

<sect>Prerequisites
<p>
<itemize>
<item>An alcatel speedtouch modem. At this moment this works (for me) on a 
Speedtouch Home ethernetmodem with 3.2 firmware. I have tried other modems
(such as the Speedtouch 546i) but could not get carrier data from them (they
must have the carrier data in there somewhere to function, so I want to get
that data!).
<item>The 'expert mode password' for this modem.
<item>Some operating system which supports Perl, sockets and gnuplot (tested
with Linux, should work with Solaris, FreeBSD and others, might even work with
Windows NT). Scheduled operation of scripts is also needed.
<item>Perl 5.
<item>The Perl module Net::Telnet (install from cpan).
<item>A recent version of gnuplot.
<item><url name="The scripts that come with this howto that can be downloaded"
url="http://idefix.net/~koos/speedtouchgraph-scripts.tar.gz">.
<item>A cooperative dslam in your exchange which will give you a statistics report.
</itemize>

If the 'cooperative dslam' is missing then you will miss the upstream part
of the statistics.

<sect>Fetching the status
<p>
The script <tt>fetchst.pl</tt> fetches the status from the modem. It simply
does this by logging in over a telnet session, giving the right commands
in a 'expect this string, send that' manner and logging the results to a
logfile for later processing. The quality data for each carrier is logged
(and some extra data like the maximum bitrate, but the scripts don't do
anything with that data at the moment). For each of the 256 ADSL carriers,
the modem measures and keeps the SNR (signal/noise ratio) in cooperation
with the dslam.

<sect1>Automating the fetching of the status
<p>

It is a lot more interesting when this fetching happens automatically on
regular intervals. Therefore the shell script <tt>alcatelprobe</tt> calls
<tt>fetchst.pl</tt> and then renames the result to a filename depending
on the part of the day. The easiest way to use this is to call it every
10 minutes (depending on how much data you want per day) from crontab. I
have a crontab entry like:
<p>
<tscreen><verb>
*/10 * * * * bin/alcatelprobe
</verb></tscreen>

<sect>Processing the logfiles to a plotdatafile and plotting the results
<p>

The next step is to take the results of the last 24 hours and converting
those to a datafile that gnuplot can convert into a graph. This is done
by the script <tt>alcatel-day</tt> which first calls <tt>mklogs</tt>, a
shell script which converts all .log files to one <tt>alcatel-day.dat</tt>
file using the perl script <tt>eatalcatellog.pl</tt>. Then gnuplot is
called using the <tt>plotscript</tt> as command file and the result is
moved to the right directory with the right filename for the webserver.

<sect1>Automating the processing and the plotting
<p>

After the last interval before midnight (in 10 minute intervals that is at
23:51) the processing can happen. To automate this create a crontab entry
like:
<p>
<tscreen><verb>
51 23 * * * bin/alcatel-day
</verb></tscreen>

<sect>Displaying the results
<p>

The easiest way to display the results is to have the directory-indexing
module of your webserver do the sorting. In Apache, an overview with
descending filenames (latest first) can be created using an url
like <tt>http://www.example.com/alcatel-logs/?N=D</tt>

<p>

The result will look like (depending ofcourse on your phone line and adsl
subscription) this 
<url name="Sample graph of my phone line" url="http://idefix.net/~koos/pics/alcatel-graph.png">.

<sect>Future improvements
<p>

In the future it would be nice to be able to create graphs for other brands
of (A)DSL modems. Then this would be a more general howto then just for
the Alcatel. But I don't have one of those modems, so I need help from others
to do that.

<sect>Links
<p>
<itemize>
<item><url name="http://www.alcateldsl.com/" url="http://www.alcateldsl.com/">
<item><url name="http://www.sateh.com/hacks/crc.php" url="http://www.sateh.com/hacks/crc.php">.
</itemize>

</article>
