The script is set to run on an RCA modem's status page which is located here: http://192.168.100.1/diagnostics_body.html . This is my page location. Yours may differ. You should look at http://192.168.100.1 and find the actual address of yours. This goes in line 7 of the perl script.
SNMP would have been useful but it is turned off aytime the modem gets a sync. I think the ISP uses snmp to configure the modems.
I have attached the script and xml template. Enjoy!
You will have to edit the perl script to match your page.
Code: Select all
#!/usr/bin/perl
use warnings;
use strict;
use LWP::Simple;
my $httpaddr = "http://192.168.100.1/diagnostics_body.html";
my %data;
my @keys = qw(DownFreq DownSNR DownPower UpFreq UpPower);
my $content = LWP::Simple::get($httpaddr) or die "Couldn't get it!";
$content =~ s/\ |\n//g;
# regex in html source order
if ($content =~ /Acquired at (\d+\.\d)\d+ MHz/) { $data{DownFreq} = $1; }
if ($content =~ /SNR: (.+?) dB/) { $data{DownSNR} = $1; }
if ($content =~ /Frequency: (.+?) MHz/) { $data{DownPower} = $1; }
if ($content =~ /Received Signal Strength: (.+?) dBmV/) { $data{UpFreq} = $1; }
if ($content =~ /Power Level: (.+?) dBmV/) { $data{UpPower} = $1; }
for (@keys) {
print "$_:" . $data{$_} . " ";
}
print "\n";