Skip to content

bash script to collect various information from your Fritzbox via its SOAP api

Notifications You must be signed in to change notification settings

mrwhale/fritzbox-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 

Repository files navigation

fritzbox-api

Bash script to collect various information from your FRITZ!Box via its SOAP api.

As I could not find much information on this in english, this is a combination of a few scripts I found online from some european blogs (not in my native language) So lets give a thanks to

Script can output:

  • 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 can also output all of the above in JSON format, useful for ingesting into another program and when running via cron (e.g I read this information into openHAB)

The purpose for this was so I could get the current bandwidth usage across the WAN link into openHAB, for monitoring and for making pretty graphs on usage during the day. And I could see the current bandwidth usage at a glance, incase I was having some issues and quick diagnosis. I have made this script a little more bare, without all the openHAB specific stuff in it

Requirement

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" (German: Statusinformationen über UPnP übertragen).

Usage

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

functions:
  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 192.168.100.1 -b m

Dependancies

  • curl
  • bc

About

bash script to collect various information from your Fritzbox via its SOAP api

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages