[colug-432] talking to your ISP
Bill Baker
bill_chris at earthlink.net
Sat Dec 29 09:39:12 EST 2012
It must only work for your model modem, because all I got was this:
Sat Dec 29 09:37:50 EST 2012 hwver:0.0 rx:0.0 snr:0.0 tx:0.0
On 12/29/2012 07:05 AM, Rick Hornsby wrote:
>
> 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
> _______________________________________________
> colug-432 mailing list
> colug-432 at colug.net
> http://lists.colug.net/mailman/listinfo/colug-432
>
More information about the colug-432
mailing list