Git Product home page Git Product logo

fritzinfluxdb's People

Contributors

bb-ricardo avatar flok avatar m7stock avatar marclandis avatar muenzpraeger avatar nerdyprojects avatar schallerr avatar skrollme avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fritzinfluxdb's Issues

Script always crashes when Starting

When I Start the Exporter with /opt/fritzinfluxdb $ ./fritzinfluxdb.py it tries to start but it crashes always with
INFO: Starting main loop
./fritzinfluxdb.py:141: RuntimeWarning: coroutine 'InfluxHandler.task_loop' was never awaited
task = loop.create_task(handler.task_loop(queue), name=handler.name)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

and then it closes the connections and after the Shutdown Information I get this:
Traceback (most recent call last):
File "./fritzinfluxdb.py", line 155, in
main()
File "./fritzinfluxdb.py", line 141, in main
task = loop.create_task(handler.task_loop(queue), name=handler.name)
TypeError: create_task() got an unexpected keyword argument 'name'

Failed to connect to InfluxDB: HTTPConnectionPool...

Hi Ricardo,
I've installed fritzinfluxdb on an Raspberry.
InfluxDB Version 1.8.0 is running on FreeBSD Jail, influxdb.hostname:port = http://192.168.178.39:8086.
If I use:
pi@RasPiTest1:/opt/fritzfluxdb $ curl -sl -I http://192.168.178.39:8086/ping
I get
HTTP/1.1 204 No Content
Content-Type: application/json
Request-Id: aab2d99a-375f-11ed-8003-901b0ee7022b
X-Influxdb-Build: OSS
X-Influxdb-Version: 1.8.0
X-Request-Id: aab2d99a-375f-11ed-8003-901b0ee7022b
Date: Sun, 18 Sep 2022 14:39:14 GMT
No issue as fare as I understand....
If I run:
sudo python3 ./fritzinfluxdb.py -d -v
I get:
INFO: Starting fritzinfluxdb v1.0.1 (2022-08-22)
INFO: Done reading config files
DEBUG: Config: influxdb.version = 1
DEBUG: Config: influxdb.hostname = http://192.168.178.39
DEBUG: Config: influxdb.port = 8086
DEBUG: Config: influxdb.tls_enabled = False
DEBUG: Config: influxdb.verify_tls = False
DEBUG: Config: influxdb.measurement_name = fritzbox
DEBUG: Config: influxdb.username = admin
DEBUG: Config: influxdb.password = adm***
DEBUG: Config: influxdb.database = MonitorTest
DEBUG: Config: influxdb.token = ***
DEBUG: Config: influxdb.organisation =
DEBUG: Config: influxdb.bucket =
DEBUG: Config: fritzbox.hostname = 192.168.178.1
DEBUG: Config: fritzbox.username = wikomon
DEBUG: Config: fritzbox.password = wik***
DEBUG: Config: fritzbox.port = 49000
DEBUG: Config: fritzbox.tls_enabled = False
DEBUG: Config: fritzbox.verify_tls = False
DEBUG: Config: fritzbox.connect_timeout = 10
DEBUG: Config: fritzbox.request_interval = 10
DEBUG: Config: fritzbox.box_tag = fritz.box
DEBUG: Config: fritzbox.timezone = Europe/Berlin
INFO: Successfully parsed config
ERROR: Failed to connect to InfluxDB: HTTPConnectionPool(host='http', port=80): Max retries exceeded with url: //192.168.178.39:8086/ping (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x75cd5448>: Failed to establish a new connection: [Errno -2] Name or service not known'))
DEBUG: Initiating new FritzBox TR-069 session
INFO: Successfully established FritzBox TR-069 session
DEBUG: Initiating new FritzBox Lua session
INFO: Successfully established FritzBox Lua session
ERROR: Initializing connection to InfluxDB failed

With an simple Python script usin InfluxDBClient from influxdb lib I can connect to the InfluxDB and can read e.g. get_list_database....
Hope you have a hint for me.

Best regards

Syslog: ERROR: Unable to extract 'None' form....

Hi,

I have a lot of entries like this in the syslog:

Jul 24 11:46:09 debian2 fritzinfluxdb[3289011]: ERROR: Unable to extract 'None' form '{'helplink': '/help/help.lua?sid=7edc2c0f4822faca&helppage=hilfe_syslog_752.html', 'time': '22:07:43', 'group': 'wlan', 'id': 752, 'msg': 'WLAN-Gerät hat sich abgemeldet (2,4 GHz), PC-B4-7C-9C-1B-7A-59, IP 192.168.1.100, MAC 14:2C:3C:4B:5A:69.', 'date': '13.07.22', 'nohelp': 0}', got '<class 'NoneType'>'
Jul 24 11:46:09 debian2 fritzinfluxdb[3289011]: ERROR: Unable to extract 'None' form '{'helplink': '/help/help.lua?sid=7edc2c0f4822faca&helppage=hilfe_syslog_756.html', 'time': '22:07:04', 'group': 'wlan', 'id': 756, 'msg': 'WLAN-Gerät hat sich neu angemeldet (2,4 GHz), 72 Mbit/s, PC-74-C2-46-E8-39-A4, IP 192.168.1.102, MAC 14:22:36:48:59:64.', 'date': '13.07.22', 'nohelp': 0}', got '<class 'NoneType'>'
Jul 24 11:46:09 debian2 fritzinfluxdb[3289011]: ERROR: Unable to extract 'None' form '{'helplink': '/help/help.lua?sid=7edc2c0f4822faca&helppage=hilfe_syslog_754.html', 'time': '22:07:02', 'group': 'wlan', 'id': 754, 'msg': 'WLAN-Gerät wurde abgemeldet (2,4 GHz), PC-74-C2-46-E8-39-A4, IP 192.168.1.102, MAC 11:22:36:48:49:54.', 'date': '13.07.22', 'nohelp': 0}', got '<class 'NoneType'>'

and

Jul 24 11:46:12 debian2 fritzinfluxdb[3289011]: ERROR: Unable to extract 'data.vpnInfo.server' form '{'pid': 'shareVpn', 'hide': {'ssoSet': True, 'shareUsb': True, 'mobile': True, 'liveTv': True, 'faxSet': True, 'provServ': True, 'boxExchange': True, 'rrd': True}, 'timeTillLogout': '1200', 'time': [], 'data': {'init': {'userConnections': {'connection1': {'connected': False, 'active': True, 'userId': '', 'deletable': True, 'address': '', 'type': 'homeNetworkVpn', 'psk': '', 'virtualAddress': '192.168.1.201', 'name': 'namexx'}, 'connection0': {'connected': False, 'active': True, 'userId': 'boxuser11', 'deletable': True, 'address': '', 'type': 'homeNetworkVpn', 'psk': 'ETcwUvaquZjqHome', 'virtualAddress': '192.168.1.200', 'name': 'vpn'}}, 'type': 'IPSec Xauth PSK', 'help': {'url': 'https://www.avm.de/service/vpn', 'text': 'www.avm.de/service/vpn'}, 'boxConnections': [], 'server': 'abc.firewall-gateway.com'}}, 'sid': '7edc2c0f4822faca'}', got '<class 'NoneType'>'
Jul 24 11:46:12 debian2 fritzinfluxdb[3289011]: ERROR: Unable to extract 'data.vpnInfo.type' form '{'pid': 'shareVpn', 'hide': {'ssoSet': True, 'shareUsb': True, 'mobile': True, 'liveTv': True, 'faxSet': True, 'provServ': True, 'boxExchange': True, 'rrd': True}, 'timeTillLogout': '1200', 'time': [], 'data': {'init': {'userConnections': {'connection1': {'connected': False, 'active': True, 'userId': '', 'deletable': True, 'address': '', 'type': 'homeNetworkVpn', 'psk': '', 'virtualAddress': '192.168.1.201', 'name': 'namexx'}, 'connection0': {'connected': False, 'active': True, 'userId': 'boxuser11', 'deletable': True, 'address': '', 'type': 'homeNetworkVpn', 'psk': 'ETcwUvaquZjqHome', 'virtualAddress': '192.168.1.200', 'name': 'vpn'}}, 'type': 'IPSec Xauth PSK', 'help': {'url': 'https://www.avm.de/service/vpn', 'text': 'www.avm.de/service/vpn'}, 'boxConnections': [], 'server': 'abc.firewall-gateway.com'}}, 'sid': '7edc2c0f4822faca'}', got '<class 'NoneType'>'
Jul 24 11:46:12 debian2 fritzinfluxdb[3289011]: ERROR: Unable to extract 'data.vpnInfo.userConnections' form '{'pid': 'shareVpn', 'hide': {'ssoSet': True, 'shareUsb': True, 'mobile': True, 'liveTv': True, 'faxSet': True, 'provServ': True, 'boxExchange': True, 'rrd': True}, 'timeTillLogout': '1200', 'time': [], 'data': {'init': {'userConnections': {'connection1': {'connected': False, 'active': True, 'userId': '', 'deletable': True, 'address': '', 'type': 'homeNetworkVpn', 'psk': '', 'virtualAddress': '192.168.1.201', 'namexx': 'namexx'}, 'connection0': {'connected': False, 'active': True, 'userId': 'boxuser11', 'deletable': True, 'address': '', 'type': 'homeNetworkVpn', 'psk': 'ETcwUvaquZjqHome', 'virtualAddress': '192.168.1.200', 'name': 'vpn'}}, 'type': 'IPSec Xauth PSK', 'help': {'url': 'https://www.avm.de/service/vpn', 'text': 'www.avm.de/service/vpn'}, 'boxConnections': [], 'server': 'abc.firewall-gateway.com'}}, 'sid': '7edc2c0f4822faca'}', got '<class 'NoneType'>'

