Skip to content

Commit

Permalink
XB8 Modems Only - Add unerrored codewords count (#5)
Browse files Browse the repository at this point in the history
collect the downstream "unerrored" stat for XB8

This is available in the "CM Error Codewords" table and is useful to
know what ratio of corrected and errors you are getting to successful
codewords.
  • Loading branch information
jkasten2 authored Aug 9, 2024
1 parent dda0cf6 commit 01950a9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def send_to_influx(stats, config):
current_time = datetime.now(UTC).strftime('%Y-%m-%dT%H:%M:%SZ')

for stats_down in stats['downstream']:
series.append(Point.from_dict({
data = {
'measurement': 'downstream_statistics',
'time': current_time,
'fields': {
Expand All @@ -211,7 +211,12 @@ def send_to_influx(stats, config):
'channel_id': int(stats_down['channel_id']),
'modulation': stats_down['modulation']
}
}))
}
## Only some modems, like the XB8, has the 'unerrored' value
if 'unerrored' in stats_down:
data['fields']['unerrored'] = int(stats_down['unerrored'])

series.append(Point.from_dict(data))

for stats_up in stats['upstream']:
series.append(Point.from_dict({
Expand Down
1 change: 1 addition & 0 deletions src/comcast_xb8_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ def parse_html(html):
# NOTE: Indexing by channel_id is important as this table might be ordered
# differently than the "Channel Bonding" table parsed above.
channel = stats['downstream'][channel_id]
channel['unerrored'] = codeword_rows[1].find_all("td")[i].text.strip()
channel['corrected'] = codeword_rows[2].find_all("td")[i].text.strip()
channel['uncorrectables'] = codeword_rows[3].find_all("td")[i].text.strip()

Expand Down

0 comments on commit 01950a9

Please sign in to comment.