Friday 20 September 2013

Scratch Your Itches: Grabbing Siemens Gigaset sx762 modem stats with Ruby

Grabbing Siemens Gigaset sx762 modem stats with Ruby

The problem:

So, my Internet connection can be finicky at times; it has a tendency to collapse the download speeds to un-browsable levels at the worst possible times. At those times I usually just want to quickly find out if it's just the current speed that has dropped, if it's also the max speed, or if it's just my imagination.

Normally this means that I have to:
  1. go to the built-in web-interface of my modem (a Siemens Gigaset sx762);
  2. enter the modem's password;
  3. click through a 'Security Advice' screen that complains I have an ethernet connection connected to the modem;
  4. find my way to the Status page; 
  5. finally get to click on the link to the Internet statistics sub-page;
Once there I have to skim through the irrelevant data to find the stats I'm interested in.

Scratch that itch!

Needless to say I got tired of having to use the annoying web-interface and wasting my time clicking through warnings.  It was becoming one of those 'itches' I've blogged about before, and I decided it was time I'd do something about it!
So, I opened my favourite text editor (Textmate2), looked up the cURL manual, looked at the sent headers in the network tab of Chrome's element inspector and automated the process into a simple Ruby script: router_statistics.rb.

The code:



Scratch be gone!

Once I run this baby in my console, it will return the current and max Up- and Down-stream speeds (and noise levels), as well as my external IP and MAC addresses and uptime.

The code might be quick and dirty, but it's a nice hacky solution that will save me some time and frustrations. :)

Related searches on Google+:

#ScratchYourOwnItches   #coding   #Siemens   #Gigaset   #sx762   #FiXato  #FiXatoBlog   #Github   #FOSS   #OpenSource  #Ruby #cURL