Giter Club home page Giter Club logo

arris_cable_modem_stats's Introduction

arris_cable_modem_stats

This is a Python script to scrape stats from the Arris cable modem web interface. Results are meant to be sent to InfluxDB for use with Grafana, but other targets could be added. This currently only works with the Arris SB8200 and SB6183. Credit goes to https://github.com/billimek/SB6183-stats-for-influxdb

Authentication

In late Oct 2020, Comcast deployed firmware updates to the SB8200 which now require authenticating against the modem. If your modem requires authentication (you get a login page when browsing to https://192.168.100.1/), then you must edit your config.ini file (or set the matching ENV variables) and set modem_auth_required to True, and set modem_password appropriately. By default, your modem's password is the last eight characters of the serial number, located on a sticker on the bottom of the modem.

In October of 2021, Comcast again deployed new firmware that changed how authentication is handled. The old login method is no longer supported, but if you are with a different carrier and still need the old login functionality, use release v1.2.0. I have no way to test the old auth scheme, which is why it's no longer supported.

Run Locally

  • Install Python 3.8.x or later

  • Clone repo and

    • $ cd arris_cable_modem_stats/src
  • Install virtualenv

    • $ python3 -m pip install virtualenv
  • Create and activate virtualenv

    • $ python3 -m venv venv
    • $ source venv/bin/activate
  • Install pip dependencies

    • python3 -m pip install -r requirements.txt
  • Edit config.ini and change influx_host to your influxdb server

  • If your cable modem requires authentication, edit config.ini and set:

    • modem_auth_required = True
    • modem_password = last_8_chars_of_modem_serial
  • Run arris_stats.py

    • python3 arris_stats.py --config config.ini

Docker

Run in a Docker container with:

docker build -t arris_stats .
docker run arris_stats

Note that the same parameters from config.ini can be set as ENV variables, ENV overrides config.ini.

Config Settings

Config settings can be provided by the config.ini file, or set as ENV variables. If you run arris_stats.py with --config config.ini, ENV settings will be ignored.

  • arris_stats_debug = False
    • enables debug logs
  • destination = influxdb
    • Valid options include:
      • influxdb - requires all influx_* params to be populated
      • timestream - requires all timestream_* params to be populated
  • sleep_interval = 300
  • modem_url = https://192.168.100.1/cmconnectionstatus.html
  • modem_verify_ssl = False
  • modem_auth_required = False
  • modem_username = admin
  • modem_password = None
  • modem_model = sb8200
    • models supported: sb6183, sb8200
  • exit_on_auth_error = True
    • Any auth error will cause an exit, useful when running in a Docker container to get a new session
  • exit_on_html_error = True
    • Any error retrieving the html will cause an exit, mostly redundant with exit_on_auth_error
  • clear_auth_token_on_html_error = True
    • This is useful if you don't want to exit, but do want to get a new session if/when getting the stats fails
  • sleep_before_exit = True
    • If you want to sleep before exiting on errors, useful for Docker container when you have restart = always
  • influx_host = localhost
  • influx_port = 8086
  • influx_database = cable_modem_stats
    • This will be created automatically if it can
  • influx_username = None
  • influx_password = None
  • influx_use_ssl = False
  • influx_verify_ssl = True
  • timestream_aws_access_key_id = None
  • timestream_aws_secret_access_key = None
  • timestream_database = cable_modem_stats
  • timestream_table = cable_modem_stats
  • timestream_aws_region = us-east-1

Debugging

You can enable debug logs in three ways:

  1. Use --debug when running from cli
    • python3 arris_stats.py --debug --config config.ini
  2. Set ENV variable arris_stats_debug = true
  3. Set config.ini arris_stats_debug = true

Database Options

InfluxDB

The database will be created automatically if the user has permissions (config.ini defaults to anonymous access). You can set the database name in config.ini using the [INFLUXDB] database parameter.

AWS Timestream

Database and table are required to be created ahead of time using appropriate settings for your use-case. You can set the database name in config.ini using the [TIMESTREAM] database parameter.

Grafana

There are two Grafana examples. The first only relies on the Python script from this repo, while the second relies on Telegraf.

SB8200 Dashboard

  • Setup arrris_stats.py to run from somewhere (There's a Docker example below)
  • Import a new dashboard using the grafana/sb8200_grafana.json file. Originally exported from Grafana v6.3.3

SB8200 Dashboard 1 SB8200 Dashboard 2

Internet Uptime Dashboard

Internet Uptime

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.