The AVM Fritz.Box is really a great device - but the possibilities to get monitoring data are very limited. (Please read this posting)
Which data do i want?
I want the data, which is presented in the networking tab:
If i trace the networking with the developer tools, i the the following:
To reproduce this on my command line, i have to enter this into my bash:
curl 'http://fritz.box/data.lua'
-H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:82.0) Gecko/20100101 Firefox/82.0'
-H 'Accept: */*'
-H 'Accept-Language: de,en;q=0.7,en-US;q=0.3' --compressed
-H 'Content-Type: application/x-www-form-urlencoded'
-H 'Origin: http://fritz.box' -H 'Connection: keep-alive'
-H 'Referer: http://fritz.box/' -H 'Pragma: no-cache'
-H 'Cache-Control: no-cache'
--data-raw 'xhr=1&sid=cb......SID&lang=de&page=netDev&xhrId=cleanup&useajax=1&no_sidrenew='
(you have to add the line breaks and the SID in the last line).
Then you will get a JSON object beginning with these lines:
{and all the other information.
"pid": "netDev",
"hide": {
"ssoEmail": true,
"shareUsb": true,
"liveTv": true,
"faxSet": true,
"dectMoniEx": true,
"rss": true,
"mobile": true,
The problem: How to get this SID?
If you trace the login, it is not so easy, that the password is just send to the Fritz.Box. They use PBDFK2 to encrypt the password and then send it to the Fritz.Box.
You can find some information about that here:
Inside this document a PHP program is stated, which does the login (not really - i think it does the job years ago - but now it does a fallback to md5 authentication. I fixed this, just post a comment, if you want this pbkdf2 enabled php script). I wrote a small javascript, which i execute with node and after that i was able to log the data into my influxdb and build a show it inside grafana:
If you are interested in the configuration, the js script and the collect commands, then post me a comment...
No comments:
Post a Comment