Giter VIP home page Giter VIP logo

fritzbox-traffic's Introduction

fritzbox-traffic

Fetches upload and download statistics from a fritzbox.

Right now only used by a munin plugin. Which gives the mean and max of the last minute's data.

This is a scraping solution - we're actually fetching the JSON data fritzbox fetches for its own traffic graph.

Install

Change the login info in helpers_fritz.py before running

Broken-ish?

This code broke when our fritzbox got replaced, largely because the username was no longer empty.

There is also a newer version of the exchange, based on SHA256 rather than MD5, that I made work (probably, with some more work) but now I have no way to test whether the old version still works. Feel free to tell me what's broken.

notes

Yes, the auth is currently hardcoded in the library, and as a global. You only have one fritzbox, right?

The login is a challenge-response thing. Details depend slightly on version.

fritz_fetch() returns a dict like

{u'_node': u'sg0',
 u'downstream': 214868000,
 u'ds_bps_curr_max': 526334,
 u'ds_bps_max': 26858500,
 u'dynamic': False,
 u'mode': u'VDSL',
 u'name': u'sync_dsl',
 u'upstream': 32272000,
 u'us_bps_curr_max': 219772,
 u'us_bps_max': 4034000,
 u'ds_mc_bps_curr': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
 u'ds_bps_curr': [446023, 448728, 458205, 318816, 401131, 382887, 520784, 417167, 328721,  407530,
                  385023, 393786, 384885, 448877, 412175, 304371, 378578, 357142, 526334, 289975],
 u'us_background_bps_curr': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
 u'us_default_bps_curr': [81934, 119163, 83695, 156271, 182721, 167155, 187029, 168391, 122218, 68770, 
                          140439, 157814, 137203, 146380, 155806, 157812, 173545, 192133, 115922, 67846],
 u'us_important_bps_curr': [12063, 7328, 16234, 9262, 14278, 9043, 12665, 8434, 9512, 7560,
                            7154, 10995, 10071, 6756, 9295, 7718, 8086, 7136, 5741, 5395],
 u'us_realtime_bps_curr': [7660, 308, 76, 143, 84, 359, 112, 203, 39742, 33576, 
                           82, 417, 394, 294, 199, 445, 433, 20503, 52273, 10928]
}

If you need the v2 version of the auth, this has also changed -- a dict just like that still exists but is nested in more dict.

The traffic stuff mostly a bunch of ds_ (downstream) and us_ (upstream) details, including some guest stuff, which seems to be in bytes per second (a bit of a unit mix, the link speed seems to be in bits per second).

Upstream is split into into background (few things), normal (most things), priotitized, and realtime

The lists are the most recent first.

They are apparently averages over 5 seconds (the fetch from the graphing page is every 5 sec, the reported values also stay constant over 5 seconds).

fritzbox-traffic's People

Contributors

knobs-dials avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.