No module named modules.my_rules
See original GitHub issueHi !
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:
- Created 7 years ago
- Comments:8 (3 by maintainers)
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 usingFurthermore 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
orpython -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 !
Thank you so much @Qmando python command works for me.