Skip to content

Integer Overflow in totalbytessent → InfluxDB Write Error #139

Description

@tobschndr

Description:
When writing FritzBox stats to InfluxDB, an error occurs if the value of totalbytessent exceeds the maximum range of int64. InfluxDB only accepts integers up to 9223372036854775807.

ERROR: Failed to write to InfluxDB '192.168.xx.yyy': 400: unable to parse 
'fritzbox,box=fritz.box totalbytessent=18446743988672050869i 1751621564000000': 
unable to parse integer 18446743988672050869: strconv.ParseInt: parsing "18446743988672050869": value out of range

Steps to Reproduce:

  1. Run the latest bb-Ricardo/fritzinfluxdb container
  2. Use a FRITZ!Box with unusually high totalbytessent values
  3. Attempt to write stats to InfluxDB

Cause:

The FRITZ!Box sometimes returns very large values (likely uint64) for totalbytessent. These are inserted into the InfluxDB line protocol without any range validation. Since InfluxDB expects int64 values, this causes a parse error.

Suggested Fix:

Add a value check before writing to InfluxDB:

MAX_INT64 = 9223372036854775807
if total_bytes_sent < MAX_INT64:
    line = f"{measurement},box={box} totalbytessent={total_bytes_sent}i {timestamp}"
    lines.append(line)
else:
    print(f"WARNING: Skipping invalid totalbytessent value: {total_bytes_sent}")

System Information:

  • Container: fritzinfluxdb (latest version)
  • Python version: 3.10
  • InfluxDB version: 1.8.10
  • FRITZ!Box model: 6591 Cable (FRITZ!OS **8.10-122506 BETA**)

Thanks for the great project! A small patch to prevent this overflow would be very helpful.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions