PermaLink Samurize Usage Meter for Netspeed09/30/2007 11:35 AM
General Techo Stuff


Python ISP Usage Meter based


Background:


I've been writing usage meters for ISP's now for about 6 years and generally using vbscript and Samurize.. I really liked the combo as it allowed anyone to modify the UI without having any coding skills and the code was also pretty simple for people to have a hack at.


Having recently made the move to a Linux desktop (i love ubuntu) Samurize is no long an option and obviously vb is seriously limited., (although there is a project to provide a framework for .net on Linux.)


So I decided to look at a simple cross platform language to provide the same functionality and finally decided on Python.... easy to use, heaps of modules and no worries with Windows and Linux.


I got the backend written pretty quick, ie login to the ISP and scrape the usage data. The challenge was going to be a UI that could be easily customised.... frankly i haven't found anything like Samurize for Linux and so fell back to finding something that people could still learn pretty quickly... gDesklets looked like the best solution but frankly i drove myself nuts trying to get the backend wrapped in a class etc... it just kept erroring and after a few days i gave in...


So another search and I found Screenlets... no documentation but it looks good and there was enough examples for me to hack around and get my UI working.


If your looking at something and think... hmmmm.. thats stupid... you gotta give me some slack, new to Linux, Python and Screenlets... lol


Code


So my code comes in two parts;

  1. isp_usagescraper_ - This part is the work horse, you give it a bunch of parameters and it logs into the usage site, scrapes the data and returns as a dictionary or can alternatively write to an XML file.. The idea is that we can keep adding mode modules to provide meters for other ISPs... yeah i built it to be extensible...!

  2. The UI – For windows this is a simple Samurize interface that extracts data from the XML file and displays it... Feel free to customise and modify as much as you like.. its really easy.

    On Linux the UI is built in Screenlets and unfortunately your going to have to really hack around in Python to change the look and feel.



Installation Notes

Windows

Download and install ActivePython (needed for Samurize, other versions don't seem to work).

http://www.activestate.com/Products/activepython/index.plex


Download and install Samurize

http://www.samurize.com/


Download my samurize package and double click, this will offer to automatically install it.

http://www.taet.com.au/mb.nsf/DOWNLOADS/8A51B3BC7BB4A6FCCA257366000129A5/$FILE/Netspeedv3.sam


Once installed you will need to load the Samurize config editor and work through all the properties for your usage plan.

  1. Click Start\All Programs\Serious Samurize\Config Tool

  2. As marked in the diagram above click on the black text that says “Update: [Not”

  3. Then Click Edit Meters

  4. Then Click Source

  5. Then Click Change Parameters (each one should be self explanatory.. Login name is blah@netspeed.com.au)


samcfg.png


You should now be able to click test on check that it works and the file is downloaded, double click the file to check that the data looks right.


ISP Notes

WARNING – Netspeeds usage data updates infrequently and can lead to very expensive over runs. I used the meter to keep a rough eye on things and then use my router to track things properly... If you cop a huge excess bill don't blame me...!!!!

Version history

Rel 1 – Virtually no error checking.. so if it works great it not.......

Rel 2 - Minor fixes

Rel 3 - Huge update, now includes current session downloads so is far more accurate and updates without having to disconnect etc.


Future plans


Improve the error handling and generally make the code more robust.

Port the backend so it can be used for gDesklets


General notes and thanks

Huge thanks to Angelo at Velocity who whipped up a custom HTML page to make scraping really easy.

Thanks to the creators of Screenlets and Samurize for providing tools to make an easy to use and modify UI.

Thanks to all those people who created the great examples and howto's which I leverage to hack this thing together.

Zero thanks to Netspeed for making no effort to provide any information or simple site etc... out of 6 isp's the ONLY one who hasn't helped..


Disclaimer

Basically use at your own risk, no warranty, blah blah... I'm providing all the source code and your getting it for nothing.. don't wanna hear about how you over ran your usage and cost you money. In fact if you have a need to blame the rest of the world for your issues then piss off and don't download it at all.... geeeez



This page has been accessed 113 times. .
Comments :v
No comments.
Legal Mumbo Jumbo
This blog is all about me expressing my thoughts and opinions you don’t have to agree hence I enabled the comments feature (keep it clean or I’ll delete them) or bounce me an email etc. Legal threats are not taken well and will result in me publishing them as well as my thoughts on the threat….grrrr

To be very clear my opinions and thoughts are NOT representative of my employer and I don’t expect to be beaten with them :-)

Oh and finally.. they are mine… so please consider then to be copyright © but all you have to do is bounce me an email and I’ll likely let you use them.
Monthly Archive
By Category
Search
Contact Me
Family Photos
Calendar
March 2010
Su
Mo
Tu
We
Th
Fr
Sa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
The BlogRoll
Lotus Domino ND7 RSS News Feed RSS Comments Feed Podcast Feed Geo URL netcraft RSS Validator Blog Admin Lotus Geek Chris. A. Brandlehner Open Notes Picture Database OpenNTF CoComment Integrated BlogSphere
Downloads