不知道这20错在哪,空格也不多。[root@ELK example_rules]# elastalert-test-rule my_rule.yaml
Traceback (most recent call last):
File "/usr/bin/elastalert-test-rule", line 11, in <module>
load_entry_point('elastalert==0.1.32', 'console_scripts', 'elastalert-test-rule')()
File "/usr/lib/python2.7/site-packages/elastalert-0.1.32-py2.7.egg/elastalert/test_rule.py", line 381, in main
test_instance.run_rule_test()
File "/usr/lib/python2.7/site-packages/elastalert-0.1.32-py2.7.egg/elastalert/test_rule.py", line 360, in run_rule_test
rule_yaml = load_rule_yaml(args.file)
File "/usr/lib/python2.7/site-packages/elastalert-0.1.32-py2.7.egg/elastalert/config.py", line 130, in load_rule_yaml
loaded = yaml_loader(filename)
File "build/bdist.linux-x86_64/egg/staticconf/loader.py", line 168, in yaml_loader
File "build/bdist.linux-x86_64/egg/yaml/__init__.py", line 71, in load
File "build/bdist.linux-x86_64/egg/yaml/constructor.py", line 37, in get_single_data
File "build/bdist.linux-x86_64/egg/yaml/composer.py", line 39, in get_single_node
File "build/bdist.linux-x86_64/egg/yaml/parser.py", line 98, in check_event
File "build/bdist.linux-x86_64/egg/yaml/parser.py", line 174, in parse_document_start
yaml.parser.ParserError: expected '<document start>', but found '<block mapping start>'
in "my_rule.yaml", line 20, column 1
#####################################分界线########################
9 es_port: 9200
10
11 # (OptionaL) Connect with SSL to Elasticsearch
12 #use_ssl: True
13
14 # (Optional) basic-auth username and password for Elasticsearch
15 #es_username: elastic
16 #es_password: pRT3BFBt9JBeD91H9PcM
17
18 # (Required)
19 # Rule name, must be unique
20 name: elastalert_status
Traceback (most recent call last):
File "/usr/bin/elastalert-test-rule", line 11, in <module>
load_entry_point('elastalert==0.1.32', 'console_scripts', 'elastalert-test-rule')()
File "/usr/lib/python2.7/site-packages/elastalert-0.1.32-py2.7.egg/elastalert/test_rule.py", line 381, in main
test_instance.run_rule_test()
File "/usr/lib/python2.7/site-packages/elastalert-0.1.32-py2.7.egg/elastalert/test_rule.py", line 360, in run_rule_test
rule_yaml = load_rule_yaml(args.file)
File "/usr/lib/python2.7/site-packages/elastalert-0.1.32-py2.7.egg/elastalert/config.py", line 130, in load_rule_yaml
loaded = yaml_loader(filename)
File "build/bdist.linux-x86_64/egg/staticconf/loader.py", line 168, in yaml_loader
File "build/bdist.linux-x86_64/egg/yaml/__init__.py", line 71, in load
File "build/bdist.linux-x86_64/egg/yaml/constructor.py", line 37, in get_single_data
File "build/bdist.linux-x86_64/egg/yaml/composer.py", line 39, in get_single_node
File "build/bdist.linux-x86_64/egg/yaml/parser.py", line 98, in check_event
File "build/bdist.linux-x86_64/egg/yaml/parser.py", line 174, in parse_document_start
yaml.parser.ParserError: expected '<document start>', but found '<block mapping start>'
in "my_rule.yaml", line 20, column 1
#####################################分界线########################
9 es_port: 9200
10
11 # (OptionaL) Connect with SSL to Elasticsearch
12 #use_ssl: True
13
14 # (Optional) basic-auth username and password for Elasticsearch
15 #es_username: elastic
16 #es_password: pRT3BFBt9JBeD91H9PcM
17
18 # (Required)
19 # Rule name, must be unique
20 name: elastalert_status
2 个回复
xiaoaps - 80后IT男
赞同来自:
Traceback (most recent call last):
File "/usr/local/bin/elastalert-test-rule", line 11, in <module>
load_entry_point('elastalert==0.1.38', 'console_scripts', 'elastalert-test-rule')()
File "/usr/local/lib/python2.7/site-packages/elastalert-0.1.38-py2.7.egg/elastalert/test_rule.py", line 463, in main
test_instance.run_rule_test()
File "/usr/local/lib/python2.7/site-packages/elastalert-0.1.38-py2.7.egg/elastalert/test_rule.py", line 432, in run_rule_test
conf = self.load_conf(rule_yaml, args)
File "/usr/local/lib/python2.7/site-packages/elastalert-0.1.38-py2.7.egg/elastalert/test_rule.py", line 371, in load_conf
load_options(rules, conf, args.file)
File "/usr/local/lib/python2.7/site-packages/elastalert-0.1.38-py2.7.egg/elastalert/config.py", line 183, in load_options
raise EAException("Invalid Rule file: %s\n%s" % (filename, e))
elastalert.util.EAException: Invalid Rule file: config.yaml
zheniove
赞同来自:
Traceback (most recent call last):
File "/usr/local/bin/elastalert-test-rule", line 11, in <module>
load_entry_point('elastalert==0.2.1', 'console_scripts', 'elastalert-test-rule')()
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 561, in load_entry_point
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 2631, in load_entry_point
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 2291, in load
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 2297, in resolve
File "/usr/local/lib/python2.7/site-packages/elastalert/test_rule.py", line 61
print('Invalid filter provided:', str(ea), file=sys.stderr)
^
SyntaxError: invalid syntax
大神你解决了吗?,到底是啥原因呀!