GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - dotWee/docker-fritzbox-prometheus-exporter: Fritz!Box Upnp statistics exporter for prometheus

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

372 Commits
372 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
fritzbox_lua
fritzbox_lua
 
 
fritzbox_upnp
fritzbox_upnp
 
 
grafana
grafana
 
 
systemd
systemd
 
 
.gitignore
.gitignore
 
 
Dockerfile
Dockerfile
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
all_available_metrics_6591_7.29.json
all_available_metrics_6591_7.29.json
 
 
all_available_metrics_7590_7.12.json
all_available_metrics_7590_7.12.json
 
 
all_available_metrics_7590_7.20.json
all_available_metrics_7590_7.20.json
 
 
all_available_metrics_7590_7.25.json
all_available_metrics_7590_7.25.json
 
 
all_available_metrics_7590_7.29.json
all_available_metrics_7590_7.29.json
 
 
docker-compose.yml
docker-compose.yml
 
 
go.mod
go.mod
 
 
go.sum
go.sum
 
 
health.go
health.go
 
 
k8s-fritzbox.yaml
k8s-fritzbox.yaml
 
 
luaTest-many.json
luaTest-many.json
 
 
luaTest.json
luaTest.json
 
 
main.go
main.go
 
 
metrics-lua.json
metrics-lua.json
 
 
metrics-lua_cable.json
metrics-lua_cable.json
 
 
metrics.json
metrics.json
 
 

Repository files navigation

Fritz!Box Upnp statistics exporter for prometheus

This exporter exports some variables from an AVM Fritzbox to prometheus.

This exporter is tested with a Fritzbox 7590 software version 07.12, 07.20, 07.21 and 07.25.

The goal of the fork is:

  • allow passing of username / password using evironment variable
  • use https instead of http for communitcation with fritz.box
  • move config of metrics to be exported to config file rather then code
  • add config for additional metrics to collect (especially from TR-064 API)
  • create a grafana dashboard consuming the additional metrics
  • collect metrics from lua APIs not available in UPNP APIs

Other changes:

  • replaced digest authentication code with own implementation
  • improved error messages
  • test mode prints details about all SOAP Actions and their parameters
  • collect option to directly test collection of results
  • additional metrics to collect details about connected hosts and DECT devices
  • support to use results like hostname or MAC address as labels to metrics
  • support for metrics from lua APIs (e.g. CPU temperature, utilization, ...)

Building

go install github.com/dotWee/docker-fritzbox-prometheus-exporter@latest

Running

In the configuration of the Fritzbox the option "Statusinformationen über UPnP übertragen" in the dialog "Heimnetz > Heimnetzübersicht > Netzwerkeinstellungen" has to be enabled.

Using docker

First you have to build the container: docker build --tag fritzbox-prometheus-exporter:latest .

Then start the container:

$ docker run -e 'USERNAME=your_fritzbox_username' \
    -e 'PASSWORD=your_fritzbox_password' \
    -e 'GATEWAY_URL="http://192.168.0.1:49000"' \
    -e 'LISTEN_ADDRESS="0.0.0.0:9042"' \
    fritzbox-prometheus-exporter:latest

I've you're getting no such host issues, define your FritzBox as DNS server for your docker container like this:

$ docker run --dns YOUR_FRITZBOX_IP \
    -e 'USERNAME=your_fritzbox_username' \
    -e 'PASSWORD=your_fritzbox_password' \
    -e 'GATEWAY_URL="http://192.168.0.1:49000"' \
    -e 'LISTEN_ADDRESS="0.0.0.0:9042"' \
    fritzbox-prometheus-exporter:latest

Using docker-compose

Set your environment variables within the docker-compose.yml file.

Then start up the container using docker-compose up -d.

Using the binary

Usage:

$GOPATH/bin/fritzbox_exporter -h
Usage of ./fritzbox_exporter:
  -gateway-url string
    The URL of the FRITZ!Box (default "http://fritz.box:49000")
  -gateway-luaurl string
    The URL of the FRITZ!Box UI (default "http://fritz.box")
  -metrics-file string
    The JSON file with the metric definitions. (default "metrics.json")
  -lua-metrics-file string
    The JSON file with the lua metric definitions. (default "metrics-lua.json")
  -test
    print all available SOAP calls and their results (if call possible) to stdout
  -json-out string
    store metrics also to JSON file when running test   
  -testLua
    read luaTest.json file make all contained calls and dump results
  -collect
    collect metrics once print to stdout and exit
  -nolua
    disable collecting lua metrics
  -username string
    The user for the FRITZ!Box UPnP service
  -password string
    The password for the FRITZ!Box UPnP service
  -listen-address string
    The address to listen on for HTTP requests. (default "127.0.0.1:9042")

The password (needed for metrics from TR-064 API) can be passed over environment variables to test in shell:
read -rs PASSWORD && export PASSWORD && ./fritzbox_exporter -username <user> -test; unset PASSWORD

Exported metrics

start exporter and run curl -s http://127.0.0.1:9042/metrics

Output of -test

The exporter prints all available Variables to stdout when called with the -test option. These values are determined by parsing all services from http://fritz.box:49000/igddesc.xml and http://fritzbox:49000/tr64desc.xml (for TR64 username and password is needed!!!)

Customizing metrics

The metrics to collect are no longer hard coded, but have been moved to the metrics.json and metrics-lua.json files, so just adjust to your needs (for cable version also see metrics-lua_cable.json). For a list of all the available metrics just execute the exporter with -test (username and password are needed for the TR-064 API!) For lua metrics open UI in browser and check the json files used for the various screens.

For a list of all available metrics, see the dumps below (the format is the same as in the metrics.json file, so it can be used to easily add further metrics to retrieve):

  • FritzBox 6591 v7.29
  • FritzBox 7590 v7.12
  • FritzBox 7590 v7.20
  • FritzBox 7590 v7.25
  • FritzBox 7590 v7.29

Grafana Dashboard

The dashboard is now also published on Grafana.

About

Fritz!Box Upnp statistics exporter for prometheus

Topics

dockerdocker-imagefritzfritz-boxfritzboxprometheus-exporter

Resources

Readme
Apache-2.0 license
Activity

Stars

17 stars

Watchers

0 watching

Forks

3 forks
Report repository

Used by

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.