Code Monkey home page Code Monkey logo

elastalert_wechat_plugin's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

elastalert_wechat_plugin's Issues

启动时,提示IndentationError: unexpected indent

[root@iZ94rc264jtZ elastalert]# python2.7 -m elastalert.elastalert --verbose --config config.yaml --rule es_rules/wechart.yaml
/usr/lib/python2.7/site-packages/requests/init.py:80: RequestsDependencyWarning: urllib3 (1.22) or chardet (2.2.1) doesn't match a supported version!
RequestsDependencyWarning)
Traceback (most recent call last):
File "/usr/lib64/python2.7/runpy.py", line 162, in _run_module_as_main
"main", fname, loader, pkg_name)
File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/usr/local/elastalert/elastalert/elastalert.py", line 1925, in
sys.exit(main(sys.argv[1:]))
File "/usr/local/elastalert/elastalert/elastalert.py", line 1919, in main
client = ElastAlerter(args)
File "/usr/local/elastalert/elastalert/elastalert.py", line 108, in init
self.conf = load_rules(self.args)
File "elastalert/config.py", line 500, in load_rules
rule = load_configuration(rule_file, conf, args)
File "elastalert/config.py", line 133, in load_configuration
load_modules(rule, args)
File "elastalert/config.py", line 382, in load_modules
rule['alert'] = load_alerts(rule, alert_field=rule['alert'])
File "elastalert/config.py", line 440, in load_alerts
alert_field = [create_alert(a, b) for a, b in alert_field]
File "elastalert/config.py", line 425, in create_alert
alert_class = alerts_mapping.get(alert) or get_module(alert)
File "elastalert/config.py", line 110, in get_module
base_module = import(module_path, globals(), locals(), [module_class])
File "elastalert_modules/wechat_qiye_alert.py", line 24
def init(self, *args):
IndentationError: unexpected indent

py脚本是直接git下载,语法检查也看不什么问题?

docker 镜像运行,并且挂载了新的config.yaml ,还是提示ConnectTimeout(HTTPConnectionPool(host='192.168.1.223', port=9200): Max retries exceeded wit

raise ConnectionTimeout('TIMEOUT', str(e), e)
elasticsearch.exceptions.ConnectionTimeout: ConnectionTimeout caused by - ConnectTimeout(HTTPConnectionPool(host='192.168.1.223', port=9200): Max retries exceeded with url: / (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x7fbccc82ec90>, 'Connection to 192.168.1.223 timed out. (connect timeout=60)')))

ERROR:root:Uncaught exception running rule log_error: tuple index out of range

ERROR:root:Traceback (most recent call last):
File "/opt/elastalert/elastalert/elastalert.py", line 1335, in alert
return self.send_alert(matches, rule, alert_time=alert_time, retried=retried)
File "/opt/elastalert/elastalert/elastalert.py", line 1424, in send_alert
alert.alert(matches)
File "elastalert_modules/wechat_qiye_alert.py", line 39, in alert
body = self.create_alert_body(matches)
File "elastalert/alerts.py", line 253, in create_alert_body
body += unicode(BasicMatchString(self.rule, match))
File "elastalert/alerts.py", line 144, in str
self._add_custom_alert_text()
File "elastalert/alerts.py", line 81, in _add_custom_alert_text
alert_text = alert_text.format(*alert_text_values)
IndexError: tuple index out of range

ERROR:root:Uncaught exception running rule log_error: tuple index out of range

python3运行规则匹配到后不发送告警,0sent?

python3 -m elastalert.elastalert --verbose --rule ../elastalert_wechat_plugin/es_rules/wechart2.yaml --config ../elastalert_wechat_plugin/config/config.yaml
1 rules loaded
INFO:elastalert:Starting up
INFO:elastalert:Disabled rules are: []
INFO:elastalert:Sleeping for 59.999454 seconds
INFO:elastalert:Queried rule schedulee from 2020-03-09 16:26 CST to 2020-03-09 16:30 CST: 12 / 12 hits
/usr/local/python3.6/lib/python3.6/site-packages/urllib3-1.25.8-py3.6.egg/urllib3/connectionpool.py:1004: 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
InsecureRequestWarning,
ERROR:root:Traceback (most recent call last):
File "/data/elastalert/elastalert/elastalert.py", line 1450, in alert
return self.send_alert(matches, rule, alert_time=alert_time, retried=retried)
File "/data/elastalert/elastalert/elastalert.py", line 1544, in send_alert
alert.alert(matches)
File "/usr/local/python3.6/lib/python3.6/site-packages/elastalert-0.2.1-py3.6.egg/elastalert_modules/wechat_qiye_alert.py", line 57, in alert
self.senddata(body)
File "/usr/local/python3.6/lib/python3.6/site-packages/elastalert-0.2.1-py3.6.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 "/usr/local/python3.6/lib/python3.6/json/init.py", line 238, in dumps
**kw).encode(obj)
File "/usr/local/python3.6/lib/python3.6/json/encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/local/python3.6/lib/python3.6/json/encoder.py", line 257, in iterencode
return _iterencode(o, 0)
File "/usr/local/python3.6/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 schedulee: Object of type 'bytes' is not JSON serializable
INFO:elastalert:Rule schedulee disabled
INFO:elastalert:Ignoring match for silenced rule schedulee
INFO:elastalert:Ignoring match for silenced rule schedulee
INFO:elastalert:Ignoring match for silenced rule schedulee
INFO:elastalert:Ignoring match for silenced rule schedulee
INFO:elastalert:Ignoring match for silenced rule schedulee
INFO:elastalert:Ignoring match for silenced rule schedulee
INFO:elastalert:Ignoring match for silenced rule schedulee
INFO:elastalert:Ignoring match for silenced rule schedulee
INFO:elastalert:Ignoring match for silenced rule schedulee
INFO:elastalert:Ignoring match for silenced rule schedulee
INFO:elastalert:Ignoring match for silenced rule schedulee
INFO:elastalert:Ran schedulee from 2020-03-09 16:26 CST to 2020-03-09 16:30 CST: 12 query hits (0 already seen), 12 matches, 0 alerts sent

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.