Any idea what's wrong?

Possible to extend data collection of fritzOS?

Hello,

first i'd like to thank you for fritzinfluxdb ! fritzinfluxdb already collects a lot of things but maybe it is possible to even extend it. I just wanted to mention some metrics which would be nice.

Display metrics like the "Online-Monitor" on fritzOS. For e.g. "used DNS server IP", "number of connected VPN users", "Status of DynDNS", "number of configurated ports".

Display metrics of the "energy monitor -> power consumption" in percentage like:

Display metrics of the "energy monitor -> statistics" in percentage like:

Thanks anyway!

How to enable scraping of log entries ?

I came back to this project and realized the whole new work with influxdbv2, dashboards with logfiles, docker. Since I have running influxdbv1 (just for fritzinfluxdb scraping) and influxdbv2 for other jobs, I thought this is a good time to consolidate to InfluxDBv2. Huge thanks for refactoring fritzinfluxdb! I admire your dedication. Thank you.

I'm having trouble to imagine how to "activate" the collection of logfiles on the FritzBox. I have a fritzbox 7490 with version 7.29, using DSL. I already activated the recommended values on the fritzbox web configuration.

image

I can see that the LUA values for log entries are not pulled at all:


2022-07-12 06:48:14,726 - INFO: Starting fritzinfluxdb v1.0.0 (2022-06-11)
2022-07-12 06:48:14,745 - INFO: Successfully parsed config
2022-07-12 06:48:14,747 - INFO: Connection to InfluxDB 2 established
2022-07-12 06:48:16,577 - INFO: Successfully established FritzBox TR-069 session
2022-07-12 06:48:18,883 - INFO: Successfully established FritzBox Lua session
2022-07-12 06:48:18,883 - INFO: Successfully connected to FritzBox '192.168.178.1' (fritz.box) Model: FRITZ!Box 7490 (UI) - FW: 7.29
2022-07-12 06:48:18,884 - INFO: Starting main loop
2022-07-12 06:48:20,335 - INFO: Requested invalid action 'GetInfo' for service: WANIPConnection:1
2022-07-12 06:48:20,335 - INFO: Querying action 'GetInfo' will be disabled
2022-07-12 06:48:20,335 - INFO: All actions for service 'WANIPConnection:1' are unavailable. Disabling service.
2022-07-12 06:48:36,753 - ERROR: Unable to perform request to 'http://192.168.178.1/data.lua': HTTPConnectionPool(host='192.168.178.1', port=80): Read timed out. (read timeout=10)
2022-07-12 06:48:36,753 - ERROR: Unable to request FritzBox Lua service 'System logs', no data returned
2022-07-12 06:48:36,753 - INFO: FritzBox Lua service 'System logs' will be disabled.
2022-07-12 06:48:46,805 - ERROR: Unable to perform request to 'http://192.168.178.1/data.lua': HTTPConnectionPool(host='192.168.178.1', port=80): Read timed out. (read timeout=10)
2022-07-12 06:48:46,805 - ERROR: Unable to request FritzBox Lua service 'Internet connection logs', no data returned
2022-07-12 06:48:46,805 - INFO: FritzBox Lua service 'Internet connection logs' will be disabled.
2022-07-12 06:48:56,855 - ERROR: Unable to perform request to 'http://192.168.178.1/data.lua': HTTPConnectionPool(host='192.168.178.1', port=80): Read timed out. (read timeout=10)
2022-07-12 06:48:56,855 - ERROR: Unable to request FritzBox Lua service 'Telephony logs', no data returned
2022-07-12 06:48:56,855 - INFO: FritzBox Lua service 'Telephony logs' will be disabled.
2022-07-12 06:49:06,876 - ERROR: Unable to perform request to 'http://192.168.178.1/data.lua': HTTPConnectionPool(host='192.168.178.1', port=80): Read timed out. (read timeout=10)
2022-07-12 06:49:06,876 - ERROR: Unable to request FritzBox Lua service 'WLAN logs', no data returned
2022-07-12 06:49:06,876 - INFO: FritzBox Lua service 'WLAN logs' will be disabled.
2022-07-12 06:49:16,927 - ERROR: Unable to perform request to 'http://192.168.178.1/data.lua': HTTPConnectionPool(host='192.168.178.1', port=80): Read timed out. (read timeout=10)
2022-07-12 06:49:16,928 - ERROR: Unable to request FritzBox Lua service 'USB Devices logs', no data returned
2022-07-12 06:49:16,928 - INFO: FritzBox Lua service 'USB Devices logs' will be disabled.
2022-07-12 06:49:36,607 - ERROR: Unable to perform request to 'http://192.168.178.1/data.lua': HTTPConnectionPool(host='192.168.178.1', port=80): Read timed out. (read timeout=10)
2022-07-12 06:49:36,607 - ERROR: Unable to request FritzBox Lua service 'Passive network hosts', no data returned
2022-07-12 06:49:36,608 - INFO: FritzBox Lua service 'Passive network hosts' will be disabled.
2022-07-12 06:49:53,422 - INFO: Unable to request FritzBox Lua service 'Cable Info'
2022-07-12 06:49:53,422 - INFO: FritzBox Lua service 'Cable Info' will be disabled.

The other LUA metrics works fine:

image

SInce I could not find anything related on the project regarding the log entries activation, would be helpfull if you throw some light on this matter. Do I need another SW?, switch some flag more on FritzBox, etc?

High CPU Utilization and Temperature

@bb-Ricardo

Hi Ricardo

First I thought, it could be related to my setup... Running InfluxDB v2, Grafana and Telegraf in separate Docker container and created a database inside the influx bucket to use InfluxQL. Therefore, I decide to switch back to InfluxDB v1.8 and created a Docker container which included all three programs. But still the same...

Now to the effect what shows up... Beside your FritzBox monitoring, I run Telegraf to monitor the Pi4 which is hosting the FritzBox monitoring. As long as I only open the row with the Pi metrics, the temperature and cpu utilization is "normal". as soon as I open the FritzBox overview row, the temperature and cpu utilization increase up to 82°C and 99%. Short after I close the FritzBox overview row, the temperature and cpu utilization fell down to normal.

Unfortunately I didn't had the Pi monitoring running with your old version, so I can't compare at the moment. Will try to make a setup on my old Pi3 to have a look.

But maybe you or someone else had saw this also. Could it be, that this is related to the database structure?

image
image

Edit:

Setup the old FritzBox version with TIG container on my Pi3. Now have to wait for some data and then I can check... ;o)

not able to start docker file...

Hi Ricardo, hi all

I'm new in Linux and also in Docker and face a problem with the Docker file I created...

First I tried to install your script in the virtual environment on my pc without any problem. Afterwards I tried to use the docker way, because I want to use it on a Raspberry PI in combination with a influx/grafana docker container. This container is running well...

I used the way you described:

ronald@buster:/opt$ sudo git clone https://github.com/yunity/fritzinfluxdb.git
Klone nach 'fritzinfluxdb' ...
remote: Enumerating objects: 144, done.
remote: Total 144 (delta 0), reused 0 (delta 0), pack-reused 144
Empfange Objekte: 100% (144/144), 130.37 KiB | 185.00 KiB/s, Fertig.
Löse Unterschiede auf: 100% (80/80), Fertig.
ronald@buster:/opt$ cd fritzinfluxdb
ronald@buster:/opt/fritzinfluxdb$ docker build -t fritzinfluxdb .
Sending build context to Docker daemon 406kB
:
:
Step 5/5 : CMD [ "python", "./fritzinfluxdb.py" ]
---> Running in df9377423fcf
Removing intermediate container df9377423fcf
---> c7f51a4cec46
Successfully built c7f51a4cec46
Successfully tagged fritzinfluxdb:latest

