Graphing Motorola Surfboard SB5101 Cable Modem Stats with Cacti
So you’ve got a cable modem, and you’re having problems (or you just like to track everything). You’ve already been to the management page of your cable modem (in most cases it is reachable at http://192.168.100.1/), but now you want more, or at least to be able to track changes over time. What can you do?
Use Cacti to graph the stats on your cable modem. Man that would sure be easy if you only had SNMP access to your DOCSIS cable modem. If you do then check out this post. But, if you’re like me and you have good old Comcast who disables client side SNMP access then you’re going to need a script to scrape your modem’s web based interface.
Here is my script for a Motorola Surfboard SB5101 cable modem (based off this post) which will display the following two graphs within Cacti:

This graph displays your power levels and signal to noise ratio.

This graph displays the frequencies on which your modem is operating. These should almost never change.
In order to use these you will need to download two items. The first is my Motorola Surfboard SB5101 PERL script which can be downloaded from my Cablemodem Template post on the Cacti Forum and then upload to your Cacti scripts directory.
The second piece to download is my Cacti XML host template also from my Cablemodem Template post on the Cacti Forum. Once downloaded you can import it and then add your devices.
This is my first custom template. As I create additional ones, I add them. If you use this template, please let me know how it works for you.
Tags: cablemodem, cacti, comcast, graph
You can comment below, or link to this permanent URL from your own site.
September 21, 2006 at 5:36 pm
Hi,
The freqeuncy graph works great
But when I run the power level graphs I’m getting the following error:
ERROR: can’t parse ‘#FFF200:SNR’
Any idea on how to look into this?
Thanks
Si
December 3, 2006 at 12:12 pm
There is a bit of a bug in the template that caused some problems for me.
1) The data template for the power level is missing the downstream SNR value. This needs to be added.
2) The graph template doesn’t automatically pickup the SNR, this needs to be assigned manually to the graph instance.
I also had to modify the Moto script for use with my SB5100:
$content =~ s/\ |\n//g;
# regex in html source order
if ($content =~ /Frequency\s+(\d+?)\s+Hz\s+Locked/i) { $data{DownFreq} = $1; }
if ($content =~ /Signal To Noise Ratio(\d+?) dB/i) { $data{DownSNR} = $1; }
if ($content =~ /Power Level(.+?) dB/i) { $data{DownPower} = $1; }
if ($content =~ /Frequency\s+(\d+?) Hz\s+Ranged/i) { $data{UpFreq} = $1; }
if ($content =~ /Power Level(\d+?) dBmV/i) { $data{UpPower} = $1; }
Hope this helps,
F
December 3, 2006 at 12:14 pm
Looks like WordPress polluted the output of the code above. Contact me at fhirsch@NOSPAM@darkhart.net if you need a valid copy.
Thanks again..
December 12, 2006 at 1:04 am
i get this output and no graphs
Use of uninitialized value in concatenation (.) or string at Moto_SurfBoard_CM.pl line 32.
Use of uninitialized value in concatenation (.) or string at Moto_SurfBoard_CM.pl line 32.
Use of uninitialized value in concatenation (.) or string at Moto_SurfBoard_CM.pl line 32.
Use of uninitialized value in concatenation (.) or string at Moto_SurfBoard_CM.pl line 32.
Use of uninitialized value in concatenation (.) or string at Moto_SurfBoard_CM.pl line 32.
DownFreq: DownSNR: DownPower: UpFreq: UpPower:
the modem is a 4200
i’ve changed the source webpage to point to the correct url:
192.168.0.1/signaldata.html
the html source looks like this:
Frequency
330750000 Hz Locked
Signal to Noise Ratio
37 dB
Power Level
-1 dBmV
etc etc
sorry but i don’t know perl well enough to hack the code.
i think that the parsing of the data may be wrong causing the variable to not be written
please help
ta in advance
March 12, 2008 at 11:12 pm
Thanks! Here is the revised script for the 5100.
#!/usr/bin/perl
#use warnings;
#use strict;
use LWP::Simple;
my %data;
my @keys = qw(DownFreq DownSNR DownPower UpFreq UpPower);
my $content = LWP::Simple::get(”http://192.168.100.1/signaldata.html”) or die “Couldn’t get it!”;
$content =~ s/\ |\n//g;
#print $content;
# regex in html source order
if ($content =~ /Frequency\s*(.+?) Hz/) { $data{DownFreq} = $1; }
if ($content =~ /Signal to Noise Ratio\s*(.+?) dB/) { $data{DownSNR} = $1; }
if ($content =~ /Power Level\s*(.+?) dBmV\s*Frequency\s*?\s*(.+?) Hz \s*?/) { $data{UpFreq} = $1; }
if ($content =~ /Power Level(.+?) dBmV\s*/) { $data{UpPower} = $1; }
for (@keys) {
print “$_:” . $data{$_} . ” “;
}
print “\n”;
March 12, 2008 at 11:17 pm
Another try. WordPress is stripping the regex’s that contain html.
b#!/usr/bin/perl
#use warnings;
#use strict;
use LWP::Simple;
my %data;
my @keys = qw(DownFreq DownSNR DownPower UpFreq UpPower);
my $content = LWP::Simple::get(”http://192.168.100.1/signaldata.html”) or die “Couldn’t get it!”;
$content =~ s/\ |\n//g;
#print $content;
# regex in html source order
if ($content =~ /<TD>Frequency<\/TD><TD>\s*(.+?) Hz/) { $data{DownFreq} = $1; }
if ($content =~ /<TD>Signal to Noise Ratio<\/TD><TD>\s*(.+?) dB/) { $data{DownSNR} = $1; }
if ($content =~ /<\/TR><TD>Power Level<\/TD><TD>\s*(.+?) dBmV\s*<TABLE/) { $data{DownPower} = $1; }
if ($content =~ /<\/TD><\/TR><TR><TD>Frequency<\/TD>\s*?<TD>\s*(.+?) Hz \s*?/) { $data{UpFreq} = $1; }
if ($content =~ /<TR><TD>Power Level<\/TD><TD>(.+?) dBmV\s*/) { $data{UpPower} = $1; }
for (@keys) {
print “$_:” . $data{$_} . ” “;
}
print “\n”;
April 1, 2008 at 4:55 pm
I had to remove the spaces and “\s”s from the regexs to get it to work. The global substitution removes the spaces from “Signal to Noise Ratio” as well.
I was trying to do something like this for my Sipura VOIP box as well and was going to use HTML::TableExtract but this is simpler and just as effective.
#!/usr/bin/perl
use warnings;
use strict;
use LWP::Simple;
my %data;
my @keys = qw(DownFreq DownSNR DownPower UpFreq UpPower);
my $content = LWP::Simple::get(”http://192.168.100.1/signaldata.html”) or die “Couldn’t get it!”;
$content =~ s/\ |\n//g;
#print $content;
# regex in html source order
if ($content =~ /Frequency(.+?)Hz/) { $data{DownFreq} = $1; }
if ($content =~ /SignaltoNoiseRatio(.+?)dB/) { $data{DownSNR} = $1; }
if ($content =~ /PowerLevel(.+?)dBmV/) { $data{DownPower} = $1; }
if ($content =~ /Frequency(.+?)Hz/) { $data{UpFreq} = $1; }
if ($content =~ /PowerLevel(.+?)dBmV/) { $data{UpPower} = $1; }
for (@keys) {
print “$_:” . $data{$_} . ” “;
}
print “\n”;
April 9, 2008 at 8:38 am
Got motorola SB5101 Surfboard cable modem, it only works with windows. Not working with Macintosh OS. Can anyone help, the installation CD is not recognized by MAC. Please Help.
October 19, 2008 at 12:15 am
I created a windows batch file that does a similar thing – it captures all the data from the motorola surfboard sb5101 and dumps it to the command window. You can optionally have it write the data to a .csv file. You can then plot the data from the csv file using your favorite plotting program.
You can automate the script to have it run every x minutes by using windows task scheduler. It works pretty well for me.
I posted the batch file (modemstats.bat) and a screeen cap of it in the forums at dslreports.com. Here is a link to the post: http://www.dslreports.com/forum/r21290225-AZ-Motorola-Modem-Data-Win-XP-Batch-File