Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fritzbox-telegraf-cli

Query your FRITZ!Box over TR-064 and print metrics in Influx line protocol — without Telegraf.

Telegraf's inputs.fritzbox plugin covers seven metric families from your router. This tool collects the same data from the command line, so you can pipe directly to InfluxDB, use it in shell scripts, or check what your router reports without running a daemon.

Install

Requires Python 3.10+ and pipx.

pipx install git+https://github.com/davdittrich/fritzbox-telegraf-cli

Quick start

fritzbox-telegraf --username fritz1234 --password yourpassword

By default it collects all seven metric families and prints Influx line protocol:

fritzbox_device,service=DeviceInfo1,source=fritz.box hardware_version="FRITZ!Box 7490",model_name="FRITZ!Box 7490",software_version="113.07.62",uptime=21182i 1780854846716650057
fritzbox_wan,service=WANCommonInterfaceConfig1,source=fritz.box downstream_current_max_speed=226727i,layer1_downstream_max_bit_rate=123092000i,layer1_upstream_max_bit_rate=36692000i,total_bytes_received=698044818i,total_bytes_sent=966516535i,upstream_current_max_speed=291892i 1780854846910072487
fritzbox_dsl,service=WANDSLInterfaceConfig1,source=fritz.box,status=Up downstream_attenuation=110i,downstream_curr_rate=110050i,downstream_noise_margin=100i,crc_errors=3i,fec_errors=0i ...

Pipe it straight to the InfluxDB write API or redirect to a file for later import.

What it collects

Flag Measurement Key fields
device fritzbox_device model_name, software_version, hardware_version, serial_number, uptime
wan fritzbox_wan layer1_downstream_max_bit_rate, layer1_upstream_max_bit_rate, total_bytes_sent, total_bytes_received, current speeds
ppp fritzbox_ppp upstream_max_bit_rate, downstream_max_bit_rate, uptime
dsl fritzbox_dsl sync rates, noise margins, attenuation, crc_errors, fec_errors, hec_errors, link_retrain
fiber fritzbox_fiber optical signal level, SFP vendor and part number, byte and packet counters
wlan fritzbox_wlan SSID, channel, band, total_associations per radio
hosts fritzbox_hosts mesh topology — per-link cur_data_rate_tx/rx, max_data_rate_tx/rx, node and AP names

fiber only returns data on FRITZ!Box models with a fiber WAN port. On DSL models the measurement is empty.

hosts takes a few extra seconds — the box builds its mesh list on demand. If you don't need mesh data, exclude it with --collect device --collect wan --collect ppp --collect dsl --collect wlan.

FRITZ!Box setup

Two settings must be on before the tool can read device configuration:

  1. Heimnetz → Netzwerk → Netzwerkeinstellungen: check Zugriff für Anwendungen zulassen
  2. System → FRITZ!Box-Benutzer → edit your user: check FRITZ!Box-Einstellungen

Without both, the box authenticates the request but blocks most SOAP actions with UPnP error 401 ("Invalid Action"). The default endpoint is http://fritz.box:49000/.

Options

--url URL              Base URL of the device (default: http://fritz.box:49000/)
--username USER        FRITZ!Box username
--password PASS        FRITZ!Box password
--collect COLLECTION   Metric family to collect; repeat to add more (default: all seven)
--format FORMAT        Output format: influx (default) or json
--help                 Show all options

Pass credentials either in the URL (http://user:pass@fritz.box:49000/) or as separate flags. Separate flags keep the password out of shell history and process listings.

License

MIT

About

Print FRITZ!Box TR-064 metrics in Influx line protocol from the CLI — same format as Telegraf's fritzbox plugin, no Telegraf required.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages