Giter Club home page Giter Club logo

internet_data_usage's Introduction

Provides an interface to pull carrier data plan usage from a simple command line.

Was originally intended to be a method to graph usage in Zabbix, but evolved into a full command line tool.

Currently supports the following carriers:

  • Telus Wireline
  • Koodo Mobile

Additional carriers can easily be added if requested.

Installation

Install internet_data_usage from Github using git:

git clone https://github.com/precurse/internet_data_usage.git

Install module requirements using pip, a package manager for Python.

pip install -r requirements.txt

Need pip? Try installing it by running the following from the command line:

$ curl https://raw.github.com/pypa/pip/master/contrib/get-pip.py | python

Command Line Usage

    $ ./internet_data_usage.py -h
    usage: internet_data_usage.py [-h] {term,zabbix,influxdb} ...

    internet_data_usage 0.2-HEAD Copyright (c) 2015 Andrew Klaus
    ([email protected])

    optional arguments:
      -h, --help            show this help message and exit

    subcommands:
      {term,zabbix,influxdb}
                            valid subcommands
        term                all output will echo in a terminal
        zabbix              all output will be sent to a Zabbix server
        influxdb            all output will be sent to an influxdb database

Terminal Usage

    $ ./internet_data_usage.py term -h
    usage: internet_data_usage.py term [-h] [-p PASSWORD]
                                       [-c {telus_wireline,koodo_mobile}]
                                       [-a HTTP_USER_AGENT] [-v]
                                       username

    positional arguments:
      username              Username for account access

    optional arguments:
      -h, --help            show this help message and exit
      -p PASSWORD, --password PASSWORD
                            Carrier password for account access (will prompt if
                            not specified)
      -c {telus_wireline,koodo_mobile}, --carrier {telus_wireline,koodo_mobile}
                            Carrier to query from (default=telus_wireline)
      -a HTTP_USER_AGENT, --http_user_agent HTTP_USER_AGENT
                            Defaults to 'Mozilla/5.0 (X11; Linux x86_64)'
      -v, --verbose

Zabbix/Monitoring Usage

    $ ./internet_data_usage.py zabbix -h
    usage: internet_data_usage.py zabbix [-h]
                                         [-i {data_usage,data_use_unit,data_plan_total,plan}]
                                         [-c {telus_wireline,koodo_mobile}]
                                         [-a HTTP_USER_AGENT] [-v]
                                         username password

    positional arguments:
      username              Username for account access
      password              Carrier password for account access

    optional arguments:
      -h, --help            show this help message and exit
      -i {data_usage,data_use_unit,data_plan_total,plan}, --item {data_usage,data_use_unit,data_plan_total,plan}
                            Item to request (default=data_usage)
      -c {telus_wireline,koodo_mobile}, --carrier {telus_wireline,koodo_mobile}
                            Carrier to query from (default=telus_wireline)
      -a HTTP_USER_AGENT, --http_user_agent HTTP_USER_AGENT
                            Defaults to 'Mozilla/5.0 (X11; Linux x86_64)'
      -v, --verbose

./internet_data_usage.py -h usage: internet_data_usage.py [-h] {term,zabbix,influxdb} ...

internet_data_usage 0.2-HEAD Copyright (c) 2015 Andrew Klaus ([email protected])

optional arguments: -h, --help show this help message and exit

subcommands: {term,zabbix,influxdb} valid subcommands term all output will echo in a terminal zabbix all output will be sent to a Zabbix server influxdb all output will be sent to an influxdb database

Influxdb Usage

    $ ./internet_data_usage.py influxdb -h
    usage: internet_data_usage.py influxdb [-h] [-p PORT]
                                           [-c {telus_wireline,koodo_mobile}]
                                           [-a HTTP_USER_AGENT] [-v]
                                           username password i_user i_pass i_host
                                           i_db

    positional arguments:
      username              Username for account access
      password              Carrier password for account access
      i_user                Influxdb username
      i_pass                Influxdb password
      i_host                Influxdb hostname
      i_db                  Influxdb database

    optional arguments:
      -h, --help            show this help message and exit
      -p PORT, --port PORT  Port for influxdb access (default=8086)
      -c {telus_wireline,koodo_mobile}, --carrier {telus_wireline,koodo_mobile}
                            Carrier to query from (default=telus_wireline)
      -a HTTP_USER_AGENT, --http_user_agent HTTP_USER_AGENT
                            Defaults to 'Mozilla/5.0 (X11; Linux x86_64)'
      -v, --verbose

Command line output:

Terminal:

    $ ./internet_data_usage.py term -c telus_wireline [email protected]
    Carrier password (will not echo): <password> <enter>
    TelusWireline Plan: TELUS Internet 50
    Usage: 49/400 GB

Zabbix:

    $ ./internet_data_usage.py zabbix -i data_usage [email protected] password
    49

Influxdb:

    $ ./internet_data_usage.py influxdb [email protected] mypass root root localhost internet_usage

internet_data_usage's People

Contributors

precurse avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

internet_data_usage's Issues

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.