官网安装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'
解决步骤:
- 卸载已经安装的ElastAlert
$ pip3 uninstall elastalert -y
- 重新下载ElastAlert
$ wget https://github.com/daichi703n/elastalert/archive/refs/heads/fix/initialize_alerts_sent.zip
- 安装和测试
python3 ./setup.py install
elastalert-test-rule --config ./config.yaml rules/frequency.yaml.yaml --alert