question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No module named modules.my_rules

See original GitHub issue

Hi !

First of all, thank you for Elastalert. It does work wonderfully (at least with default rules and alerts).

I’ve been trying to write custom rules and alerts, using the documentation. However even while following religiously the documentation, when trying my rules or alerts, I get the No module named modules.my_rules error.

Here is my modules folder :

modules
├── __init__.py
├── my_alerts.py
└── my_rules.py

My rules folder :

rules
└── rule.yaml

Attached are the sample rule I’m using, and the two .py files. Those are pretty basics, my_rules.py is basically taken from the documentation.

my_alerts.py.txt my_rules.py.txt rule.yaml.txt

I can import them perfectly fine from the Python REPL while being at /opt/elastalert. But when running elastalert either from /opt/elastalert and running elastalert, with elastalert-test-rule or via supervisor, the import fails.

Would anyone have any idea of what might be causing this ?

Thanks!

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
mantoine96commented, Sep 23, 2016

OK so I think I figured it out.

When installing Elastalert, I git clone’d the repo, and python setup.py install. However when testing and running my modules with Elastalert, I was using

$ elastalert-test-rule
$ which elastalert-test-rule
/usr/local/bin/elastalert-test-rule

Furthermore when invoking components such as config.py and test_rule, we see in the log that Elastalert invokes those of /usr/local/lib/python2.7/dist-packages/elastalert-0.0.96-py2.7.egg/

Running in my folder (/opt/elastalert) python -m elastalert.test_rule or python -m elastalert.elastalert does seem to do the trick.

I thought I had read throughly the documentation, and therefore think there may be some things left unclear.

Now I just have to debug my alerting rule.

Thanks again for the help and for the project !

1reaction
Prabhakarg1commented, Jul 20, 2018

Thank you so much @Qmando python command works for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ImportError: No module named modules.TestModule
I have modified yut testscript.py code as below. Please try it out. import web import sys import os, sys currDir = os.path.dirname( ...
Read more >
ModuleNotFoundError: No module named x
Project myproject contains two packages, mypackage and anotherpackage each of which contains a number of python modules, while the latter also ...
Read more >
How To Fix ModuleNotFoundError (No Module Named) in ...
I really hope that the reason you get ModuleNotFoundError no module named error is simply because the module you are trying to include...
Read more >
ModuleNotFoundError: no module named Python Error [Fixed]
Here are some solutions. 1. Make sure imported modules are installed. Take for example, numpy . You use this module in your code...
Read more >
No module named version - Red Hat Customer Portal
subscription-manager fails with 'Unable to find Subscription Manager module. Error: No module named version' · There is a pyhook report which contains a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found