Then I modified the fritzinfluxdb.ini and saved it in my home directory... I have two copies... fritzinfluxdb.ini and my-fritzinfluxdb.ini

If I now start the container with

ronald@buster:/opt/fritzinfluxdb$ docker run -d -v /home/ronald/fritzbox/my-fritzinfluxdb.ini:/app/idefault.ini --name fritzinfluxdb fritzinfluxdb or
ronald@buster:/opt/fritzinfluxdb$ docker run -d -v /home/ronald/fritzbox/fritzinfluxdb.ini:/app/idefault.ini --name fritzinfluxdb fritzinfluxdb

and then take a look into the logs, I get this message:

ronald@buster:/opt/fritzinfluxdb$ docker container logs --details fritzinfluxdb
2021-01-13 08:14:29,435 - ERROR: Config file "./fritzinfluxdb.ini" not found

Even with my-fritzinfluxdb.ini or fritzinfluxdb.ini

The only thing, what happen is, that I got two folder (my-fritzinfluxdb.ini or fritzinfluxdb.ini) in /home/ronald/fritzbox

Now is the question, what I have to change, that I get it running... Hope you or someone have a clue or idea what I have to do...

Thanks a lot in advanced
Ronald

Include Smart Home / DECT devices?

Works surprisingly well in a FreeBSD jail (TrueNAS 13) with pm2 as process manager. Ask away if somebody has questions regarding to it.

Question for the developer: Smart Home devices like FRITZ!DECT 200 can provide useful data such as temperature readings. Any way to get to that data through your python script?

ERROR: Requested invalid service

Hello,

very big thanks to that project.
Unfortunately i have problems with two services and get this errors in docker

ERROR: Requested invalid service: WANCommonIFC
ERROR: Requested invalid service: WANCommonIFC
ERROR: Requested invalid service: WANIPConn
ERROR: Requested invalid service: WANIPConn
ERROR: Encountered problems while requesting data. Data might be incomplete.

This ones contain the data i'm interested in the most of all.

My Fritzbox is 7490 with the latest stable version.

Thanks for support
Bond

Works when run by hand, fails as a daemon (RPi 1, Python3)

Hi
Are you able to sort my issue out?
When I run your script by hand, it works without issues (Grafana dashboard is populated with data):

pi@raspberrypi:~/fritzinfluxdb $ ./fritzinfluxdb.py
2022-01-03 13:16:19,230 - INFO: Done parsing config file
2022-01-03 13:16:19,413 - INFO: Connection to InfluxDB established and database present
2022-01-03 13:16:25,520 - INFO: Successfully connected to FritzBox
2022-01-03 13:16:25,541 - INFO: Starting main loop

However, when run it as a daemon Python fails to import fritzconnection. Any hints? Thanks

Jan  3 13:13:56 raspberrypi systemd[1]: fritzinfluxdb.service: Service RestartSec=5s expired, scheduling restart.
Jan  3 13:13:56 raspberrypi systemd[1]: fritzinfluxdb.service: Scheduled restart job, restart counter is at 1475.
Jan  3 13:13:56 raspberrypi systemd[1]: Stopped Fritz to InfluxDB daemon.
Jan  3 13:13:56 raspberrypi systemd[1]: Started Fritz to InfluxDB daemon.

Jan  3 13:13:58 raspberrypi fritzinfluxdb[14983]: Traceback (most recent call last):
Jan  3 13:13:58 raspberrypi fritzinfluxdb[14983]:   File "/home/pi/fritzinfluxdb/fritzinfluxdb.py", line 18, in <module>
Jan  3 13:13:58 raspberrypi fritzinfluxdb[14983]:     import fritzconnection
Jan  3 13:13:58 raspberrypi fritzinfluxdb[14983]: ModuleNotFoundError: No module named 'fritzconnection'
Jan  3 13:13:58 raspberrypi systemd[1]: fritzinfluxdb.service: Main process exited, code=exited, status=1/FAILURE
Jan  3 13:13:58 raspberrypi systemd[1]: fritzinfluxdb.service: Failed with result 'exit-code'.

This was my setup:

pip3 install influxdb
pip3 install fritzconnection
cp fritzinfluxdb.ini-sample fritzinfluxdb.ini
vim fritzinfluxdb.ini <-- fill with proper credentials
sudo cp fritzinfluxdb.service /etc/systemd/system
sudo systemctl daemon-reload
sudo systemctl start fritzinfluxdb
sudo systemctl enable fritzinfluxdb

I'm running Raspbian GNU/Linux 10 (buster) on Raspberry Pi 1 Model B Rev 2

pi@raspberrypi:~/fritzinfluxdb $ python3 -V
Python 3.7.3

Using fritzinfluxdb with InfluxDBv2

Hey there.

I just found this cool project and wanted to use it, but it seems, that it is not available for user who use influxDB in Version 2.
Is there any possibility to use this project with version 2, or will this be available in a next release?

No data in Grafana

Hey,
iam trying to setup this tool.
Everything is working fine, the database connection is working, the data source in grafana is working but there is no displayed data in grafana it self.

image

Logs of fritzinfluxdb:

2022-02-20 17:35:46,048 - INFO: Starting main loop
2022-02-20 17:03:38,052 - INFO: Successfully connected to FritzBox
2022-02-20 17:35:44,435 - INFO: Program terminated. Signal 15
2022-02-20 17:03:38,053 - INFO: Starting main loop
2022-02-20 17:35:44,953 - INFO: Done parsing config file
2022-02-20 17:35:44,956 - INFO: Connection to InfluxDB established and database present
2022-02-20 17:35:46,048 - INFO: Successfully connected to FritzBox

Logs of influxdb 1.8
"POST /write?db=fritzbox&precision=ms HTTP/1.1 " 204 0 "-" "python-requests/2.27.1" 6449f254-9274-11ec-8246-0242ac110005 7306

Some of the Panels within Dashboard displaying incorrect data

Its a long shot, being as there not been much activity on here for about a year.
But is there someone that can help ?

The System Uptime Panel and DSL Link Uptime panel box are displaying incorrect data. It is displaying a default of 1 month uptime even though its been up for more than 3 months. I restarted my router and it restarts to 0 then freezes at 1 month. Im gonna spin up another virtual machine to test it too see if ive got a faulty version of fritzconnection but wondering is anyone can shed any light on this.

I would also like to request info on how to add a box to say whether the DSL is up or not, a older project i tried from different program of collectd had it but dont know how to add it in to this.

Fritzbox rejects password after getting data two times

Since I got Grafana to work in #54, I have now been running fritzinfluxdb for a short while. However, I found that for every time I start the fritzinfluxdb container, there are only two data points received, spaced about two minutes apart. After that, there is no more data. I'm currently running next-release as of yesterday evening.

Manually checking the logs in the FritzBox reveals many entries like the following:

2022-09-21 22:00:04
System
Anmeldung an der FRITZ!Box-Benutzeroberfläche von IP-Adresse REDACTED gescheitert (falsches Kennwort).
2022-09-21 21:55:05
System
Anmeldung an der FRITZ!Box-Benutzeroberfläche von IP-Adresse REDACTED gescheitert (falsches Kennwort).
2022-09-21 21:50:12
System
Anmeldung an der FRITZ!Box-Benutzeroberfläche von IP-Adresse REDACTED gescheitert (falsches Kennwort). [3 Meldungen seit 21.09.22 21:50:04]
2022-09-21 21:49:34
System
Anmeldung des Benutzers fritzinfluxdb an der FRITZ!Box-Benutzeroberfläche von IP-Adresse REDACTE. [4 Meldungen seit 21.09.22 21:47:24]

I use a dedicated user account for fritzinfluxdb. The REDACTED IP adress is the address of the machine fritzinfluxdb is running on - and nothing else is logging in from that machine. Given that neither the FrotzBox nor fritzinfluxdb suddenly change the password they are using, this would seem to be some kind of rate limiting for logins of a particular user. However, I'm not aware of such a feature on FritzBoxes, and this does not seem to be a problem for others, so I'm kind of stumped as to the actual cause of the problem here.

What can I do to make fritzinfluxdb get data continuously and reliably?

Exception occured

Hi, i'm not sure if this is a problem of fritzinfluxdb or fritzconnect, mayber you can help me
Getting the following output when execute ./fritzinfluxdb.py

