2020-11-28
Getting the DSL linespeed with both current and attainable speed from the Fritz!Box 7360/7590
I noticed I documented my original script to fetch the upstream and downstream DSL speed from the Fritz!Box 7360 but never documented the additional steps I took later to add the attainable upstream and downstream speeds to the current upstream and downstream speeds. After switching to the Fritz!Box 7590 I missed my VDSL statistics so I dug up the scripts I had for the 7360 and tested whether they still work. And yes they do, so no changes there. The complete script:#!/usr/bin/perl -w use strict; my ($fritzuser,$fritzpass); $fritzuser="root"; $fritzpass="VerySecretPassword"; system("wget --user=$fritzuser --password=$fritzpass --post-file=wanifcfgrequest.xml --header=\"Content-Type: text/xml\" --header=\"SOAPAction: \\\"urn:dslforum-org:service:WANDSLInterfaceConfig:1#GetInfo\\\"\" --no-check-certificate http://fritz.koos.koffie.dot:49000/upnp/control/wandslifconfig1 -O wanifcfganswer.xml -o getfritz.log"); open(STATUSFILE,"This does need the wanifcfgrequest.xml file:){ if (/ (\d+)<\/NewUpstreamMaxRate>/){ $upstream = $1; } if (/ (\d+)<\/NewDownstreamMaxRate>/){ $downstream = $1; } if (/ (\d+)<\/NewUpstreamCurrRate>/){ $upstreamcur = $1; } if (/ (\d+)<\/NewDownstreamCurrRate>/){ $downstreamcur = $1; } } if (defined $upstream and defined $downstream){ my $line=sprintf("N:%d:%d:%d:%d",$downstream*1000,$upstream*1000,$downstreamcur*1000,$upstreamcur*1000); print $line."\n"; } <?xml version="1.0" encoding="utf-8"?> <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <s:Body> <u:GetInfo xmlns:u="urn:dslforum-org:service:WANDSLInterfaceConfig1"> </u:GetInfo> </s:Body> </s:Envelope>And I get a usable wanifcfganswer.xml:<?xml version="1.0"?> <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <s:Body> <u:GetInfoResponse xmlns:u="urn:dslforum-org:service:WANDSLInterfaceConfig:1"> <NewEnable>1</NewEnable> <NewStatus>Initializing</NewStatus> <NewDataPath>Fast</NewDataPath> <NewUpstreamCurrRate>33032</NewUpstreamCurrRate> <NewDownstreamCurrRate>111049</NewDownstreamCurrRate> <NewUpstreamMaxRate>35725</NewUpstreamMaxRate> <NewDownstreamMaxRate>117129</NewDownstreamMaxRate> <NewUpstreamNoiseMargin>50</NewUpstreamNoiseMargin> <NewDownstreamNoiseMargin>60</NewDownstreamNoiseMargin> <NewUpstreamAttenuation>80</NewUpstreamAttenuation> <NewDownstreamAttenuation>110</NewDownstreamAttenuation> <NewATURVendor>41564d00</NewATURVendor> <NewATURCountry>0400</NewATURCountry> <NewUpstreamPower>498</NewUpstreamPower> <NewDownstreamPower>513</NewDownstreamPower> </u:GetInfoResponse> </s:Body> </s:Envelope>This works without any change both on the Fritz!Box 7360 and the Fritz!Box 7590.