[colug-432] talking to your ISP

Rick Hornsby richardjhornsby at gmail.com
Sat Dec 29 07:05:26 EST 2012


If anyone is interested in replicating my work for their own setup, here's what I'm using to record the modem stats (if I knew ruby better, I could probably write the whole thing in ruby; also, there are a crapton of improvements possible. this was a 15 minute hack job):


=== fetch_stats.rb ===
#!/usr/bin/ruby

require 'rubygems'
require 'nokogiri'
require 'open-uri'

doc = Nokogiri::HTML(open('http://192.168.100.1/system.asp'))
doc.xpath("//td").each do |td|
	puts td.content
end

=== modem_stats.sh ===
#!/bin/bash

fetch_stats=~/bin/fetch_stats.rb

stats=$($fetch_stats | tr -d '\302\240' | grep -o "^-*[0-9]\+\.[0-9]\+" | tr '\n' ' ')

echo -n $(date)
echo $stats | awk '{printf " hwver:%0.1f rx:%0.1f snr:%0.1f tx:%0.1f\n", $1, $2, $3, $4}'

=== cron entry === 
* * * * * ~/bin/modem_stats.sh >> ~/tmp/modem_stats.log

=== result ===
Sat Dec 29 06:02:01 CST 2012 hwver:2.0 rx:-13.8 snr:32.9 tx:42.8


More information about the colug-432 mailing list