`INFO: Done parsing config file
INFO: Connection to InfluxDB established and database present
INFO: Successfully connected to FritzBox
Traceback (most recent call last):
File "/home/collector/environments/fritzinfluxdb/.venv/lib/python3.7/site-packages/fritzconnection/core/soaper.py", line 123, in raise_fritzconnection_error
root = etree.fromstring(response.content)
File "/usr/lib/python3.7/xml/etree/ElementTree.py", line 1315, in XML
parser.feed(text)
xml.etree.ElementTree.ParseError: mismatched tag: line 1, column 156

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "./fritzinfluxdb.py", line 200, in
main()
File "./fritzinfluxdb.py", line 182, in main
points = query_points(fritz_client_unauth, unauth_services)
File "./fritzinfluxdb.py", line 60, in query_points
this_result = fc.call_action(service, action)
File "/home/collector/environments/fritzinfluxdb/.venv/lib/python3.7/site-packages/fritzconnection/core/fritzconnection.py", line 218, in call_action
return self.soaper.execute(service, action_name, arguments)
File "/home/collector/environments/fritzinfluxdb/.venv/lib/python3.7/site-packages/fritzconnection/core/soaper.py", line 233, in execute
return handle_response(response)
File "/home/collector/environments/fritzinfluxdb/.venv/lib/python3.7/site-packages/fritzconnection/core/soaper.py", line 218, in handle_response
raise_fritzconnection_error(response)
File "/home/collector/environments/fritzinfluxdb/.venv/lib/python3.7/site-packages/fritzconnection/core/soaper.py", line 133, in raise_fritzconnection_error
raise FritzConnectionException(msg)
fritzconnection.core.exceptions.FritzConnectionException: Unable to perform operation. 401 Unauthorized (ERR_NONE)401 UnauthorizedERR_NONEWebserver Mon, 03 Aug 2020 06:47:12 GMT`

more values

Hi,

is there a way to get Values like SNR and Failure count and so on?

regards

celevra

Failed to connect to FritzBox 'NoneType' object has no attribute 'strip'

Hi,
I'm currently setting up fritzinfluxdb through docker-compose. I managed to get a connection to the InfluxDB. I also managed to get a connection to the fritzbox (at least I do not get the error for wrong credentials anymore). But now I am stuck with the error seen below.
I can not figure out on my own what the actual problem is because the error-message is very generic.

Hope that someone can help me out or reproduce and fix the error.

2022-09-05 22:19:23,773 - INFO: Starting fritzinfluxdb v1.0.1 (2022-08-22)
2022-09-05 22:19:23,775 - DEBUG: Config: influxdb.version = 2
2022-09-05 22:19:23,776 - DEBUG: Config: influxdb.hostname = influxdb
2022-09-05 22:19:23,776 - DEBUG: Config: influxdb.port = 8086
2022-09-05 22:19:23,777 - DEBUG: Config: influxdb.tls_enabled = False
2022-09-05 22:19:23,777 - DEBUG: Config: influxdb.verify_tls = False
2022-09-05 22:19:23,778 - DEBUG: Config: influxdb.measurement_name = fritzbox
2022-09-05 22:19:23,778 - DEBUG: Config: influxdb.username = None
2022-09-05 22:19:23,779 - DEBUG: Config: influxdb.password = None
2022-09-05 22:19:23,779 - DEBUG: Config: influxdb.database = None
2022-09-05 22:19:23,780 - DEBUG: Config: influxdb.token = removed for GitHub
2022-09-05 22:19:23,780 - DEBUG: Config: influxdb.organisation = myOrg
2022-09-05 22:19:23,781 - DEBUG: Config: influxdb.bucket = fritzinfluxdb
2022-09-05 22:19:23,803 - DEBUG: Config: fritzbox.hostname = 192.168.188.1
2022-09-05 22:19:23,804 - DEBUG: Config: fritzbox.username = fritzinflux
2022-09-05 22:19:23,804 - DEBUG: Config: fritzbox.password = removed for GitHub
2022-09-05 22:19:23,805 - DEBUG: Config: fritzbox.port = 49000
2022-09-05 22:19:23,805 - DEBUG: Config: fritzbox.tls_enabled = False
2022-09-05 22:19:23,806 - DEBUG: Config: fritzbox.verify_tls = False
2022-09-05 22:19:23,806 - DEBUG: Config: fritzbox.connect_timeout = 10
2022-09-05 22:19:23,807 - DEBUG: Config: fritzbox.request_interval = 10
2022-09-05 22:19:23,807 - DEBUG: Config: fritzbox.box_tag = fritz.box
2022-09-05 22:19:23,808 - DEBUG: Config: fritzbox.timezone = Europe/Berlin
2022-09-05 22:19:23,960 - INFO: Successfully parsed config
2022-09-05 22:19:23,996 - DEBUG: InfluxDB bucket 'fritzinfluxdb' exists
2022-09-05 22:19:23,996 - DEBUG: InfluxDB bucket 'fritzinfluxdb' present, checking database name mapping
2022-09-05 22:19:24,005 - DEBUG: InfluxDB bucket 'fritzinfluxdb' has a database mapping: fritzinfluxdb
2022-09-05 22:19:24,005 - INFO: Connection to InfluxDB v2.4.0 established and bucket is present
2022-09-05 22:19:24,006 - DEBUG: Initiating new FritzBox TR-069 session
2022-09-05 22:19:26,627 - ERROR: Failed to connect to FritzBox TR-069 '192.168.188.1': 'NoneType' object has no attribute 'strip'
2022-09-05 22:19:26,627 - INFO: Disabling queries via Lua. Fritz!OS version must be at least 7.XX
2022-09-05 22:19:26,628 - ERROR: Initializing connection to FritzBox TR-069 failed

using ENV with docker-compose and Network-Mode

Hello Ricardo,

best men for rewriting the whole project :-)
Just some questions on migrating:

I would like to use docker-compose with ENV-variables to start the container. I think it is the most simple way while i don't net a .ini-file... volumes and so on.
But after starting the container with my specific configuration i get:

2022-06-14 08:43:34,943 - INFO: Starting fritzinfluxdb v1.0.0 (2022-06-11)
2022-06-14 08:43:34,943 - ERROR: InfluxDB bucket not defined

And 2nd questin.
The old package needed to be run the container in host-mode network. Is it still the same with the new package or is this obsolet?

Thanks
Bond

My docker-compose looks like this:

version: '3'

services:
  fritzinfluxdb:
    container_name: fritzinfluxdb
    image: bbricardo/fritzinfluxdb:1.0.0
    restart: unless-stopped
    networks:
      - my-bridge
    environment:
      # FritzBox configuration
      - FRITZBOX_USERNAME=user
      # this var should be defined in an ".env" file
      - FRITZBOX_PASSWORD=xyz

      # InfluxDB configuration
      - INFLUXDB_VERSION=2
      - INFLUXDB_HOSTNAME=InfluxDB
      - INFLUXDB_ORGANISATION=ubuntu-home
      - INFLUXDB_BUCKT=40_tage
      # this var should be defined in an ".env" file
      - INFLUXDB_TOKEN=crazy-token

      # for more config options check fritzinfluxdb-sample.ini

    # enable to write debug information to docker logs
    # command:
    #   - "python"
    #   - "/app/fritzinfluxdb.py"
    #   - "-v"
    
networks:
  my-bridge:
    external: true
    name: my-bridge

fritzinfluxdb[3565]: errorCode: 606

Hi,

don't know why, the user and verything was the same as it was with the collectd plugin before...

Any thoughts why I cannot get access to the box with fritzinfluxdb?

How do I make sure the ini file is used?

Cheers

4920441

no data displayed

I set this up with docker and infuxdb 1.8.6 (as the latest tag pulls v2 and that doesnt work, yet).
I also had to set the db initialisation tags on the influxdb container (-e INFLUXDB_DB=db -e INFLUXDB_ADMIN_USER=bla -e INFLUXDB_ADMIN_PASSWORD=blub). (temporary)
The containers seem to work, but no data is displayed in the grafana dashboard (713).

grafik

grafik
"0 series returned"

the fritzinfluxdb-container connects to my fritzbox, the data is posted into the db as well.
Any ideas or info i should add?

Data extrapolation for connected devices

I was wondering if you're open to add some more data extrapolation capabilities for active devices to the project.

Specifically:

  • Is part of Mesh
  • Wifi frequency
  • Upstream / Downstream speed
  • Parent device

Alternatively maybe an option to use a config file with additional services that would then be merged at runtime into the built-in config.

Happy to provide a PR for any of that.

Invalid Actions

Hey,

i'm using docker as a plattform but getting this error logs:

2021-01-10 20:26:57,076 - INFO: Done parsing config file
2021-01-10 20:26:57,089 - INFO: Connection to InfluxDB established and database present
2021-01-10 20:26:57,633 - INFO: Successfully connected to FritzBox
2021-01-10 20:26:57,635 - INFO: Starting main loop
2021-01-10 20:26:58,253 - ERROR: Requested invalid action 'GetInfo' for service: WANDSLInterfaceConfig
2021-01-10 20:26:58,266 - ERROR: Requested invalid action 'GetStatisticsTotal' for service: WANDSLInterfaceConfig
2021-01-10 20:26:58,458 - ERROR: Requested invalid action 'GetInfo' for service: WANPPPConnection:1
2021-01-10 20:26:58,459 - ERROR: Encountered problems while requesting data. Data might be incomplete.

