Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to start Service, no module named 'influxdb_client' #49

Closed
bcsti opened this issue Sep 7, 2022 · 14 comments
Closed

Failed to start Service, no module named 'influxdb_client' #49

bcsti opened this issue Sep 7, 2022 · 14 comments
Milestone

Comments

@bcsti
Copy link

bcsti commented Sep 7, 2022

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.

@bb-Ricardo
Copy link
Owner

Hi,

It seems the virtual environment where you installed the dependencies can't be found.

Did you use the service file provided?

@bcsti
Copy link
Author

bcsti commented Sep 7, 2022

Hi,

Yes, the file provided.
i used following commands:

sudo apt install influxdb
sudo apt install python3-pip
pip install fritzconnection
sudo apt install virtualenv python3-lxml git
cd /opt
sudo git clone https://github.com/yunity/fritzinfluxdb.git
cd fritzinfluxdb
sudo virtualenv --system-site-packages -p python3 .venv
. .venv/bin/activate
pip3 install -r requirements.txt
sudo cp /opt/fritzinfluxdb/fritzinfluxdb.service /etc/systemd/system
sudo systemctl daemon-reload
sudo systemctl start fritzinfluxdb
sudo systemctl enable fritzinfluxdb
sudo pip3 install fritzconnection
sudo pip3 install influxdb

@bb-Ricardo
Copy link
Owner

This probably won't work dou to the sudo commands used. Did you try changing to a root shell and use the commands in the Readme?

@bcsti
Copy link
Author

bcsti commented Sep 8, 2022

Thanks for the info, it works!
I left the script running, but in grafana no system information is shown (logs, CPU, hosts, IP address, ram, energy, ...), only traffic info. What could be the problem?

@todrees1967
Copy link

Try to restart the script. I had a similar issue here, due to an outage of the cable internet I have restrted my fritz box and from that time the script couldn't fetch data. Check the logs from fritz box, you might see error messages there as well.

@bb-Ricardo
Copy link
Owner

You can also try to set the log level to DEBUG. There it should print out all the values parsed and sent to influx.

@bcsti
Copy link
Author

bcsti commented Sep 8, 2022

Oh, it looks like my FRITZ!OS version is not supported. I have a FRITZ!Box 7530 AX with FRITZ!OS 07.31

2022-09-08 17:45:51,173 - DEBUG: FritzOS version 7.31 not in list of supported versions for System Stats: ['7.29', '7.39']
2022-09-08 17:45:51,173 - DEBUG: FritzOS version 7.31 not in list of supported versions for Energy Stats: ['7.29', '7.39']
2022-09-08 17:45:51,173 - DEBUG: FritzOS version 7.31 not in list of supported versions for System logs: ['7.29']
2022-09-08 17:45:51,173 - DEBUG: FritzOS version 7.31 not in list of supported versions for System logs: ['7.39']
2022-09-08 17:45:51,174 - DEBUG: FritzOS version 7.31 not in list of supported versions for Internet connection logs: ['7.29']
2022-09-08 17:45:51,174 - DEBUG: FritzOS version 7.31 not in list of supported versions for Internet connection logs: ['7.39']
2022-09-08 17:45:51,174 - DEBUG: FritzOS version 7.31 not in list of supported versions for Telephony logs: ['7.29']
2022-09-08 17:45:51,174 - DEBUG: FritzOS version 7.31 not in list of supported versions for Telephony logs: ['7.39']
2022-09-08 17:45:51,174 - DEBUG: FritzOS version 7.31 not in list of supported versions for WLAN logs: ['7.29']
2022-09-08 17:45:51,175 - DEBUG: FritzOS version 7.31 not in list of supported versions for WLAN logs: ['7.39']
2022-09-08 17:45:51,175 - DEBUG: FritzOS version 7.31 not in list of supported versions for USB Devices logs: ['7.29']
2022-09-08 17:45:51,175 - DEBUG: FritzOS version 7.31 not in list of supported versions for USB Devices logs: ['7.39']
2022-09-08 17:45:51,175 - DEBUG: FritzOS version 7.31 not in list of supported versions for Active network hosts: ['7.29', '7.39']
2022-09-08 17:45:51,175 - DEBUG: FritzOS version 7.31 not in list of supported versions for Passive network hosts: ['7.29', '7.39']
2022-09-08 17:45:51,176 - DEBUG: FritzOS version 7.31 not in list of supported versions for VPN Users: ['7.29']
2022-09-08 17:45:51,176 - DEBUG: FritzOS version 7.31 not in list of supported versions for VPN Users: ['7.39']
2022-09-08 17:45:51,176 - DEBUG: FritzOS version 7.31 not in list of supported versions for DSL Info: ['7.29', '7.39']
2022-09-08 17:45:51,176 - DEBUG: FritzOS version 7.31 not in list of supported versions for Cable Info: ['7.29', '7.39']

@bb-Ricardo
Copy link
Owner

