# Modem usage monitor

Last version version 0.32 Thu Jan 25 11:00:03 CET 2001

This programm is used to monitor modem usage over time (allthough it can easily be changed to monitor any other ressource). It generates an image showing modem/ressource usage over time, which can be incorporated in an automagically updated HTML page like this:

Analog ISDN

Modems are counted from top to bottom. A colored bar represents a modem being active. The number on the vertical axis is the tty-port-number so you have to add 1 to have the corresponding serial port-number that is the number of the modem.

The horizontal-axis represents the time axis. In this case it should represent 3days and 8 hours

Modemusage it is a Perl script copyrighted by T.Pospisek under the GPL. You can download it here. If you use it, then please leave me a note.

The following is an excerpt from the README:

MODEMUSAGE
----------

Description:  This small Perl script generates a png with a x-y representation
of modem(tty) usage over time. This can be very well used to
display the modem usage on a web page.

Preliminary:  You need the GD library from http://www.boutell.com/gd/. You
need Perl (http://www.perl.org) too.

Installation: 1) Decide where you want to have the png in and how it should be
called. Edit the config file. Find the line for the template:

$template = "/var/www/stats/usage.png"; and replace it by the absoltue path to the png. Do the same with the line:$grafik = "/var/ww/stats/usage_axe.png";

This is the actual picture. Edit the demo-www-page index.html
and change the location of the png file (here usage_axe.png)
appropriately.

2) Edit the config file. Change the line my $n_modems = 32 to represent correctly the number of modems you've got. 3) Find out how you can display a list of used ttys. On my system (with a Cyclades board) I can do this with: w -hs|fgrep ttyC|cut -b 14-17 Change the line: my$get_ttys="w -hs|fgrep ttyC|cut -b 14-17";

appropriately.

4) Decide on how often you want your modems to be checked. Edit
your crontab and put a command line like the following in it:

0,5,10,15,20,25,30,35,40,45,50,55 * * * * root modemusage -f /etc/modemusage.cfg.

where /etc/modemusage.cfg is the config file.

Decide how long a period you want to monitor and change that
in the line:

my $x_s = 960 *$x_factor;

\$x_factor represents the x-axe stretch factor and probably
doesn't need to be changed.

960 is the number of checks to represent in a picture.
To calculate the correct number for yourself you divide the
legth of the period in minutes you want to represent by the
length of the period a check is done. Since we're checking
every 5 minutes in cron 960 represents 3 1/3 days here...

5) Well ok, go for it. You should be able to look at the
index.html page and have it refreshed every 5 minutes...
Good luck, and hope you'll have an easier job now finding
broken/hung modems...

Copyright etc.:  Programm written and (c) under GPL by T. Pospisek. The
homepage of this proggie is www.sourcepole.ch/sources/software/modemusage