ElastAlert-发送报警错误[AttributeError: '_thread._local' object has no attribute 'alerts_sent']

官网安装ElastAlert,发送报警,报错如下:

ERROR:root:Traceback (most recent call last):
File "/opt/pyenv/versions/elastalert_360/lib/python3.6/site-packages/elastalert-0.2.1-py3.6.egg/elastalert/elastalert.py", line 1451, in alert
return self.send_alert(matches, rule, alert_time=alert_time, retried=retried)
File "/opt/pyenv/versions/elastalert_360/lib/python3.6/site-packages/elastalert-0.2.1-py3.6.egg/elastalert/elastalert.py", line 1550, in send_alert
self.thread_data.alerts_sent += 1
AttributeError: '_thread._local' object has no attribute 'alerts_sent'

解决步骤:

  1. 卸载已经安装的ElastAlert
$ pip3 uninstall elastalert -y
  1. 重新下载ElastAlert
$ wget https://github.com/daichi703n/elastalert/archive/refs/heads/fix/initialize_alerts_sent.zip
  1. 安装和测试
python3 ./setup.py install
elastalert-test-rule --config ./config.yaml rules/frequency.yaml.yaml --alert

参考:

https://github.com/Yelp/elastalert/pull/2991

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容