Ui, was not aware of 7.30 nor 7.31. Just add 7.31 to all services which have 7.29 in this file: https://github.com/bb-Ricardo/fritzinfluxdb/blob/master/fritzinfluxdb/classes/fritzbox/services_lua.py

let me know if it works or where it throws issues. Then I can officially add it to repo. Thant would be awesome.
thank you.

@bcsti
Copy link
Author

bcsti commented Sep 8, 2022

Yeah, everything works fine now, only the IP-Information is missing. (But i dont know if it works at all)
grafik

FYI, this are the current versions for Cable and DSL:

grafik

@bcsti
Copy link
Author

bcsti commented Sep 8, 2022

Here is the log:

2022-09-08 18:29:53,487 - DEBUG: FritzBox Lua request successful
2022-09-08 18:29:53,487 - DEBUG: Request FritzBox Lua service 'System Stats' returned successfully
2022-09-08 18:29:53,787 - DEBUG: FritzBox Lua request successful
2022-09-08 18:29:53,788 - DEBUG: Request FritzBox Lua service 'Energy Stats' returned successfully
2022-09-08 18:29:54,189 - DEBUG: FritzBox Lua request successful
2022-09-08 18:29:54,190 - DEBUG: Request FritzBox Lua service 'System logs' returned successfully
2022-09-08 18:29:54,236 - DEBUG: FritzOS version 7.31 not in list of supported versions for System logs: ['7.39']
2022-09-08 18:29:54,526 - DEBUG: FritzBox Lua request successful
2022-09-08 18:29:54,526 - DEBUG: Request FritzBox Lua service 'Internet connection logs' returned successfully
2022-09-08 18:29:54,528 - DEBUG: FritzOS version 7.31 not in list of supported versions for Internet connection logs: ['7.39']
2022-09-08 18:29:54,832 - DEBUG: FritzBox Lua request successful
2022-09-08 18:29:54,832 - DEBUG: Request FritzBox Lua service 'Telephony logs' returned successfully
2022-09-08 18:29:54,832 - DEBUG: FritzOS version 7.31 not in list of supported versions for Telephony logs: ['7.39']
2022-09-08 18:29:55,125 - DEBUG: FritzBox Lua request successful
2022-09-08 18:29:55,126 - DEBUG: Request FritzBox Lua service 'WLAN logs' returned successfully
2022-09-08 18:29:55,128 - DEBUG: FritzOS version 7.31 not in list of supported versions for WLAN logs: ['7.39']
2022-09-08 18:29:55,405 - DEBUG: FritzBox Lua request successful
2022-09-08 18:29:55,406 - DEBUG: Request FritzBox Lua service 'USB Devices logs' returned successfully
2022-09-08 18:29:55,406 - DEBUG: FritzOS version 7.31 not in list of supported versions for USB Devices logs: ['7.39']
2022-09-08 18:29:55,911 - DEBUG: FritzBox Lua request successful
2022-09-08 18:29:55,912 - DEBUG: Request FritzBox Lua service 'Active network hosts' returned successfully
2022-09-08 18:29:56,414 - DEBUG: FritzBox Lua request successful
2022-09-08 18:29:56,415 - DEBUG: Request FritzBox Lua service 'Passive network hosts' returned successfully
2022-09-08 18:29:56,659 - DEBUG: FritzBox Lua request successful
2022-09-08 18:29:56,660 - DEBUG: Request FritzBox Lua service 'VPN Users' returned successfully
2022-09-08 18:29:56,662 - DEBUG: FritzOS version 7.31 not in list of supported versions for VPN Users: ['7.39']
2022-09-08 18:29:57,419 - DEBUG: FritzBox Lua request successful
2022-09-08 18:29:57,419 - DEBUG: Request FritzBox Lua service 'DSL Info' returned successfully
2022-09-08 18:29:58,407 - DEBUG: FritzBox Lua request successful
2022-09-08 18:29:58,408 - INFO: Unable to request FritzBox Lua service 'Cable Info'
2022-09-08 18:29:58,408 - INFO: FritzBox Lua service 'Cable Info' will be disabled.

@bb-Ricardo
Copy link
Owner

Yeah, everything works fine now, only the IP-Information is missing. (But i dont know if it works at all) grafik

FYI, this are the current versions for Cable and DSL:

grafik

The IP addresses should be provided via TR69 protocol.

Where did you get this neat overview of FritzBox models and their versions?

@bcsti
Copy link
Author

bcsti commented Sep 10, 2022

I have the protocol activated.

Screenshot_20220909-221440~2

The overview is a text file I made as a comparison for my fritzbox and updated for you. The info comes from the AVM website.

@bb-Ricardo
Copy link
Owner

I added the versions to the next-release branch. would you mind testing it and see if it works as expected?

Thank you

@bb-Ricardo bb-Ricardo added this to the 1.1 milestone Sep 23, 2022
@bcsti
Copy link
Author

bcsti commented Sep 24, 2022

I have tested the next-release branch and had no issues so far. Good job!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants