web-scraping
script for
cacti (or anything, really) modified for motorola surfboard 5120 (since comcast "helpfully" disables snmp)...
#!/usr/bin/perl
use warnings;
use strict;
use LWP::Simple;
my %data;
my %trash;
my @keys = qw(DownFreq DownSNR DownPower UpFreq UpPower DownQAM DownNACO UpChan UpServ UpSym);
my $content = LWP::Simple::get("
http://192.168.100.1/signaldata.htm") or die "Couldn't get it!";
$content =~ s/\ //g;
# regex in html source order
if ($content =~ /(Frequency<\/td>)/gi) { $trash{a} = $1};
if ($content =~ /(-?\d+)\sHz\s*<\/td>/gi) { $data{DownFreq} = $1; }
if ($content =~ /(Signal To Noise Ratio<\/td>)/gi){ $trash{a} = $1};
if ($content =~ /(-?\d+)\sdB\s*/gi) { $data{DownSNR} = $1; }
if ($content =~ /(QAM<\/td>)/gi) { $trash{a} = $1};
if ($content =~ /([^<]+)\s*/gi) { $data{DownQAM} = $1; }
if ($content =~ /(Network Access Control Object<\/td>)/gi) { $trash{a} = $1};
if ($content =~ /([^<]+)\s*/gi) { $data{DownNACO} = $1; }
if ($content =~ /(Power Level<\/td>)/gi) { $trash{a} = $1};
if ($content =~ /(-?\d+)\sdBmV\s*/gi) { $data{DownPower} = $1; }
if ($content =~ /(Channel ID<\/td>)/gi) { $trash{a} = $1};
if ($content =~ /(-?\d+)<\/td>/gi) { $data{UpChan} = $1; }
if ($content =~ /(Frequency<\/td>)/gi) { $trash{a} = $1};
if ($content =~ /(-?\d+)\sHz\s*<\/td>/gi) { $data{UpFreq} = $1; }
if ($content =~ /(Ranging Service ID<\/td>)/gi) { $trash{a} = $1};
if ($content =~ /(-?\d+)<\/td>/gi) { $data{UpServ} = $1; }
if ($content =~ /(Symbol Rate<\/td>)/gi) { $trash{a} = $1};
if ($content =~ /(-?[0-9.]+)\s*Msym\/s\s*/gi) { $data{UpSym} = $1; }
if ($content =~ /(Power Level<\/td>)/gi) { $trash{a} = $1};
if ($content =~ /(-?\d+)\sdBmV\s*/gi) { $data{UpPower} = $1; }
for (@keys) { print "$_:$data{$_} "; }
print "\n";