Exports statistics from FritzBox to Prometheus
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
marcel 68dda17ac4 Fritzbox rollover bug fixed. 2 years ago
CHANGELOG.md Fritzbox rollover bug fixed. 2 years ago
LICENSE Initial commit 2 years ago
README.md Cleaned up README.md 2 years ago
config.yml First commit 2 years ago
fritz-api.sh Fritzbox rollover bug fixed. 2 years ago
fritzbox_exporter.py First commit 2 years ago



(C)2022 M. Konstapel https://www.meezenest.nl/mees

Collects data from FRITZ!Box via its SOAP api and exports it to Prometheus via http.

The program is split up into two parts:

Bash script

Collects various information from a FRITZ!Box via its SOAP api. It outputs the data to stdout in JSON format.

It can also be used from the command line to get the following data:

  • link uptime
  • connection status
  • maximum upstream sync speed on current connection
  • maximum downstream sync speed on current connection
  • Current downstream bandwidth usage
  • Current upstream bandwidth usage
  • Total download usage on current connection
  • Total upload usage on current connection

This bash script is taken from https://github.com/mrwhale/fritzbox-api


The Universal Plug & Play (UPnP) service must be enabled.

You can do that in the settings: Home Network » Network » Network Settings

Enable "Transmit status information over UPnP"


usage: fritz-api.sh [-f <function>] [-h hostname] [-b rate] [-j] [-d]
  -f: function to be executed [Default: bandwidthdown]
  -h: hostname or IP of the FRITZ!Box [Default: fritz.box]
  -b: rate to display. b, k, m. all in  bytes
  -j: JSON output
      Does not accept any functions.
      Will display all output in JSON format.
      Useful for running in cron and ingesting into another program
  -d: enable debug output

  linkuptime     connection time in seconds
  connection     connection status
  downstream     maximum downstream on current connection (Downstream Sync)
  upstream       maximum upstream on current connection (Upstream Sync)
  bandwidthdown  current bandwidth down
  bandwidthup    current bandwidth up
  totalbwdown    total downloads
  totalbwup      total uploads

Example: fritz-api.sh -f downstream -h -b m


  • curl
  • bc

Python program

This is the actual exporter. It takes the output from the bash script, processes it and exposes it via http (default port 9000) to Prometheus.


Configure prometheus.yml:

- job_name: 'FritzBox'

- targets: ['localhost:9001']

Start program as background process:

python3 ./fritzbox_exporter.py &

Use Graphana to display the data.


It can be configured via the file config.yml.

# Set port (default: 9000)
port: 9001
# Set scrape frequency (default: 15 seconds)
scrape_frequency: 60


  • Python 3
  • subprocess
  • json
  • pyyaml
  • prometheus_client