fetzerch / fritzcollectd

A collectd plugin for monitoring AVM FRITZ!Box routers
MIT License
132 stars 30 forks source link

collectd fails to start with fritzcollectd #49

Open Marko-fin opened 4 years ago

Marko-fin commented 4 years ago

Hi,

had lot of issues first with lxml importing etree...finally updated fritzconnection to latest 1.2.1...but no I am stuck still collectd to start, here is error message

Jun 20 23:59:15 raspberrypi collectd[20588]: plugin_load: plugin "users" successfully loaded. Jun 20 23:59:15 raspberrypi collectd[20588]: python plugin: Error importing module "fritzcollectd". Jun 20 23:59:15 raspberrypi collectd[20588]: Unhandled python exception in importing module: SyntaxError: invalid syntax (fritzconnection.py, line 109) Jun 20 23:59:15 raspberrypi collectd[20588]: Traceback (most recent call last): Jun 20 23:59:15 raspberrypi collectd[20588]: File "/usr/local/lib/python3.7/dist-packages/fritzcollectd/init.py", line 28, in import fritzconnection Jun 20 23:59:15 raspberrypi collectd[20588]: File "/usr/local/lib/python3.7/dist-packages/fritzconnection/init.py", line 2, in from .core.fritzconnection import FritzConnection Jun 20 23:59:15 raspberrypi collectd[20588]: File "/usr/local/lib/python3.7/dist-packages/fritzconnection/core/fritzconnection.py", line 109 Jun 20 23:59:15 raspberrypi collectd[20588]: Error: Reading the config file failed! Jun 20 23:59:15 raspberrypi collectd[20588]: Read the logs for details. Jun 20 23:59:15 raspberrypi collectd[20588]: source = f'{address}:{port}/{description}' Jun 20 23:59:15 raspberrypi collectd[20588]: ^ Jun 20 23:59:15 raspberrypi collectd[20588]: SyntaxError: invalid syntax Jun 20 23:59:15 raspberrypi collectd[20588]: python plugin: Found a configuration for the "fritzcollectd" plugin, but the plugin isn't loaded or didn't regi Jun 20 23:59:15 raspberrypi systemd[1]: collectd.service: Main process exited, code=exited, status=1/FAILURE

pi@raspberrypi:/usr/local/lib/python3.7/dist-packages/fritzcollectd $ pip3 list Package Version


fritzcollectd 0.7.0 fritzconnection 1.2.1

I dont find anything wrong on informed file (but I am not python expert).

collectd.conf

Globals true ModulePath "/usr/local/lib/python3.7/dist-packages" ModulePath "/usr/lib/python3/dist-packages" LogTraces true # Interactive true # Import "spam" # # # spam "wonderful" "lovely" # Import "fritzcollectd" Address "#########" Port 49000 User "collectd" Passwort "#########" Hostname "FritzBox" Instance "1" Verbose "False"

fritzconnection seems to work from command line.

pi@raspberrypi:/usr/local/lib/python3.7/dist-packages $ fritzstatus --password ###########

FritzConnection v1.2.1 FritzStatus for FRITZ!Box 6590 Cable at http://169.254.1.1 FRITZ!OS: 7.12:

is linked           : True
is connected        : True
external ip (v4)    : ##########
external ip (v6)    : ###########
uptime              : 35:12:23
bytes send          : 454815199
bytes received      : 1469321703
max. bit rate       : ('42.0 MBit/s', '100.0 MBit/s')

pi@raspberrypi:/usr/local/lib/python3.7/dist-packages $ fritzconnection -s -i ##########

FritzConnection v1.2.1 FRITZ!Box 6590 Cable at http://########### FRITZ!OS: 7.12 Servicenames: any1 WANCommonIFC1 WANDSLLinkC1 WANIPConn1 WANIPv6Firewall1 DeviceInfo1 DeviceConfig1 Layer3Forwarding1 LANConfigSecurity1 ManagementServer1 Time1 UserInterface1 X_AVM-DE_Storage1 X_AVM-DE_WebDAVClient1 X_AVM-DE_UPnP1 X_AVM-DE_Speedtest1 X_AVM-DE_RemoteAccess1 X_AVM-DE_MyFritz1 X_VoIP1 X_AVM-DE_OnTel1 X_AVM-DE_Dect1 X_AVM-DE_TAM1 X_AVM-DE_AppSetup1 X_AVM-DE_Homeauto1 X_AVM-DE_Homeplug1 X_AVM-DE_Filelinks1 X_AVM-DE_Auth1 WLANConfiguration1 WLANConfiguration2 WLANConfiguration3 Hosts1 LANEthernetInterfaceConfig1 LANHostConfigManagement1 WANCommonInterfaceConfig1 WANDSLInterfaceConfig1 WANDSLLinkConfig1 WANEthernetLinkConfig1 WANPPPConnection1 WANIPConnection1

Marko-fin commented 4 years ago

It looks like some kind of issue with python versions compatibility....perhaps....I have 2.7.x and 3.7.x installed python3/stable,now 3.7.3-1 armhf [installed] python/stable,now 2.7.16-1 armhf [installed]

Marko-fin commented 4 years ago

I tried to change those f-string modifiers to eg. '{}{}'.format(param1, param2) style and then it worked, also there was def woth only "*" parameter, that is also not probably accepted 2.x python....but there are just too much to modify all?

crazycusti commented 3 years ago

"Collecting fritzconnection<1.0.0,>=0.8.0"

use fritzconnection 0.8.5, your version is to new.