mtakaki / cachet-url-monitor

URL monitor plugin for cachethq.io
MIT License
125 stars 49 forks source link

No module named 'cachet_url_monitor' #62

Closed Yandols closed 4 years ago

Yandols commented 5 years ago

Hi, I've followed instructions from the readme.md but got stuck and failed to launch it due to the following error.

Traceback (most recent call last):
  File "cachet_url_monitor/scheduler.py", line 8, in <module>
    from cachet_url_monitor.configuration import Configuration
ImportError: No module named 'cachet_url_monitor'

From my understanding it looks like it's not able to import itself. All pip requirements are already installed so I have no idea why this is occuring. I am running on a Fedora 27 CE server (no docker) if that helps.

mtakaki commented 5 years ago

Could you please try running this after running pip?

$ python3 setup.py install

And then try running again. Could you also please let me know the result? If that works, I'll update the README.

Yandols commented 5 years ago

Yes, that installation step was missing from the readme.md. This is the output:

running install
running bdist_egg
running egg_info
creating cachet_url_monitor.egg-info
writing dependency_links to cachet_url_monitor.egg-info/dependency_links.txt
writing cachet_url_monitor.egg-info/PKG-INFO
writing top-level names to cachet_url_monitor.egg-info/top_level.txt
writing manifest file 'cachet_url_monitor.egg-info/SOURCES.txt'
reading manifest file 'cachet_url_monitor.egg-info/SOURCES.txt'
writing manifest file 'cachet_url_monitor.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build
creating build/lib
creating build/lib/cachet_url_monitor
copying cachet_url_monitor/configuration.py -> build/lib/cachet_url_monitor
copying cachet_url_monitor/scheduler.py -> build/lib/cachet_url_monitor
copying cachet_url_monitor/__init__.py -> build/lib/cachet_url_monitor
copying cachet_url_monitor/latency_unit.py -> build/lib/cachet_url_monitor
copying cachet_url_monitor/status.py -> build/lib/cachet_url_monitor
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/cachet_url_monitor
copying build/lib/cachet_url_monitor/configuration.py -> build/bdist.linux-x86_64/egg/cachet_url_monitor
copying build/lib/cachet_url_monitor/scheduler.py -> build/bdist.linux-x86_64/egg/cachet_url_monitor
copying build/lib/cachet_url_monitor/__init__.py -> build/bdist.linux-x86_64/egg/cachet_url_monitor
copying build/lib/cachet_url_monitor/latency_unit.py -> build/bdist.linux-x86_64/egg/cachet_url_monitor
copying build/lib/cachet_url_monitor/status.py -> build/bdist.linux-x86_64/egg/cachet_url_monitor
byte-compiling build/bdist.linux-x86_64/egg/cachet_url_monitor/configuration.py to configuration.cpython-35.pyc
byte-compiling build/bdist.linux-x86_64/egg/cachet_url_monitor/scheduler.py to scheduler.cpython-35.pyc
byte-compiling build/bdist.linux-x86_64/egg/cachet_url_monitor/__init__.py to __init__.cpython-35.pyc
byte-compiling build/bdist.linux-x86_64/egg/cachet_url_monitor/latency_unit.py to latency_unit.cpython-35.pyc
byte-compiling build/bdist.linux-x86_64/egg/cachet_url_monitor/status.py to status.cpython-35.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying cachet_url_monitor.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying cachet_url_monitor.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying cachet_url_monitor.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying cachet_url_monitor.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating dist
creating 'dist/cachet_url_monitor-1.4-py3.5.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing cachet_url_monitor-1.4-py3.5.egg
Copying cachet_url_monitor-1.4-py3.5.egg to /opt/statusmonitor/lib/python3.5/site-packages
Adding cachet-url-monitor 1.4 to easy-install.pth file

Installed /opt/statusmonitor/lib/python3.5/site-packages/cachet_url_monitor-1.4-py3.5.egg
Processing dependencies for cachet-url-monitor==1.4
Finished processing dependencies for cachet-url-monitor==1.4

However I am now receiving a different error:

 can't find '__main__' module in 'cachet_url_monitor'

It still won't launch.

Yandols commented 5 years ago

Please disregard the last error I posted in my comment above, I simply entered the wrong path.

After running the python3 setup.py install command it is now working properly, so you might want to add that to the readme.

Now I just need to figure out correct regex to detect the status of my instance.

Thanks!

mtakaki commented 5 years ago

Great! Thanks for the update. FYI, the regex looks into the body of the response. I'll leave this bug open until I update the readme.

Yandols commented 5 years ago

Awesome. With the original issue aside, I must be doing something wrong with the regex then as I keep getting "Regex did not match anything in the body".

Is the regex field in the config the filter or what it will be filtering to look for? I'm trying to use this to monitor the status of my Gitlab instance which will return the message Gitlab OK through the health API.

I've never done automated status monitoring before so I'm a bit confused on what to configure.

Late Update: Please disregard my original message in this reply, I figured out what I was doing wrong and everything is working perfectly as intended.

thyspir commented 5 years ago

I have this issue when configuring it on Ubuntu 16.0.4. It resolved after pip and run command

$python setup.py install

mtakaki commented 4 years ago

Thanks for sharing this, @thyspir! I updated the README a while back and @Yandols confirmed it's working for him. I'll close this issue.