1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Scraping Bandwidth Stats

Discussion in 'Tomato Firmware' started by averylinden, Jun 20, 2009.

  1. averylinden

    averylinden Addicted to LI Member

    I'd like to show my Tomato bandwidth stats on another web page - specifically the last 30 days ones from here - http://my.tomato.ip.address/bwm-daily.asp

    Because these are calculated with javascript, there's no easy way to scrape them with a command-line tool like curl.

    Has anyone figured out a way to do this? Would it be possible to read the tomato_stats bandwidth file (which is stored on a CIFS share on the same server I'd be serving the web page)?

    Thanks for any tips or pointers. Maybe I've missed something obvious...
     
  2. belliash

    belliash Addicted to LI Member

    ofc there is a way...
    You should find the way to get that information, like tomato UI obtains that (probably from nvram).

    Then calculate everything and send somewhere (via cron eg)
     
  3. bogderpirat

    bogderpirat Network Guru Member

    hey!

    the bandwidth stats can be retrieved from the /bwm-daily.asp page - the data is inside of the daily_history and monthly_history variables of the javascript code. how you decode this data is shown in the genData()-function a little lower in the code. i imagine you could rather easily adapt this to any programming language of your choice.
     
  4. averylinden

    averylinden Addicted to LI Member

    Thanks bogderpirat! Once I figured out what the fields were it wasn't too tough. I attached a small script that does the trick if anyone stumbles across this topic in the future.
     

    Attached Files:

  5. belliash

    belliash Addicted to LI Member

    very dirty hacks there... You broken few software development rules...
    and btw.. You have forgotten about ppl who uses SSL...

    to sum up -> this sucks...
     
  6. spicoli

    spicoli LI Guru Member

    Then YOU do it. At least he tried.
     

Share This Page