xuyaoqiang / elastalert-dingtalk-plugin

elastalert 的钉钉报警插件
88 stars 39 forks source link

No module named 'elastalert_modules #3

Open ktpktr0 opened 2 years ago

ktpktr0 commented 2 years ago

I use docker to install elastalert. I try to load the new module, but it fails

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/elastalert", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/site-packages/elastalert/elastalert.py", line 2155, in main
    client = ElastAlerter(args)
  File "/usr/local/lib/python3.10/site-packages/elastalert/elastalert.py", line 128, in __init__
    self.rules = self.rules_loader.load(self.conf, self.args)
  File "/usr/local/lib/python3.10/site-packages/elastalert/loaders.py", line 170, in load
    raise EAException('Error loading file %s: %s' % (rule_file, e))
elastalert.util.EAException: Error loading file /home/elastalert/rules/example_frequency.yaml: Error initiating alert ['elastalert_modules.dingtalk_alert.DingTalkAlerter']: Could not import module elastalert_modules.dingtalk_alert.DingTalkAlerter: No module named 'elastalert_modules'

load modules:

# ll /data/elastalert/elastalert_modules/
dingtalk_alert.py  __init__.py 

rules:

alert_text_type: alert_text_only

alert_text_args:
  - host
  - method
  - request
  - status
  - upstream
  - num_hits

alert:
  - "elastalert_modules.dingtalk_alert.DingTalkAlerter"
nsano-rururu commented 2 years ago

elastalert does not work properly with python 3.9 and 3.10.

nsano-rururu commented 2 years ago

elastalert2 is compatible with python 3.9 and 3.10. https://github.com/jertel/elastalert2