andrewfraley / arris_cable_modem_stats

Retrieves stats from Arris cable modems and sends to InfluxDB
53 stars 34 forks source link

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 also currently supports AWS Timestream and Splunk. This orginally started as a fork of https://github.com/billimek/SB6183-stats-for-influxdb

Project EOL

I no longer have cable internet, thus cannot develop this project any further. I will merge reasonable PRs that come in, but I will have no way to test the changes.

Modems Supported

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.

InfluxDB 1.x vs 2.x

This supports both InfluxDB 1.x and InfluxDB 2.x. See the Config Settings section below for options. With InfluxDB 1.x, influx_host is the only required setting if your Influx server does not require authentication. It will attempt to create the database if it doesn't exist. For InfluxDB 2.x, change influx_major_version to 2, and also supply your url, org, bucket, and token with write access with the appropriate settings outlined below.

Run with Docker

From DockerHub

See other environment variables in Config Settings. This image is automatically rebuilt every month.

docker pull afraley/arris_cable_modem_stats
docker run \
-e modem_auth_required=True \
-e modem_password='last eight characters of the serial number' \
-e influx_host='influxhost.local' \
--restart unless-stopped \
afraley/arris_cable_modem_stats

Build it yourself

Run in a Docker container with the following (see other environment variables in Config Settings):

docker build -t arris_stats .
docker run \
-e modem_auth_required=True \
-e modem_password='last eight characters of the serial number' \
-e influx_host='influxhost.local' \
--restart unless-stopped \
arris_stats

Run Locally

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.

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 log_level = debug
  3. Set config.ini log_level = debug

Database Options

InfluxDB

The database will be created automatically if the user has permissions (defaults to anonymous access). See Config Settings above for a list of ENV variables (or config.ini options).

AWS Timestream

Database and table are required to be created ahead of time using appropriate settings for your use-case. See Config Settings above for a list of ENV variables (or config.ini options).

Splunk

Basic support for sending stats to Splunk is available. Stats are sent as _json data to the Splunk HTTP Event Collector. To setup Splunk:

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

SB8200 Dashboard 1 SB8200 Dashboard 2

Internet Uptime Dashboard

Internet Uptime