- App to monitor and log cable modem signal level?
- Posted by MAG on December 22nd, 2004
Hi folks-
In dealing with Comcast during periodic cable problems, I'd like to be
able to present them with a log of the received signal strength and
upstream power level, collected over large periods of time, that would
demonstrate the specific events that result in poor performance.
In the past when I tell them what my signal levels used to be, and what
they are now, they don't believe me. I've got two splitters between the
cable drop and my modem, so when I tell them my normal signal level is
around -4 dbmv, they say: "no way, that's too high, your current -17 is
typical."
So, is there an application that can be set to query the modem
periodically, once or maybe several times an hour, and log that info so
that it could be imported into Excel or whatever for graphing? This
would let me hand such a graph to the service tech and say "Signal was
great until 6:30 am January 13th, then it suddenly dropped by 10 dbmv,
at the same time as I started getting periodic disconnects and fuzzy TV
signal. Find the problem in your system and fix it."
The information is available from my RCA DCM235 at this address:
http://192.168.100.1/moreInfo.html
But I would need to extract just the bits that I'm interested in to
yield flat numeric values. I could write this in VB, but maybe there is
a better way to get the information? Is there an app out there that
already does this? Or a specific query protocol I can use to get just
the numeric value back?
Any thoughts appreciated.
Marc
- Posted by Bit Twister on December 22nd, 2004
On Wed, 22 Dec 2004 09:51:05 -0500, MAG wrote:
Here is a quick hack I use to fetch data from my modem. It uses wget to
fetch the page and perl to parse the data. No idea if you can find
wget for Micro$oft. I run Mandrakelinux
#!/usr/bin/perl -w
#use warning ;
use strict ;
use diagnostics ;
#************************************************* ****************************
#
# Program: poll_cable.pl - poll cable modem and dump information
#
# Purpose: Quick kludge to read html files from cable modem and create
# cable.data containing cable modem information.
#
#
# Assumptions:
# cable modem is a Motorola SURFboard sb4220
# cable modem html files are at http://192.168.100.1
#
# To run: ./poll_cable.pl
#
# Output: /tmp/cable.data
#
# format will be keyword="data value"
#
#
#************************************************* ****************************
my ($input_line) = "" ; # line to scan for title
my ($lc_line) = "" ; # lower cased input_line
my ($len) = 0 ; # length of title string
my ($out_fn) = "/tmp/cable.data" ; # output index.html file
my ($sys_fn) = "/tmp/poll_cable.bash" ; # script filename to fetch html pages
my ($data) = 0 ; # data keyword
my ($data_fn) = "" ; # *.data file name to scan
my ($t_start) = 0 ; # <td> start column
my ($t_stop) = 0 ; # </td> stop column
sub fetch_keyword ; # get keyword and save it to $out_fn
sub fetch_data ; # fetch keyword data value
#
#************************************************* **
#*
#* Create modem *.data filenames to fetch/read
#*
#* File names were found by viewing modem web page
#* using browser View source feature.
#*
#************************************************* **
open (SYS, ">$sys_fn") or die "Opening $sys_fn $!\n" ;
print SYS "/bin/rm -f fault.flg\n" ;
print SYS "wget -q http://192.168.100.1/addressdata.htm -O address.data\n" ;
print SYS "if [ \$(stat -c %s address.data ) -eq 0 ] ; then\n" ;
print SYS " touch fault.flg\n" ;
print SYS "fi\n" ;
print SYS "wget -q http://192.168.100.1/signaldata.htm -O signal.data\n" ;
print SYS "if [ \$(stat -c %s signal.data ) -eq 0 ] ; then\n" ;
print SYS " touch fault.flg\n" ;
print SYS "fi\n" ;
print SYS "wget -q http://192.168.100.1/indexdata.htm -O index.data\n" ;
print SYS "if [ \$(stat -c %s index.data ) -eq 0 ] ; then\n" ;
print SYS " touch fault.flg\n" ;
print SYS "fi\n" ;
close SYS ;
system ("chmod +x $sys_fn" ) ; # set script executable
system ("$sys_fn") ; # generate the .data files
system ("/bin/rm $sys_fn") ; # delete command file
#
#************************************************* **
#*
#* parse each data file from cable modem.
#*
#************************************************* **
open (OUT, ">$out_fn") or die "Opening $out_fn $!\n" ;
$data_fn="address.data" ;
fetch_keyword ;
$data_fn="signal.data" ;
fetch_keyword ;
$data_fn="index.data" ;
fetch_keyword ;
close OUT ;
#
#************************************************* **
#*
#* Fetch_data - scan $data_fn looking for <dt>text</dt>
#*
#* Each keyword line is followed by the data value.
#*
#* Output format will be keyword="data value"
#*
#************************************************* **
sub fetch_keyword
{
open (DATA, "<$data_fn") or die "Opening $data_fn $!\n" ;
LINE: while (<DATA>)
{
chomp ; # kill the line feed char
if (length ($_) == 0) # empty lime
{
goto LINE ; # go get another one
}
$input_line = $_ ; # save a copy for parsing
$t_start = 0 ;
$t_stop = 0 ;
$lc_line = lc ($input_line) ; # lower case the line
$t_start = index ($lc_line, "<td>") ;
$t_stop = index ($lc_line, "</td>" ) ;
if ($t_start < 0) # <td> not on line
{
goto LINE ;
}
if ($t_stop < 0) # </td> not on same line
{
goto LINE ;
}
$t_start = $t_start + 4 ; # skip <td>
$len = $t_stop - $t_start ; # get length of data string
$_ = substr ($input_line, $t_start, $len) ;
s/ /_/g ; # change space to underscore
$data = $_ ;
fetch_data ;
print OUT "$data=\"$lc_line\" \n" ;
if ($data eq "DHCP_Information")
{
last ; # skip the rest of the file
}
} # end while (<DATA>)
close DATA ; # close .html file
system ("/bin/rm $data_fn") ; # delete it
} # end fetch_keyword
#
#************************************************* **
#*
#* fetch_data - scan for </td>
#*
#* $lc_line will contain the data value
#*
#************************************************* **
sub fetch_data
{
while (<DATA>)
{
chomp ; # kill the line feed char
$input_line = "$_" ;
$t_start = 0 ;
$t_stop = 0 ;
$lc_line = lc ($input_line) ; # lower case linput ine
$t_start = index ($lc_line, "<td>") ;
$t_stop = index ($lc_line, "</td>" ) ;
if ($t_stop < 0) # no trailing </td>
{
$t_stop = length ($lc_line) ; # use end of line instead
}
$t_start = $t_start + 4 ; # skip <td>
$len = $t_stop - $t_start ; # get length of data string
$_ = substr ($input_line, $t_start, $len) ;
s/\s*$// ; # strip trailing spaces
$lc_line = $_ ;
#************************************************* ***********
#*
#* need to clean up a few data values
#*
#************************************************* ***********
if ($data eq "DHCP_Information")
{
$_ = $lc_line ;
s/<BR>//g ;
$lc_line = $_ ;
}
if ($data eq "Signal_to_Noise_Ratio")
{
$_ = $lc_line ;
s/ //g ;
$lc_line = $_ ;
}
last ;
} # end while (<DATA>)
} # end fetch_data
#*************** end poll_cable.pl ****************************************
- Posted by BR on December 22nd, 2004
On Wed, 22 Dec 2004 16:21:05 +0000, Bit Twister wrote:
"Microsoft Windows binaries are available from SunSITE Denmark FTP server
at ftp://sunsite.dk/projects/wget/windows/ or
http://space.tin.it/computer/hherold/ and have been kindly provided by
Heiko Herold. An MS-DOS binary designed to be used under plain DOS with a
packet driver has been made available by Doug Kaufman. It is available
from http://www.rahul.net/dkaufman/. Antinode.org offers a VMS port of GNU
wget."
- Posted by $Bill on December 22nd, 2004
MAG wrote:
In addition to Bit Twister's wget, you can just do it all in Perl and
format it into a DB or whatever you like (maybe just append a line to
a file every so many minutes).
Email me if you like and I'll send you a Perl script that does the
scraping and you can send back the output and I'll modify it to get
what you want off the page. Activestate.com has a Perl that you can
D/L and install easily for most platforms.
One page of code would get most of it done and it works on Win32.
Here's the output - I just wrote it to grab my RF page on my Terayon :
Cable Modem Information Center
Cable Modem Information Center
Main Troubleshoot Connection
Advanced Links
Event Log Status DS Freq Configuration
Logout
RF Parameters
Parameter Value Units
Tx Power 51.7 dBmV
Rx Power -5.4 dBmV
Downstream SNR 32.4 dB
Tx Frequency 33000000 Hz
Rx Frequency 705000000 Hz
Then it's just a matter of parsing the numbers out.
- Posted by Bit Twister on December 22nd, 2004
On Wed, 22 Dec 2004 10:17:39 -0800, $Bill wrote:
What are the Peral lines to open/read/close the web page and
libary include line if needed?
- Posted by $Bill on December 22nd, 2004
Bit Twister wrote:
Might as well post the whole script. The next step is to extract
the values you want from the content and log to a file. I brute
forced the HTML tag removal with REs, but you can use HTML::Parser
or similar to do it properly.
#!perl -w --
use strict;
use LWP::UserAgent;
use LWP:
ebug qw(level);
use Data:
umper; $Data:
umper::Indent=1;
our %A; # get commandline switches into %A
for (my $ii = 0; $ii < @ARGV; ) {
last if $ARGV[$ii] =~ /^--$/;
if ($ARGV[$ii] !~ /^-{1,2}(.*)$/) { $ii++; next; }
my $arg = $1; splice @ARGV, $ii, 1;
if ($arg =~ /^([\w]+)=(.*)$/) { $A{$1} = $2; } else { $A{$1}++; }
}
$| = 1; binmode STDOUT; select ((select (STDERR), $| = 1)[0]); binmode STDERR;
my $debug = $A{d} || 0;
my $file = $A{o} || '';
my $strip = $A{s} || 0;
my $url = $ARGV[0] || 'http://192.168.100.1/modemRfPage';
(my $prog = $0) =~ s/^.*[\\\/]//;
my $usage = <<EOD;
Usage: $prog [-d] [-o=<file>] [-s] [<url>]
-d debug
-o=<file> file to dump contents into (def: STDOUT)
-s strip
<url> URL to retrieve (def: $url)
EOD
die $usage if $A{h} or $A{help};
LWP:
ebug::level('+') if $debug;
my $ua = LWP::UserAgent->new(timeout => 30);
my $req = HTTP::Request->new(GET => $url);
my $res = $ua->request($req);
print Data:
umper->Dump([$res], [qw($res)]) if $debug;
if ($res->is_error()) {
printf "Error: %s\n", $res->status_line;
} else {
my $ct = $res->content();
my $content = $ct;
if ($strip) { # strip the HTML (you could use HTML::Parser)
$content =~ s/[\t ]*<[^>]+>[\t ]*/ /gs; # rem tags
$content =~ s/\ / /gs; # -> ' '
$content =~ s/\t+/ /gs; # de-tab
$content =~ s/[\t ]{2,}/ /gs; # mult WS to ' '
$content =~ s/^\s+//s; # rem 1st leading WS
$content =~ s/\n */\n/gs; # rem leading WS
$content =~ s/\n{2,}/\n/gs; # rem blank lines
}
if ($file) {
open OUT, ">$file" or die "open: $!";
binmode OUT;
if ($A{s}) {
print OUT $content;
} else {
print OUT $ct;
}
close OUT;
print "File $file saved\n";
} else {
if ($strip) {
print $content;
} else {
print $ct;
}
}
}
__END__
Cable Modem Information Center
Cable Modem Information Center
Main Troubleshoot Connection
Advanced Links
Event Log Status DS Freq Configuration
Logout
RF Parameters
Parameter Value Units
Tx Power 51.7 dBmV
Rx Power -5.7 dBmV
Downstream SNR 32.2 dB
Tx Frequency 33000000 Hz
Rx Frequency 705000000 Hz
- Posted by $Bill on December 22nd, 2004
$Bill wrote:
And I can then extract the fields I want to print (or write/append to the file).
# Fields I want:
# Tx Power 51.5 dBmV
# Rx Power -5.5 dBmV
# Downstream SNR 32.2 dB
# Tx Frequency 33000000 Hz
# Rx Frequency 705000000 Hz
my ($TxP, $RxP, $SNR, $TxF, $RxF);
my @var = qw(TxP RxP SNR TxF RxF);
my @pat = ('Tx Power ([^ ]+)', 'Rx Power ([^ ]+)',
'SNR ([^ ]+)', 'Tx Frequency ([^ ]+)',
'Rx Frequency ([^ ]+)');
my @res = ();
for (my $ii = 0; $ii < @var; $ii++) {
$content =~ /$pat[$ii]/;
$res[$ii] = $1;
}
print "Tx Pwr=$res[0] ";
print "Rx Pwr=$res[1] ";
print "SNR=$res[2] ";
print "Tx Freq=$res[3] ";
print "Rx Freq=$res[4]\n";
- Posted by Gary on December 23rd, 2004
"MAG" <Somebody@somewhere.com> wrote in message
news:MPG.1c3353e9bcd17db9989823@news.md.comcast.gi ganews.com...
If your receive signal strength is -17dBmV, it is too low. Ideally, receive
signal strength should be above -15dBmV. -4 isn't too high, the modem
should work up to 15dBmV. It sounds like your cable company is blowing
smoke your way...
You're loosing at least 6dB with your splitters, so you might want to rewire
to remove one splitter from the path to the modem. If you do that, the -17
should rise to -14, which could solve your problem without doing battle with
the cable company.
Good Luck,
-Gary
- Posted by MAG on December 23rd, 2004
In article <Iv2dnQYyXeqQj1fcRVn-1w@comcast.com>, bogus-email@hotmail.com
says...
Hi Gary-
Thanks for the feedback. Unfortunately the way the house is set up,
it's not practical to rewire to avoid even one splitter. I've got four
rooms to provide signal to, and several devices in each room. And most
of the time things are fine. The normal signal level directly at the
tap, as measured by the cable modem directly hooked into the feed wire,
is around +5 dBmV. And after the two splitters it's usually in the -3
to -5 dBmV range. But every now and then it starts to drift down over
the course of around 3 months to the -15 to -20 range. I call and
complain. Tech comes out and says everything is fine. I tell him about
the drift in values. Nothing gets done for a while. A week or three
later I see a flurry of cable modem trucks in the neighborhood; suddenly
my signal is back to -3.
:-)
Marc
- Posted by MAG on December 23rd, 2004
Hi Bill and Bit Twister-
Thanks a whole bunch for the interesting code. It will give me
something to mess with. I don't yet speak that language, but I'll get
the PERL from Activestate.com. Which one exactly? Looks like they have
a few versions and I'm not sure which I need.
Do they have a free or shareware version? I'm happy to invest a little,
though, for a good learning experience.
Again, thanks.
Marc
- Posted by Bit Twister on December 23rd, 2004
On Wed, 22 Dec 2004 22:34:57 -0500, MAG wrote:
You might look over on
http://www.perl.com/download.csp
- Posted by $Bill on December 23rd, 2004
MAG wrote:
It's free - what's your platform ?
http://activestate.com/Products/Down...?id=ActivePerl
You don't have to register, you can just hit continue if you want.
You probably want the Windows MSI download for 5.8.6.
- Posted by $Bill on December 23rd, 2004
MAG wrote:
If possible, you want a 2 for 1 split at the ground block that feeds the
modem on one tap and the rest of the house's TVs on the other. Then you
can split whatever way you want and your modem should always be fine, but
your TVs may vary depending on splits and wiring. Can you do that without
rewiring ?
- Posted by MAG on December 23rd, 2004
In article <32v6g3F3qtoqsU3@individual.net>, news@SPAMOLAtodbe.com
says...
Hi again Bill-
Unfortunately not. The cable modem, router etc. is way the heck on the
other side of the house from the cable entry and primary splitter. I've
got a TV in the office along with the cable modem.
And, most of the time everything is fine. I think the occasional
problems I see, after gradual (months) drift down in the signal level,
are a result of Comcast's distribution issues rather than any changes
here. While my setup is far from ideal, it works fine until Comcast
let's things go too long before rebalancing their load.
:-)
Marc
- Posted by MAG on December 23rd, 2004
In article <32v66tF3qtoqsU2@individual.net>, news@SPAMOLAtodbe.com
says...
bright side, I've been able to strip all outlook components from it!
Marc
- Posted by no one in particular®© on January 23rd, 2005
(...)
You could be in the middle of a system upgrade in which case this
sort of thing is not unusual. Or it could be after an upgrade and
they've rebalanced, but the levels are too low. Not uncommon and
dropping tap values to increase signal is done for a long while after in
many places.
I would recommend checking to see if SNMP is active on your modem
and if so, interrogate it that way rather than messing around with HTML
teardowns.
If you need signal strength, request a residential drop amp be
placed between the ground block and first splitter input. If the first
splitter is outside, the amp must go inside, but a jumped can be run
inside to the amp and another back out to the splitter. I've done
hundreds of quick refits like that. If upstream is having a problem,
then you need an upstream amp but the I/R department doesn't carry them
in most places, and often doesn't even know they exist. If you can order
one online, place it at the modem to boost its output back through your
IW to the cable company.
-Wayd Wolf
"MAG" <Somebody@somewhere.com> wrote in message
news:MPG.1c34f943ab10cc71989826@news.md.comcast.gi ganews.com...