Comments (28)
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
from elastalert_wechat_plugin.
我安装的Elastalert 用的python3.6
from elastalert_wechat_plugin.
@yezhiyuan 目前你先别用python3,可能有函数以及类的不兼容,后期我会尽快过渡到python3.
from elastalert_wechat_plugin.
from elastalert_wechat_plugin.
启动后的日志你观察了么,有没有触发你的规则?再就是python2.7目前没有问题我自己的网站目前一直在使用中。
from elastalert_wechat_plugin.
from elastalert_wechat_plugin.
from elastalert_wechat_plugin.
好的,谢谢你的反馈,目前我使用的elastlaert 是之前的旧版本我在测试环境试试最新版的,后面我观察一下。
from elastalert_wechat_plugin.
@yezhiyuan 刚测试完了,是可以发送的,你这边检测一下你的微信配置有没有问题。
from elastalert_wechat_plugin.
from elastalert_wechat_plugin.
希望有空了帮忙看看上面的报错,应该就是那个问题导致无法报警
from elastalert_wechat_plugin.
这个报错是python3.6的,你使用python2.7有问题么
from elastalert_wechat_plugin.
root@elk:~/elastalert/elastalert_wechat_plugin/es_rules# elastalert-test-rule --config config.yaml wechart.yaml
Traceback (most recent call last):
File "/usr/local/bin/elastalert-test-rule", line 11, in
load_entry_point('elastalert==0.2.1', 'console_scripts', 'elastalert-test-rule')()
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/init.py", line 489, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/init.py", line 2852, in load_entry_point
return ep.load()
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/init.py", line 2443, in load
return self.resolve()
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/init.py", line 2449, in resolve
module = import(self.module_name, fromlist=['name'], level=0)
File "/usr/local/lib/python2.7/dist-packages/elastalert-0.2.1-py2.7.egg/elastalert/test_rule.py", line 61
print('Invalid filter provided:', str(ea), file=sys.stderr)
^
SyntaxError: invalid syntax
语法测试报错
from elastalert_wechat_plugin.
用python3.6语法测试没问题
from elastalert_wechat_plugin.
root@elk:~/elastalert/elastalert_wechat_plugin/es_rules# python -m elastalert.elastalert --verbose --rule wechart.yaml Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"main", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/usr/local/lib/python2.7/dist-packages/elastalert-0.2.1-py2.7.egg/elastalert/elastalert.py", line 29, in
from . import kibana
File "/usr/local/lib/python2.7/dist-packages/elastalert-0.2.1-py2.7.egg/elastalert/kibana.py", line 4, in
import urllib.error
ImportError: No module named error
from elastalert_wechat_plugin.
用python2.7安装的时候已经报错了;
byte-compiling build/bdist.linux-x86_64/egg/tests/create_index_test.py to create_index_test.pyc
byte-compiling build/bdist.linux-x86_64/egg/tests/auth_test.py to auth_test.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying elastalert.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying elastalert.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying elastalert.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying elastalert.egg-info/entry_points.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying elastalert.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying elastalert.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
elastalert.create_index: module references file
elastalert.loaders: module references file
creating dist
creating 'dist/elastalert-0.2.1-py2.7.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing elastalert-0.2.1-py2.7.egg
removing '/usr/local/lib/python2.7/dist-packages/elastalert-0.2.1-py2.7.egg' (and everything under it)
creating /usr/local/lib/python2.7/dist-packages/elastalert-0.2.1-py2.7.egg
Extracting elastalert-0.2.1-py2.7.egg to /usr/local/lib/python2.7/dist-packages
File "/usr/local/lib/python2.7/dist-packages/elastalert-0.2.1-py2.7.egg/elastalert/test_rule.py", line 61
print('Invalid filter provided:', str(ea), file=sys.stderr)
^
SyntaxError: invalid syntax
elastalert 0.2.1 is already the active version in easy-install.pth
Installing elastalert-create-index script to /usr/local/bin
Installing elastalert script to /usr/local/bin
Installing elastalert-rule-from-kibana script to /usr/local/bin
requests和requests-dev里面的依赖都正常安装了;
from elastalert_wechat_plugin.
应该是要python3才能安装上;
from elastalert_wechat_plugin.
默认安装的版本是0.2.1,然后你的手册要求必须python3;
Running ElastAlert for the First Time
Requirements
Elasticsearch
ISO8601 or Unix timestamped data
Python 3.6
pip, see requirements.txt
Packages on Ubuntu 14.x: python-pip python-dev libffi-dev libssl-dev
from elastalert_wechat_plugin.
我现在的主要问题就是使用2.7安装报警器直接报错,用3.6可以装上,但是你的微信报警是用python2.7开发的,导致很多不兼容;多次打扰,真的是不好意思;
from elastalert_wechat_plugin.
@yezhiyuan 嗯嗯 后面我更新一下代码版本
from elastalert_wechat_plugin.
好的,非常感谢!
from elastalert_wechat_plugin.
@yezhiyuan 最近在忙其他事情,我尽快吧。
from elastalert_wechat_plugin.
谢谢你哈!辛苦了!你有空了就弄一下,没空就先放着!真的没事。
from elastalert_wechat_plugin.
我也遇到这个问题, python3 报 TypeError: Object of type bytes is not JSON serializable
from elastalert_wechat_plugin.
已经搞定了, 支持最新版的 elastalert0.21, 支持elasticsearch7.x
https://github.com/station19/elastalert-wechat-plugin/blob/master/elastalert_modules/wechat_qiye_alert_new.py
from elastalert_wechat_plugin.
我也遇到一样的问题了,小白完全不知道该怎么解决。。。
from elastalert_wechat_plugin.
@station19 没有解决。你的代码我试了,一样的问题。一毛一样。
from elastalert_wechat_plugin.
@yezhiyuan
我遇到跟你一样的问题,email是可以发送的,就是企业微信发不了。我安装的anaconda3,因为pip版本太低不让安装elastalert,只能安装python3以上了,然而这个企业微信告警的py是python2的写法,醉了。
程序运行报错:
1 rules loaded
/root/anaconda3/lib/python3.8/site-packages/APScheduler-3.8.1-py3.8.egg/apscheduler/util.py:95: PytzUsageWarning: The zone attribute is specific to pytz's interface; please migrate to a new time zone provider. For more details on how to do so, see https://pytz-deprecation-shim.readthedocs.io/en/latest/migration.html
if obj.zone == 'local':
/root/anaconda3/lib/python3.8/site-packages/APScheduler-3.8.1-py3.8.egg/apscheduler/util.py:166: PytzUsageWarning: The localize method is no longer necessary, as this time zone supports the fold attribute (PEP 495). For more details on migrating to a PEP 495-compliant implementation, see https://pytz-deprecation-shim.readthedocs.io/en/latest/migration.html
return tz.localize(datetime_, is_dst=None)
INFO:elastalert:Starting up
/root/anaconda3/lib/python3.8/site-packages/APScheduler-3.8.1-py3.8.egg/apscheduler/triggers/interval.py:66: PytzUsageWarning: The normalize method is no longer necessary, as this time zone supports the fold attribute (PEP 495). For more details on migrating to a PEP 495-compliant implementation, see https://pytz-deprecation-shim.readthedocs.io/en/latest/migration.html
return self.timezone.normalize(next_fire_time)
INFO:elastalert:Disabled rules are: []
INFO:elastalert:Sleeping for 59.999858 seconds
INFO:elastalert:Queried rule frequency_rule from 2021-11-11 10:03 CST to 2021-11-11 10:18 CST: 428 / 428 hits
INFO:elastalert:Queried rule frequency_rule from 2021-11-11 10:18 CST to 2021-11-11 10:28 CST: 198 / 198 hits
/root/anaconda3/lib/python3.8/site-packages/urllib3/connectionpool.py:1013: InsecureRequestWarning: Unverified HTTPS request is being made to host 'qyapi.weixin.qq.com'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
warnings.warn(
ERROR:root:Traceback (most recent call last):
File "/root/anaconda3/lib/python3.8/site-packages/elastalert-0.2.4-py3.8.egg/elastalert/elastalert.py", line 1452, in alert
return self.send_alert(matches, rule, alert_time=alert_time, retried=retried)
File "/root/anaconda3/lib/python3.8/site-packages/elastalert-0.2.4-py3.8.egg/elastalert/elastalert.py", line 1546, in send_alert
alert.alert(matches)
File "/root/anaconda3/lib/python3.8/site-packages/elastalert-0.2.4-py3.8.egg/elastalert_modules/wechat_qiye_alert.py", line 57, in alert
self.senddata(body)
File "/root/anaconda3/lib/python3.8/site-packages/elastalert-0.2.4-py3.8.egg/elastalert_modules/wechat_qiye_alert.py", line 124, in senddata
response = requests.post(send_url, data=json.dumps(payload, ensure_ascii=False), headers=headers,verify=False)
File "/root/anaconda3/lib/python3.8/json/init.py", line 234, in dumps
return cls(
File "/root/anaconda3/lib/python3.8/json/encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/root/anaconda3/lib/python3.8/json/encoder.py", line 257, in iterencode
return _iterencode(o, 0)
File "/root/anaconda3/lib/python3.8/json/encoder.py", line 179, in default
raise TypeError(f'Object of type {o.class.name} '
TypeError: Object of type bytes is not JSON serializable
ERROR:root:Uncaught exception running rule frequency_rule: Object of type bytes is not JSON serializable
最后一条信息:
INFO:elastalert:Ignoring match for silenced rule frequency_rule
INFO:elastalert:Ran frequency_rule from 2021-11-11 10:28 CST to 2021-11-11 13:30 CST: 34 query hits (0 already seen), 906 matches, 0 alerts sent
INFO:elastalert:Background configuration change check run at 2021-11-11 13:31 CST
INFO:elastalert:Background alerts thread 0 pending alerts sent at 2021-11-11 13:31 CST
INFO:elastalert:Disabled rules are: ['frequency_rule']
INFO:elastalert:Sleeping for 59.999802 seconds
请问楼主解决没?版主有方法?我现在是python3.8环境
from elastalert_wechat_plugin.
Related Issues (8)
- 启动时,提示IndentationError: unexpected indent HOT 15
- docker 镜像运行,并且挂载了新的config.yaml ,还是提示ConnectTimeout(HTTPConnectionPool(host='192.168.1.223', port=9200): Max retries exceeded wit HOT 3
- 触发条件时间,时区也不对,需要修复 HOT 11
- 告警插件支持多个部门id吗 HOT 1
- ERROR:root:Uncaught exception running rule log_error: tuple index out of range HOT 2
- 插件一运行,导致es挂机,请问是什么问题,查询频率高了 ? HOT 1
- python3运行规则匹配到后不发送告警,0sent? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from elastalert_wechat_plugin.