嗯;我的老是报这个错误,启动的时候
INFO:elastalert:Disabled rules are: []
INFO:elastalert:Sleeping for 59.999921 seconds
INFO:elastalert:Queried rule es_rule from 2019-11-06 19:48 CST to 2019-11-06 20:03 CST: 85 / 85 hits
INFO:elastalert:Queried rule es_rule from 2019-11-06 20:03 CST to 2019-11-06 20:18 CST: 148 / 148 hits
INFO:elastalert:Queried rule es_rule from 2019-11-06 20:18 CST to 2019-11-06 20:33 CST: 116 / 116 hits
INFO:elastalert:Queried rule es_rule from 2019-11-06 20:33 CST to 2019-11-06 20:48 CST: 159 / 159 hits
INFO:elastalert:Queried rule es_rule from 2019-11-06 20:48 CST to 2019-11-06 21:03 CST: 135 / 135 hits
INFO:elastalert:Queried rule es_rule from 2019-11-06 21:03 CST to 2019-11-06 21:18 CST: 406 / 406 hits
INFO:elastalert:Queried rule es_rule from 2019-11-06 21:18 CST to 2019-11-06 21:33 CST: 483 / 483 hits
INFO:elastalert:Queried rule es_rule from 2019-11-06 21:33 CST to 2019-11-06 21:47 CST: 103 / 103 hits
/usr/local/lib/python3.6/dist-packages/urllib3/connectionpool.py:1004: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecureRequestWarning,
ERROR:root:Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/elastalert/elastalert.py", line 1440, in alert
return self.send_alert(matches, rule, alert_time=alert_time, retried=retried)
File "/usr/local/lib/python3.6/dist-packages/elastalert/elastalert.py", line 1529, in send_alert
alert.alert(matches)
File "/root/elastalert/elastalert_wechat_plugin/es_rules/elastalert_modules/wechat_qiye_alert.py", line 63, in alert
self.senddata(body)
File "/root/elastalert/elastalert_wechat_plugin/es_rules/elastalert_modules/wechat_qiye_alert.py", line 130, in senddata
response = requests.post(send_url, data=json.dumps(payload, ensure_ascii=False), headers=headers,verify=False)
File "/usr/lib/python3.6/json/__init__.py", line 238, in dumps
**kw).encode(obj)
File "/usr/lib/python3.6/json/encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/lib/python3.6/json/encoder.py", line 257, in iterencode
return _iterencode(o, 0)
File "/usr/lib/python3.6/json/encoder.py", line 180, in default
o.__class__.__name__)
TypeError: Object of type 'bytes' is not JSON serializable
ERROR:root:Uncaught exception running rule es_rule: Object of type 'bytes' is not JSON serializable
测试语法好像没什么问题;
root@elk:~/elastalert/elastalert_wechat_plugin/es_rules# elastalert-test-rule --config config.yaml wechart.yaml
INFO:elastalert:Note: In debug mode, alerts will be logged to console but NOT actually sent.
To send them but remain verbose, use --verbose instead.
Didn't get any results.
INFO:elastalert:Note: In debug mode, alerts will be logged to console but NOT actually sent.
To send them but remain verbose, use --verbose instead.
1 rules loaded
INFO:apscheduler.scheduler:Adding job tentatively -- it will be properly scheduled when the scheduler starts
INFO:elastalert:Queried rule es_rule from 2019-11-06 21:48 CST to 2019-11-06 21:49 CST: 1 / 1 hits
Would have written the following documents to writeback index (default is elastalert_status):
elastalert_status - {'rule_name': 'es_rule', 'endtime': datetime.datetime(2019, 11, 6, 13, 49, 29, 952623, tzinfo=tzutc()), 'starttime': datetime.datetime(2019, 11, 6, 13, 48, 29, 352623, tzinfo=tzutc()), 'matches': 0, 'hits': 1, '@timestamp': datetime.datetime(2019, 11, 6, 13, 49, 30, 41775, tzinfo=tzutc()), 'time_taken': 0.019246578216552734}