What could it be, the grafana Dashboard is as well empty?

Greetings

Daniel

action GetAddonInfos under service WANCommonIFC:1

I use a Fritz!Box 7590 with Fritz!OS: 07.12 (lastest)

fritzinfluxdb aborts when started with default.ini. The culprit is that the action GetAddonInfos used in clause [service1] of the ini file is not available in service WANCommonInterfaceConfig.

It turns out that this action is available for service WANCommonIFC:1, as all other actions used by clause [service1]. See appended lists.

So just changing the service name from WANCommonInterfaceConfig:1 to WANCommonIFC:1 was sufficient to make it work in my case.

Did this change in recent Fritz!OS versions ? Or is this action provided by different services depending on Fritz!Box model ? In the first case default.ini should be updated, in the second case it's helpful to give some hints in the README.


output from fritzconnection -c -u <user> -p <pwd>

Servicename:        WANCommonIFC:1
Actionname:         GetAddonInfos
                        ('NewAutoDisconnectTime', 'out', 'ui4')
                        ('NewByteReceiveRate', 'out', 'ui4')
                        ('NewByteSendRate', 'out', 'ui4')
                        ('NewDNSServer1', 'out', 'string')
                        ('NewDNSServer2', 'out', 'string')
                        ('NewIdleDisconnectTime', 'out', 'ui4')
                        ('NewPacketReceiveRate', 'out', 'ui4')
                        ('NewPacketSendRate', 'out', 'ui4')
                        ('NewRoutedBridgedModeBoth', 'out', 'ui1')
                        ('NewTotalBytesReceived', 'out', 'ui4')
                        ('NewTotalBytesSent', 'out', 'ui4')
                        ('NewUpnpControlEnabled', 'out', 'boolean')
                        ('NewVoipDNSServer1', 'out', 'string')
                        ('NewVoipDNSServer2', 'out', 'string')
                        ('NewX_AVM_DE_TotalBytesReceived64', 'out', 'string')
                        ('NewX_AVM_DE_TotalBytesSent64', 'out', 'string')
                        ('NewX_AVM_DE_WANAccessType', 'out', 'string')
Actionname:         GetCommonLinkProperties
                        ('NewLayer1DownstreamMaxBitRate', 'out', 'ui4')
                        ('NewLayer1UpstreamMaxBitRate', 'out', 'ui4')
                        ('NewPhysicalLinkStatus', 'out', 'string')
                        ('NewWANAccessType', 'out', 'string')
Actionname:         GetTotalBytesReceived
                        ('NewTotalBytesReceived', 'out', 'ui4')
Actionname:         GetTotalBytesSent
                        ('NewTotalBytesSent', 'out', 'ui4')
Actionname:         GetTotalPacketsReceived
                        ('NewTotalPacketsReceived', 'out', 'ui4')
Actionname:         GetTotalPacketsSent
                        ('NewTotalPacketsSent', 'out', 'ui4')
Actionname:         X_AVM_DE_GetDsliteStatus
                        ('NewX_AVM_DE_DsliteStatus', 'out', 'boolean')
Actionname:         X_AVM_DE_GetIPTVInfos
                        ('NewX_AVM_DE_IPTV_Enabled', 'out', 'boolean')
                        ('NewX_AVM_DE_IPTV_Provider', 'out', 'string')
                        ('NewX_AVM_DE_IPTV_URL', 'out', 'string')

Servicename:        WANCommonInterfaceConfig:1
Actionname:         GetCommonLinkProperties
                        ('NewLayer1DownstreamMaxBitRate', 'out', 'ui4')
                        ('NewLayer1UpstreamMaxBitRate', 'out', 'ui4')
                        ('NewPhysicalLinkStatus', 'out', 'string')
                        ('NewWANAccessType', 'out', 'string')
Actionname:         GetTotalBytesReceived
                        ('NewTotalBytesReceived', 'out', 'ui4')
Actionname:         GetTotalBytesSent
                        ('NewTotalBytesSent', 'out', 'ui4')
Actionname:         GetTotalPacketsReceived
                        ('NewTotalPacketsReceived', 'out', 'ui4')
Actionname:         GetTotalPacketsSent
                        ('NewTotalPacketsSent', 'out', 'ui4')
Actionname:         X_AVM-DE_GetOnlineMonitor
                        ('NewSyncGroupIndex', 'in', 'ui4')
                        ('NewSyncGroupMode', 'out', 'string')
                        ('NewSyncGroupName', 'out', 'string')
                        ('NewTotalNumberSyncGroups', 'out', 'ui4')
                        ('Newds_current_bps', 'out', 'string')
                        ('Newmax_ds', 'out', 'ui4')
                        ('Newmax_us', 'out', 'ui4')
                        ('Newmc_current_bps', 'out', 'string')
                        ('Newprio_default_bps', 'out', 'string')
                        ('Newprio_high_bps', 'out', 'string')
                        ('Newprio_low_bps', 'out', 'string')
                        ('Newprio_realtime_bps', 'out', 'string')
                        ('Newus_current_bps', 'out', 'string')
Actionname:         X_AVM-DE_SetWANAccessType
                        ('NewAccessType', 'in', 'string')

Failed to start Service, no module named 'influxdb_client'

When i start the script manually, everything works fine.

But when i start the service, following error appears:

Started Fritz to InfluxDB daemon.
fritzinfluxdb[16107]: Traceback (most recent call last):
fritzinfluxdb[16107]: File "/opt/fritzinfluxdb/fritzinfluxdb.py", line 27, in
fritzinfluxdb[16107]: from fritzinfluxdb.classes.influxdb.handler import InfluxHandler
fritzinfluxdb[16107]: File "/opt/fritzinfluxdb/fritzinfluxdb/classes/influxdb/handler.py", line 20, in
fritzinfluxdb[16107]: from influxdb_client.rest import ApiException
fritzinfluxdb[16107]: ModuleNotFoundError: No module named 'influxdb_client'
systemd[1]: fritzinfluxdb.service: Main process exited, code=exited, status=1/FAILURE
systemd[1]: fritzinfluxdb.service: Failed with result 'exit-code'.
systemd[1]: fritzinfluxdb.service: Scheduled restart job, restart counter is at 123.
systemd[1]: Stopped Fritz to InfluxDB daemon.

All requirements are installed, the OS is Raspbian 32 Bit.

Weitere DSL-Informationen

Hi,

da ich seit letzter Woche extreme Probleme mit dem DSL-Anschlus habe, ist bei mir auch das Thema Monitoring hochgekommen. Im Endeffekt war meine Idee genau dieses Projekt. Allerdings bräuchte ich die Daten die man unter "DSL Informationen" sieht. Vermutlich kriegt man die nur per Scraping. Hier gibt es auch schon ein Projekt dazu: https://github.com/yackx/fritz-dsl-mon

Information on the behavior of fritzinfluxdb-dashboard with Grafana 9.2

Hi,
I love this project and I love to play around, so I install fritzinfluxdb from next-release branch. And the Dashboard is imported to Grafana 9.1.6 all is fine, as you see:

grafik

But if I upgrade to Grafana 9.2 the same Dashboard ist corrupted, see next picture:

grafik

And with Grafana 9.2 it looks like the query is not finished:

grafik

I try to find more information or run Grafana with debug, but this can take some time.

kind regards
Bernd

Grafana: "InfluxDB Error: retention policy not found: autogen"

