shinken-monitoring / mod-webui

Shinken Web User Interface
GNU Affero General Public License v3.0
79 stars 71 forks source link

Cannot import webui2..module : invalid syntax line 92 #626

Closed plat00n closed 5 years ago

plat00n commented 6 years ago

Hello,

I'm trying to install Shinken-2.4.3 on a Centos 6 which cannot access to the web. My python version is : Python 2.6.6

To start : I can't upgrade the os and I can't install python 2.7 (constraints)

Webui2 can't be started, I have this error message :

ERROR: [broker-master] Could not import bare 'module.py' from /var/lib/shinken/modules/webui2 : invalid syntax (connectionpool.py, line 92

Here is what i have installed :

sudo pip install Shinken-2.4.3.tar.gz
sudo pip install bottle-0.12.8.tar.gz
sudo pip install pymongo-3.7.2.tar.gz
sudo pip install chardet-3.0.4.tar.gz
sudo pip install idna-2.7.tar.gz
sudo pip install urllib3-1.24.tar.gz
sudo pip install certifi-2018.10.15.tar.gz
sudo pip install requests-2.20.0.tar.gz
sudo pip install passlib-1.7.1.tar.gz
sudo pip install six-1.11.0.tar.gz
sudo pip install arrow-0.12.1.tar.gz
sudo pip install python-dateutil-2.6.1.tar.gz

Here is the requirement for webui2 :

for i in bottle pymongo requests arrow passlib; do pip list |grep ${i}; done
bottle (0.12.8)
pymongo (3.7.2)
requests (2.20.0)
arrow (0.12.1)
passlib (1.7.1)

Some information about the installation/configuration :

[shinken@localhost ~]$ shinken --version
shinken 2.4.3
[shinken@localhost ~]$ shinken inventory
simple-log
webui2
webui
[shinken@localhost shinken]$ ls /var/lib/shinken/modules/
dummy_arbiter  dummy_broker  dummy_broker_external  dummy_poller  dummy_scheduler  __init__.py  simple-log  webui2
[shinken@localhost modules]$ cat /etc/shinken/brokers/broker-master.cfg |grep module
# Interesting modules that can be used:
modules    webui2

Here is my /var/log/shinken/brokerd.log

[1541499879] WARNING: [broker-master] Cannot import webui2..module : invalid syntax (connectionpool.py, line 92)
[1541499879] WARNING: [broker-master] Trying to load '/var/lib/shinken/modules/webui2' as an (very-)old-style shinken "module" : by adding its path to sys.path. This can be (very) bad in case of name conflicts within the files part of /var/lib/shinken/modules/webui2 and others top-level python modules; I'll try to limit that.
[1541499879] WARNING: [broker-master] [WebUI-auth-htpasswd] Can not import md5 password authentication!
[1541499879] ERROR: [broker-master] Could not import bare 'module.py' from /var/lib/shinken/modules/webui2 : invalid syntax (connectionpool.py, line 92)
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/shinken/modulesmanager.py", line 114, in try_very_bad_load
    return importlib.import_module('module')
  File "/usr/lib/python2.6/site-packages/shinken/misc/_importlib.py", line 36, in import_module
    __import__(name)
  File "/var/lib/shinken/modules/webui2/module.py", line 78, in <module>
    from frontend import FrontEnd
  File "/var/lib/shinken/modules/webui2/frontend.py", line 52, in <module>
    import requests
  File "/usr/lib/python2.6/site-packages/requests/__init__.py", line 43, in <module>
    import urllib3
  File "/usr/lib/python2.6/site-packages/urllib3/__init__.py", line 8, in <module>
    from .connectionpool import (
  File "/usr/lib/python2.6/site-packages/urllib3/connectionpool.py", line 92
     _blocking_errnos = {errno.EAGAIN, errno.EWOULDBLOCK}
                                     ^
 SyntaxError: invalid syntax
[1541503355] INFO: [broker-master] Correctly loaded dummy_arbiter as an old-new-style shinken module :|
[1541503355] INFO: [broker-master] Correctly loaded dummy_broker_external as an old-new-style shinken module :|
[1541503355] WARNING: [broker-master] The module type webui2 for webui2 was not found in modules!
[1541503355] INFO: [broker-master] I correctly loaded the modules: []
[1541503355] INFO: [broker-master] Connection OK to the scheduler scheduler-master
[1541503355] INFO: [broker-master] Connection OK to the poller poller-master
[1541503355] INFO: [broker-master] Connection OK to the reactionner reactionner-master
[1541503355] INFO: [broker-master] Connection OK to the receiver receiver-master

Can someone please help me ? :) Thanks

Cedric

maethor commented 6 years ago

I'm sorry but I don't think anyone will be able to provide you with support for Python 2.6. WebUI is not meant to run on it.

plat00n commented 6 years ago

I'm trying to find a workaround, webui (not the v2) seems to work with it. Broker seems to display warnings (like No module named bottle ?!?!) but I can have access to the web interface.

[1541582298] INFO: [broker-master] I correctly loaded the modules: [webui]
[1541582298] INFO: [broker-master] Trying to init module: webui
[1541582298] INFO: [broker-master] Starting external module webui
[1541582298] INFO: [broker-master] Starting external process for instance webui
[1541582298] INFO: [broker-master] webui is now started ; pid=13721
[1541582298] INFO: [broker-master] Connection OK to the scheduler scheduler-master
[1541582298] INFO: [broker-master] Connection OK to the poller poller-master
[1541582298] INFO: [broker-master] Connection OK to the reactionner reactionner-master
[1541582298] INFO: [broker-master] Connection OK to the receiver receiver-master
[1541582298] INFO: [broker-master] [webui[13721]]: Now running..
[1541582298] INFO: [broker-master] Modules directory: /var/lib/shinken/modules
[1541582298] INFO: [broker-master] Correctly loaded dummy_poller as an old-new-style shinken module :|
[1541582298] INFO: [broker-master] Correctly loaded dummy_broker as an old-new-style shinken module :|
[1541582298] INFO: [broker-master] Correctly loaded dummy_scheduler as an old-new-style shinken module :|
[1541582298] INFO: [broker-master] Correctly loaded dummy_arbiter as an old-new-style shinken module :|
[1541582298] INFO: [broker-master] Correctly loaded webui as an old-new-style shinken module :|
[1541582298] INFO: [broker-master] Correctly loaded dummy_broker_external as an old-new-style shinken module :|
[1541582298] INFO: [broker-master] I correctly loaded the modules: []
[1541582298] WARNING: [broker-master] Loading plugins: No module named bottle
[1541582298] WARNING: [broker-master] Loading plugins: No module named helper
[1541582298] WARNING: [broker-master] Loading plugins: No module named helper
[1541582298] WARNING: [broker-master] Loading plugins: No module named helper

How can I download the webui (v1) tar.gz ??? I will need it for a local install (a server without access to the net)

Thanks for the answers

Cédric

mohierf commented 6 years ago

This problem should be fixed with the most recent develop branch. The frontend module that caused this error with an old python version has been removed