I set up Fritzinfluxdb, InfluxDB 2.4 and Grafana (latest tag at the time of writing) using Docker Compose. After getting another problem fixed (see #51) it now appears that FritzInfluxDB is actually filling my Influx DB - at least, I can poke at it using the query builder and actually get some values back. However, my Grafana Dashboards remain empty.

I made sure to add the InfluxQL source in Grafana with the Authorization Token and imported the dashboards from https://github.com/bb-Ricardo/fritzinfluxdb/tree/1fd5f80e195d9249e1bb9ca394b123c9b9252afa/grafana. Unfortunately, the dashboards remain empty:

grafik

Note the error message about the AnnotationQueryRunner - maybe this is the cause of the issue? I tried googling around, but could not find anything that got me forward with InfluxDB 2.4 relating to this error.

This issue appears to be similar in symptoms to #25 and #30. In #25 the cause was a Cable Fritz!Box - which is not the case for me, I'm on DSL. In #30 the solution was to use an updated Dashboard JSON, which I believe I am already doing.

What can I do to make Grafana display the data that is clearly there in InfluxDB?

ERROR: Failed to write to InfluxDB

Hi @bb-Ricardo

today I took a look into my fritzinfluxdb docker container log and saw the following

 2022-07-08 00:25:30,680 - ERROR: Failed to write to InfluxDB '192.168.178.34': HTTPConnectionPool(host='192.168.178.34', port=8086): Read timed out. (read timeout=2)
 2022-07-08 00:25:35,192 - INFO: Connection to influxDB '192.168.178.34' restored.
 2022-07-08 00:25:35,192 - INFO: Flushing '155' measurements to InfluxDB
 2022-07-08 09:36:14,102 - ERROR: Failed to write to InfluxDB '192.168.178.34': HTTPConnectionPool(host='192.168.178.34', port=8086): Read timed out. (read timeout=2)
 2022-07-08 09:36:19,309 - INFO: Connection to influxDB '192.168.178.34' restored.
 2022-07-08 09:36:19,310 - INFO: Flushing '163' measurements to InfluxDB
 2022-07-08 12:38:02,399 - ERROR: Failed to write to InfluxDB '192.168.178.34': HTTPConnectionPool(host='192.168.178.34', port=8086): Read timed out. (read timeout=2)
 2022-07-08 12:38:07,672 - INFO: Connection to influxDB '192.168.178.34' restored.
 2022-07-08 12:38:07,672 - INFO: Flushing '142' measurements to InfluxDB

The Influx container log is without any messages.

I saw, that I can manage the connection timeout for the FritzBox inside the ini file

# the maximum of time in seconds which a connection to the FritzBox is allowed to take
connect_timeout = 10

Do I also have the opportunity to set the read timeout for InfluxDB or is this not really a problem, because the collected data will flushed inside the DB?

Best Regards
Ronald

Follow Up on Issue #43

Could you please reopen the Issue #43 as I'm still have the Issue with Python 3.7.3:

pi@iobroker-pi:~ $ python --version
Python 3.7.3
pi@iobroker-pi:~ $ cd /opt/fritzinfluxdb/
pi@iobroker-pi:/opt/fritzinfluxdb $ ./fritzinfluxdb.py
2022-08-05 15:57:40,741 - INFO: Starting fritzinfluxdb v1.0.0 (2022-06-11)
2022-08-05 15:57:40,755 - INFO: Done reading config files
2022-08-05 15:57:41,128 - INFO: Successfully parsed config
2022-08-05 15:57:41,182 - INFO: Connection to InfluxDB 1.8.2 established and database present
2022-08-05 15:57:57,243 - INFO: Successfully established FritzBox TR-069 session
2022-08-05 15:57:58,063 - INFO: Successfully established FritzBox Lua session
2022-08-05 15:57:58,064 - INFO: Successfully connected to FritzBox '192.168.178.1' (fritz.box) Model: FRITZ!Box 7590 AX - FW: 7.31
2022-08-05 15:57:58,067 - INFO: Starting main loop
./fritzinfluxdb.py:141: RuntimeWarning: coroutine 'InfluxHandler.task_loop' was never awaited
task = loop.create_task(handler.task_loop(queue), name=handler.name)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
2022-08-05 15:57:58,081 - INFO: Closed FritzBox TR-069 connection
2022-08-05 15:57:58,083 - INFO: Closed FritzBox Lua connection
2022-08-05 15:57:58,085 - INFO: Closed InfluxDB session
2022-08-05 15:57:58,085 - INFO: Successfully shutdown fritzinfluxdb
Traceback (most recent call last):
File "./fritzinfluxdb.py", line 155, in
main()
File "./fritzinfluxdb.py", line 141, in main
task = loop.create_task(handler.task_loop(queue), name=handler.name)
TypeError: create_task() got an unexpected keyword argument 'name'

Thanks in Advance!

create_task() got an unexpected keyword argument 'name'

hi, how to fix this error?

Jul 2 01:11:09 raspberrypi fritzinfluxdb[21269]: /opt/fritzinfluxdb/fritzinfluxdb.py:141: RuntimeWarning: coroutine 'InfluxHandler.task_loop' was never awaited
Jul 2 01:11:09 raspberrypi fritzinfluxdb[21269]: task = loop.create_task(handler.task_loop(queue), name=handler.name)
Jul 2 01:11:09 raspberrypi fritzinfluxdb[21269]: RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Jul 2 01:11:09 raspberrypi fritzinfluxdb[21269]: Traceback (most recent call last):
Jul 2 01:11:09 raspberrypi fritzinfluxdb[21269]: File "/opt/fritzinfluxdb/fritzinfluxdb.py", line 155, in
Jul 2 01:11:09 raspberrypi fritzinfluxdb[21269]: main()
Jul 2 01:11:09 raspberrypi fritzinfluxdb[21269]: File "/opt/fritzinfluxdb/fritzinfluxdb.py", line 141, in main
Jul 2 01:11:09 raspberrypi fritzinfluxdb[21269]: task = loop.create_task(handler.task_loop(queue), name=handler.name)
Jul 2 01:11:09 raspberrypi fritzinfluxdb[21269]: TypeError: create_task() got an unexpected keyword argument 'name'

not able to start docker file

Hi Ricardo, hi all

I'm new in Linux and also in Docker and face a problem with the Docker file I created...

First I tried to install your script in the virtual environment on my pc without any problem. Afterwards I tried to use the docker way, because I want to use it on a Raspberry PI in combination with a influx/grafana docker container. This container is running well...

I used the way you described:

ronald@buster:/opt$ sudo git clone https://github.com/yunity/fritzinfluxdb.git
Klone nach 'fritzinfluxdb' ...
remote: Enumerating objects: 144, done.
remote: Total 144 (delta 0), reused 0 (delta 0), pack-reused 144
Empfange Objekte: 100% (144/144), 130.37 KiB | 185.00 KiB/s, Fertig.
Löse Unterschiede auf: 100% (80/80), Fertig.
ronald@buster:/opt$ cd fritzinfluxdb
ronald@buster:/opt/fritzinfluxdb$ docker build -t fritzinfluxdb .
Sending build context to Docker daemon 406kB
:
:
Step 5/5 : CMD [ "python", "./fritzinfluxdb.py" ]
---> Running in df9377423fcf
Removing intermediate container df9377423fcf
---> c7f51a4cec46
Successfully built c7f51a4cec46
Successfully tagged fritzinfluxdb:latest

Then I modified the fritzinfluxdb.ini and saved it in my home directory... I have two copies... fritzinfluxdb.ini and my-fritzinfluxdb.ini

If I now start the container with

ronald@buster:/opt/fritzinfluxdb$ docker run -d -v /home/ronald/fritzbox/my-fritzinfluxdb.ini:/app/idefault.ini --name fritzinfluxdb fritzinfluxdb or
ronald@buster:/opt/fritzinfluxdb$ docker run -d -v /home/ronald/fritzbox/fritzinfluxdb.ini:/app/idefault.ini --name fritzinfluxdb fritzinfluxdb

and then take a look into the logs, I get this message:

ronald@buster:/opt/fritzinfluxdb$ docker container logs --details fritzinfluxdb
2021-01-13 08:14:29,435 - ERROR: Config file "./fritzinfluxdb.ini" not found

Even with my-fritzinfluxdb.ini or fritzinfluxdb.ini

The only thing, what happen is, that I got two folder (my-fritzinfluxdb.ini or fritzinfluxdb.ini) in /home/ronald/fritzbox

Now is the question, what I have to change, that I get it running... Hope you or someone have a clue or idea what I have to do...

Thanks a lot in advanced
Ronald

Influx field type conflic

Hi, I have the issue that the script is not working because an influx fiel type conflict:

{"error":"partial write: field type conflict: input field "passive_hosts_name" on measurement "fritzbox" is type integer, already exists as type string dropped=1"}

Is there any workaround to solve this?

Thanks a lot

INFO: Requested invalid action 'GetInfo' for service: WANIPConnection:1

Using a fritzbox 7490 with fritzOS 7.29

Recently came across this service after stumbling across fritzcollectd.

Managed to set it up just fine but a bunch of panels in the grafana dashboard end up empty.

The log notes the message in the title, followed by

INFO: Requested invalid action 'GetInfo' for service: WANIPConnection:1
INFO: Querying action 'GetInfo' will be disabled
INFO: All actions for service 'WANIPConnection:1' are unavailable. Disabling service.

After inspecting the dashboard further and checking the data that gets stored in the influxdb, it looks like the empty panels require data which would normally be fetched from the WANIPConnection interface, explaining why it doesnt show up.

I checked the XML that the box supplies manually and it does list a GetInfo for WANIPConnection.

Are there any known incompatibilities with the 7490 or 7.29?

Issue with VPNUser data in 'wrong' format.

I'm using a Fritz!Box 7520 with Fritz!OS 7.29. I've tried with fritzinfluxdb master and next-release (as of the time of writing), both show the same error.

Fritzinfluxdb can connect to the FritzBox:

fritzinfluxdb  | 2022-09-16 18:14:26,803 - INFO: Successfully established FritzBox Lua session
fritzinfluxdb  | 2022-09-16 18:14:26,804 - ERROR: Initializing connection to InfluxDB failed
fritzinfluxdb exited with code 1
fritzinfluxdb  | 2022-09-16 18:14:27,911 - INFO: Starting fritzinfluxdb v1.0.1 (2022-08-22)
fritzinfluxdb  | 2022-09-16 18:14:27,939 - INFO: Successfully parsed config
fritzinfluxdb  | 2022-09-16 18:14:27,946 - INFO: Connection to InfluxDB v2.4.0 established and bucket is present
fritzinfluxdb  | 2022-09-16 18:14:29,471 - INFO: Successfully established FritzBox TR-069 session
fritzinfluxdb  | 2022-09-16 18:14:29,853 - INFO: Successfully established FritzBox Lua session
fritzinfluxdb  | 2022-09-16 18:14:29,853 - INFO: Successfully connected to FritzBox '192.168.178.1' (fritz.box) Model: FRITZ!Box 7520 (UI) - FW: 7.29
fritzinfluxdb  | 2022-09-16 18:14:29,854 - INFO: Starting main loop

But it cannot read any data (REDACTED added by me):

fritzinfluxdb  | 2022-09-16 18:14:30,529 - INFO: Requested invalid action 'GetInfo' for service: WANIPConnection:1
fritzinfluxdb  | 2022-09-16 18:14:30,529 - INFO: Querying action 'GetInfo' will be disabled
fritzinfluxdb  | 2022-09-16 18:14:30,529 - INFO: All actions for service 'WANIPConnection:1' are unavailable. Disabling service.
fritzinfluxdb  | 2022-09-16 18:14:41,651 - ERROR: FritzBox metric type '<class 'dict'>' does not match data: <class 'list'>
fritzinfluxdb  | 2022-09-16 18:14:41,651 - ERROR: FritzBox metric type '<class 'dict'>' does not match data: <class 'list'>
fritzinfluxdb  | 2022-09-16 18:14:41,651 - ERROR: FritzBox metric type '<class 'dict'>' does not match data: <class 'list'>
fritzinfluxdb  | 2022-09-16 18:14:41,651 - ERROR: FritzBox metric type '<class 'dict'>' does not match data: <class 'list'>
fritzinfluxdb  | 2022-09-16 18:14:41,652 - ERROR: Unable to extract 'None' form '{'pid': 'shareVpn', 'hide': {'faxSet': True, 'shareUsb': True, 'ssoSet': True, 'liveTv': True}, 'time': [], 'data': {'vpnInfo': {'userConnections': [], 'type': 'IPSec Xauth PSK', 'help': {'url': 'https://www.avm.de/service/vpn', 'text': 'www.avm.de/service/vpn'}, 'boxConnections': [], 'server': 'REDACTED.myfritz.net'}}, 'sid': 'REDACTED'}', got '<class 'NoneType'>'

Everything starting from FritzBox metric type '<class 'dict'>' does not match data: <class 'list'> will repeat in the log indefinitely.

I found the same problem mentioned in #42, but I'm not using a beta firmware and using next-release didn't do anything for me, so I'm stumped.

What do I need to do to fix getting data from my Fritz!Box?

docker build ended with Fatal Python error

Hi Ricardo

After long time I had to rebuild fritzinfluxdb on my Pi and faced the following error, when I build the docker image.
Do you have any idea, why this happen?

Cheers
Ronald

pi@raspberrypi:/opt/fritzinfluxdb $ sudo docker build -t fritzinflux .
Sending build context to Docker daemon 441.3kB
Step 1/5 : FROM python:3.6-slim
---> 1a50a9863f2d
Step 2/5 : WORKDIR /app
---> Running in 969e024847c7
Removing intermediate container 969e024847c7
---> 591969feae3a
Step 3/5 : COPY . /app
---> d68c8219b413
Step 4/5 : RUN pip install --trusted-host pypi.python.org -r requirements.txt
---> Running in 2da3792dfc98
**Fatal Python error: Py_Initialize: can't initialize time
PermissionError: [Errno 1] Operation not permitted

Current thread 0xb6fc8010 (most recent call first):
Aborted (core #dumped)
The command '/bin/sh -c pip install --trusted-host pypi.python.org -r requirements.txt' returned a non-zero code: 134**

Enhance config handling

  • create classes for fritzbox config and influx config
  • support reading env vars for fritzbox and influx sections

InfluxDb 2 connection failed

hi to all, i have an issue tryng to use the script.
i've implemented a containerazed solution with a influxdb and monitor collector containeri
when i try o run python3 fritzinfluxdb.py -v
i receive this message:

2022-10-14 21:24:30,742 - INFO: Starting fritzinfluxdb v1.0.1 (2022-08-22)
2022-10-14 21:24:30,742 - DEBUG: Config: influxdb.version = 2
2022-10-14 21:24:30,742 - DEBUG: Config: influxdb.hostname = http://influxdb
2022-10-14 21:24:30,742 - DEBUG: Config: influxdb.port = 8086
2022-10-14 21:24:30,742 - DEBUG: Config: influxdb.tls_enabled = False
2022-10-14 21:24:30,743 - DEBUG: Config: influxdb.verify_tls = False
2022-10-14 21:24:30,743 - DEBUG: Config: influxdb.measurement_name = fritzbox
2022-10-14 21:24:30,743 - DEBUG: Config: influxdb.username = None
2022-10-14 21:24:30,743 - DEBUG: Config: influxdb.password = None
2022-10-14 21:24:30,743 - DEBUG: Config: influxdb.database = None
2022-10-14 21:24:30,743 - DEBUG: Config: influxdb.token = xxx
2022-10-14 21:24:30,743 - DEBUG: Config: influxdb.organisation = HOME
2022-10-14 21:24:30,743 - DEBUG: Config: influxdb.bucket = fritxbox
2022-10-14 21:24:30,744 - DEBUG: Config: fritzbox.hostname = 192.168.xxx.x
2022-10-14 21:24:30,744 - DEBUG: Config: fritzbox.username = xxx
2022-10-14 21:24:30,745 - DEBUG: Config: fritzbox.password = xxx
2022-10-14 21:24:30,745 - DEBUG: Config: fritzbox.port = 49000
2022-10-14 21:24:30,745 - DEBUG: Config: fritzbox.tls_enabled = False
2022-10-14 21:24:30,745 - DEBUG: Config: fritzbox.verify_tls = False
2022-10-14 21:24:30,745 - DEBUG: Config: fritzbox.connect_timeout = 10
2022-10-14 21:24:30,745 - DEBUG: Config: fritzbox.request_interval = 10
2022-10-14 21:24:30,745 - DEBUG: Config: fritzbox.box_tag = fritz.box
2022-10-14 21:24:30,745 - DEBUG: Config: fritzbox.timezone = Europe/Berlin
2022-10-14 21:24:30,753 - INFO: Successfully parsed config
2022-10-14 21:24:30,757 - ERROR: Failed to connect to InfluxDB: <urllib3.connection.HTTPConnection object at 0x7fce2a058370>: Failed to establish a new connection: [Errno -2] Name or service not known
2022-10-14 21:24:30,757 - DEBUG: Initiating new FritzBox TR-069 session
2022-10-14 21:24:32,136 - INFO: Successfully established FritzBox TR-069 session
2022-10-14 21:24:32,136 - DEBUG: Initiating new FritzBox Lua session
2022-10-14 21:24:32,673 - INFO: Successfully established FritzBox Lua session
2022-10-14 21:24:32,673 - ERROR: Initializing connection to InfluxDB failed

i've check host and token and are all good, any idea to help me?

Regard

ERROR: Unable to extract 'data.connectionData.externApValue

Hi, when running the script, I am facing 2 error messages:

ERROR: Unable to extract 'data.connectionData.externApValue
ERROR: Unable to extract 'data.connectionData.version

Nevertheless the InfluxDB is filled with data.

This is the full log:

2022-08-20 14:54:23,149 - INFO: Starting fritzinfluxdb v1.0.0 (2022-06-11)
2022-08-20 14:54:23,150 - INFO: Done reading config files
2022-08-20 14:54:23,196 - INFO: Successfully parsed config
2022-08-20 14:54:23,204 - INFO: Connection to InfluxDB 1.8.6 established and database present
2022-08-20 14:54:24,240 - INFO: Successfully established FritzBox TR-069 session
2022-08-20 14:54:24,383 - INFO: Successfully established FritzBox Lua session
2022-08-20 14:54:24,383 - INFO: Successfully connected to FritzBox '192.168.111.1' (fritz.box) Model: FRITZ!Box 6591 Cable (kdg) - FW: 7.29
2022-08-20 14:54:24,385 - INFO: Starting main loop
2022-08-20 14:54:24,386 - INFO: Requested invalid service: WANCommonIFC
2022-08-20 14:54:24,386 - INFO: Querying service 'WANCommonIFC' will be disabled
2022-08-20 14:54:24,386 - INFO: Requested invalid service: WANIPConn
2022-08-20 14:54:24,386 - INFO: Querying service 'WANIPConn' will be disabled
2022-08-20 14:54:24,603 - INFO: Requested invalid action 'GetInfo' for service: WANDSLInterfaceConfig
2022-08-20 14:54:24,603 - INFO: Querying action 'GetInfo' will be disabled
2022-08-20 14:54:24,615 - INFO: Requested invalid action 'GetStatisticsTotal' for service: WANDSLInterfaceConfig
2022-08-20 14:54:24,615 - INFO: Querying action 'GetStatisticsTotal' will be disabled
2022-08-20 14:54:24,627 - INFO: Requested invalid action 'X_AVM-DE_GetDSLInfo' for service: WANDSLInterfaceConfig
2022-08-20 14:54:24,628 - INFO: Querying action 'X_AVM-DE_GetDSLInfo' will be disabled
2022-08-20 14:54:24,628 - INFO: All actions for service 'WANDSLInterfaceConfig' are unavailable. Disabling service.
2022-08-20 14:54:24,681 - INFO: Requested invalid action 'GetInfo' for service: WANPPPConnection:1
2022-08-20 14:54:24,682 - INFO: Querying action 'GetInfo' will be disabled
2022-08-20 14:54:24,682 - INFO: All actions for service 'WANPPPConnection:1' are unavailable. Disabling service.
2022-08-20 14:54:31,595 - INFO: Unable to request FritzBox Lua service 'DSL Info'
2022-08-20 14:54:31,595 - INFO: FritzBox Lua service 'DSL Info' will be disabled.
2022-08-20 14:54:31,820 - ERROR: Unable to extract 'data.connectionData.externApValue' form '{'pid': 'docOv', 'hide': {'shareUsb': True, 'liveTv': True, 'tvsd': True, 'dvbSet': True, 'mobile': True, 'tvhd': True, 'ssoSet': True, 'dvbSig': True, 'dvbradio': True}, 'time': [], 'data': {'connectionData': {'frequencyScantext': 'Verbindungsaufbau läuft... Dieser Vorgang kann je nach Anschluss bis zu 5 Minuten dauern.', 'debugidx': 0, 'fullLine': False, 'dsCount': 32, 'usCount': 4, 'isDebug': False, 'externAPHeader': 'Kopfstelle (CMTS)', 'dsCountSecond': 1, 'line': [{'state': 'ready', 'timePrefix': 'Verbindungsdauer:', 'trainState': 'aktiv', 'mode': 'DOCSIS 3.0 und DOCSIS 3.1', 'trainStatePrefix': 'Kabel-Internet:', 'time': '288 Stunden 44 Minuten 55 Sekunden'}], 'usCountSecond': 1, 'showCableImg': True, 'usFreqs': {'max': 85, 'values': {'docsis3_1': [[29, 64]], 'docsis3_0': [51, 30, 37, 44]}, 'min': 5}, 'dsRate': '1150 Mbit/s', 'usRate': '56,7 Mbit/s', 'dsFreqs': {'max': 1218, 'values': {'docsis3_1': [[151, 324]], 'docsis3_0': [642, 114, 130, 138, 146, 602, 618, 626, 650, 658, 666, 674, 682, 690, 698, 706, 714, 722, 730, 738, 746, 754, 762, 770, 778, 786, 794, 802, 810, 818, 826, 834]}, 'min': 108}}}, 'sid': 'bfb40e062f09c063'}', got '<class 'NoneType'>'
2022-08-20 14:54:31,821 - ERROR: Unable to extract 'data.connectionData.version' form '{'pid': 'docOv', 'hide': {'shareUsb': True, 'liveTv': True, 'tvsd': True, 'dvbSet': True, 'mobile': True, 'tvhd': True, 'ssoSet': True, 'dvbSig': True, 'dvbradio': True}, 'time': [], 'data': {'connectionData': {'frequencyScantext': 'Verbindungsaufbau läuft... Dieser Vorgang kann je nach Anschluss bis zu 5 Minuten dauern.', 'debugidx': 0, 'fullLine': False, 'dsCount': 32, 'usCount': 4, 'isDebug': False, 'externAPHeader': 'Kopfstelle (CMTS)', 'dsCountSecond': 1, 'line': [{'state': 'ready', 'timePrefix': 'Verbindungsdauer:', 'trainState': 'aktiv', 'mode': 'DOCSIS 3.0 und DOCSIS 3.1', 'trainStatePrefix': 'Kabel-Internet:', 'time': '288 Stunden 44 Minuten 55 Sekunden'}], 'usCountSecond': 1, 'showCableImg': True, 'usFreqs': {'max': 85, 'values': {'docsis3_1': [[29, 64]], 'docsis3_0': [51, 30, 37, 44]}, 'min': 5}, 'dsRate': '1150 Mbit/s', 'usRate': '56,7 Mbit/s', 'dsFreqs': {'max': 1218, 'values': {'docsis3_1': [[151, 324]], 'docsis3_0': [642, 114, 130, 138, 146, 602, 618, 626, 650, 658, 666, 674, 682, 690, 698, 706, 714, 722, 730, 738, 746, 754, 762, 770, 778, 786, 794, 802, 810, 818, 826, 834]}, 'min': 108}}}, 'sid': 'bfb40e062f09c063'}', got '<class 'NoneType'>'

What is causing this error?
Regards,
Torsten

Getting error FritzBox metric type

Hi,
i installed this today and when i perform ./fritzinfluxdb.py i get the follwing outpu

2022-09-24 14:26:21,584 - INFO: Starting fritzinfluxdb v1.0.1 (2022-08-22)
2022-09-24 14:26:21,585 - INFO: Done reading config files
2022-09-24 14:26:21,638 - INFO: Successfully parsed config
2022-09-24 14:26:21,651 - INFO: Connection to InfluxDB v2.4.0 established and bucket is present
2022-09-24 14:26:26,511 - INFO: Successfully established FritzBox TR-069 session
2022-09-24 14:26:29,064 - INFO: Successfully established FritzBox Lua session
2022-09-24 14:26:29,064 - INFO: Successfully connected to FritzBox '192.168.112.1' (fritz.box) Model: FRITZ!Box 7590 - FW: 7.39
2022-09-24 14:26:29,064 - INFO: Starting main loop
2022-09-24 14:26:30,047 - INFO: Requested invalid action 'GetInfo' for service: WANPPPConnection:1
2022-09-24 14:26:30,047 - INFO: Querying action 'GetInfo' will be disabled
2022-09-24 14:26:30,047 - INFO: All actions for service 'WANPPPConnection:1' are unavailable. Disabling service.
2022-09-24 14:26:39,112 - ERROR: FritzBox metric type '<class 'dict'>' does not match data: <class 'list'>
2022-09-24 14:26:39,112 - ERROR: FritzBox metric type '<class 'dict'>' does not match data: <class 'list'>
2022-09-24 14:26:39,112 - ERROR: FritzBox metric type '<class 'dict'>' does not match data: <class 'list'>
2022-09-24 14:26:39,112 - ERROR: FritzBox metric type '<class 'dict'>' does not match data: <class 'list'>
2022-09-24 14:26:42,165 - INFO: Unable to request FritzBox Lua service 'DSL Info'
2022-09-24 14:26:42,166 - INFO: FritzBox Lua service 'DSL Info' will be disabled.
2022-09-24 14:26:44,822 - INFO: Unable to request FritzBox Lua service 'Cable Info'
2022-09-24 14:26:44,822 - INFO: FritzBox Lua service 'Cable Info' will be disabled.
2022-09-24 14:26:50,574 - ERROR: FritzBox metric type '<class 'dict'>' does not match data: <class 'list'>
2022-09-24 14:26:50,574 - ERROR: FritzBox metric type '<class 'dict'>' does not match data: <class 'list'>
2022-09-24 14:26:50,575 - ERROR: FritzBox metric type '<class 'dict'>' does not match data: <class 'list'>
2022-09-24 14:26:50,575 - ERROR: FritzBox metric type '<class 'dict'>' does not match data: <class 'list'>

Maybe someone can explain what this means

Make grafana dashboard datasource configurable

I just setup your scripts. Seems to work fine, but it took me longer than I like to admit to connect it to the correct data source in grafana. An option to directly select that would be great.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.