elastalert-test-rule error
/opt/elastalert$ sudo elastalert-create-index
Elastic Version: 7.3.0
Reading Elastic 6 index mappings:
Reading index mapping 'es_mappings/6/silence.json'
Reading index mapping 'es_mappings/6/elastalert_status.json'
Reading index mapping 'es_mappings/6/elastalert.json'
Reading index mapping 'es_mappings/6/past_elastalert.json'
Reading index mapping 'es_mappings/6/elastalert_error.json'
New index elastalert_status created
Done!
/opt/elastalert$ sudo vim example_rules/example_frequency.yaml
/opt/elastalert$ sudo elastalert-test-rule example_rules/example_frequency.yaml
Traceback (most recent call last):
File "/usr/local/bin/elastalert-test-rule", line 11, in
@anragen try to install setup by python3 (it worked for me).
Same issue : https://github.com/Yelp/elastalert/issues/2390
@anragen try to install setup by python3 (it worked for me).
Same issue : #2390
tanx but i did sudo apt-get install python3-minimal sudo apt-get install python3-pip python3-dev libffi-dev libssl-dev sudo python3 setup.py install and get
$ sudo elastalert-test-rule example_rules/example_frequency.yaml
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 "/usr/local/lib/python3.6/dist-packages/elastalert-0.2.1-py3.6.egg/elastalert/test_rule.py", line 445, in main
test_instance.run_rule_test()
File "/usr/local/lib/python3.6/dist-packages/elastalert-0.2.1-py3.6.egg/elastalert/test_rule.py", line 412, in run_rule_test
conf = load_conf(args, defaults, overwrites)
File "/usr/local/lib/python3.6/dist-packages/elastalert-0.2.1-py3.6.egg/elastalert/config.py", line 44, in load_conf
conf = yaml_loader(filename)
File "/usr/local/lib/python3.6/dist-packages/PyStaticConfiguration-0.10.4-py3.6.egg/staticconf/loader.py", line 167, in yaml_loader
with open(filename) as fh:
TypeError: expected str, bytes or os.PathLike object, not NoneType
me too python3 /usr/bin/elastalert-test-rule /data/elk/elastalert-master/example_rules/example_frequency.yaml
Traceback (most recent call last):
File "/usr/bin/elastalert-test-rule", line 8, in <module>
load_entry_point('elastalert==0.2.1', 'console_scripts', 'elastalert-test-rule')()
File "/usr/local/lib/python3.6/site-packages/elastalert/test_rule.py", line 445, in main
test_instance.run_rule_test()
File "/usr/local/lib/python3.6/site-packages/elastalert/test_rule.py", line 412, in run_rule_test
conf = load_conf(args, defaults, overwrites)
File "/usr/local/lib/python3.6/site-packages/elastalert/config.py", line 44, in load_conf
conf = yaml_loader(filename)
File "/usr/local/lib/python3.6/site-packages/staticconf/loader.py", line 167, in yaml_loader
with open(filename) as fh:
TypeError: expected str, bytes or os.PathLike object, not NoneType
I'm sorry, there was a regression here. I clearly wasn't very carful when merging https://github.com/Yelp/elastalert/pull/2030/files. You need to pass --config too, where it used to default to checking for "config.yaml". I'll fix this asap.
I've just fixed this in master: https://github.com/Yelp/elastalert/commit/3affdd7ebf2b6d82c5cfcad0092df97dc27cd8b1
@Qmando thank you so much! it worked.
@zhanghan12 example : elastalert-test-rule --config config.yaml example_rules/example_frequency.yaml which worked for me.
I've just fixed this in master: 3affdd7
git pull sudo elastalert-test-rule --config config.yaml example_rules/example_frequency.yaml the same error
I'm also getting the same error while running the command : sudo elastalert-test-rule --config config.yaml example_rules/example_frequency.yaml
Installed python version 3.6 root@XXX:/tmp/elastalert/example_rules# python --version Python 3.6.8
root@XXX:/tmp/elastalert/example_rules# sudo elastalert-test-rule --config config.yaml example_frequency.yaml
Traceback (most recent call last):
File "/usr/local/bin/elastalert-test-rule", line 11, in
@jpsampat : seems like you are not mentioning example_frequency.yaml path It should be like $elastalert-test-rule --config config.yaml example_rules/example_frequency.yaml and Make sure in elastalert directory : config.yaml exists
@prabhur24 : I'm getting the same error after mentioning the proper path even I have checked the config.yaml file also and it's present at the location. Plz check the below outputs.
Path of the config.yaml location ubuntu@XXX:/opt/elastalert$ ls Dockerfile-test Makefile build config.yaml dist docs elastalert.egg-info pytest.ini requirements.txt setup.py tests LICENSE README.md changelog.md config.yaml.example docker-compose.yml elastalert example_rules requirements-dev.txt setup.cfg supervisord.conf.example tox.ini ubuntu@XXX::/opt/elastalert$
Command ran with the proper path.
ubuntu@XXX::/opt/elastalert$ elastalert-test-rule --config config.yaml example_rules/example_frequency.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.
Traceback (most recent call last):
File "/usr/local/bin/elastalert-test-rule", line 11, in
Please check and revert, any further help would be grateful. Thanks.
Issue got resolved buy upgrading PyYAML from 3 to 5.1.2
hi,
have error on sudo elastalert-create-index
root@hq-elk-k:/opt/elastalert# sudo elastalert-create-index
Enter Elasticsearch host: hq-elk-es01
Traceback (most recent call last):
File "/usr/local/bin/elastalert-create-index", line 11, in <module>
load_entry_point('elastalert==0.2.1', 'console_scripts', 'elastalert-create-index')()
File "/usr/local/lib/python2.7/dist-packages/elastalert-0.2.1-py2.7.egg/elastalert/create_index.py", line 215, in main
host = args.host if args.host else input('Enter Elasticsearch host: ')
File "<string>", line 1, in <module>
NameError: name 'hq' is not defined
also tried with --config and actual config path
with localhost with 127.0.0.1 etc no luck
P.S have upgraded PyYAML
can somebody help?
ok found this #1077 and think setuptools related somehow.
i setup.py again and now error:
Installed /usr/local/lib/python3.5/dist-packages/elastalert-0.2.1-py3.5.egg
Processing dependencies for elastalert==0.2.1
Searching for setuptools>=20.10.1
Reading https://pypi.python.org/simple/setuptools/
Best match: setuptools 41.2.0
Downloading https://files.pythonhosted.org/packages/d9/ca/7279974e489e8b65003fe618a1a741d6350227fa2bf48d16be76c7422423/setuptools-41.2.0.zip#sha256=66b86bbae7cc7ac2e867f52dc08a6bd064d938bac59dfec71b9b565dd36d6012
Processing setuptools-41.2.0.zip
Writing /tmp/easy_install-_a1lpnma/setuptools-41.2.0/setup.cfg
Running setuptools-41.2.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-_a1lpnma/setuptools-41.2.0/egg-dist-tmp-z_bed_2e
warning: no previously-included files found matching 'pyproject.toml'
warning: install_lib: 'build/lib' does not exist -- no Python modules to install
zip_safe flag not set; analyzing archive contents...
Removing /usr/local/lib/python3.5/dist-packages/UNKNOWN-0.0.0-py3.5.egg
Moving UNKNOWN-0.0.0-py3.5.egg to /usr/local/lib/python3.5/dist-packages
UNKNOWN 0.0.0 is already the active version in easy-install.pth
Installing easy_install-3.5 script to /usr/local/bin
Installing easy_install script to /usr/local/bin
Installed /usr/local/lib/python3.5/dist-packages/UNKNOWN-0.0.0-py3.5.egg
error: The 'setuptools>=20.10.1' distribution was not found and is required by jira
but its installed
root@hq-elk-k:/opt/elastalert# sudo pip install setuptools
Requirement already satisfied: setuptools in /usr/lib/python3/dist-packages (20.7.0)
ok found the problem...
need to upgrade setuptools:
python3 -m pip install --upgrade pip setuptools wheel
I'm getting the same error as OP. Was there any solution found?
elastalert-test-rule --config config.yaml example_rules/example_frequency.yaml
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 "/usr/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/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2793, in load_entry_point
return ep.load()
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2411, in load
return self.resolve()
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2417, 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
@Mfisher925
have you tried to comment out jira staff in .local/lib/python3.8/site-packages/elastalert/alerts.py?
#from jira.client import JIRA
#from jira.exceptions import JIRAError
JIRAError = KeyError
This worked for me
@Mfisher925 have you tried to comment out jira staff in
.local/lib/python3.8/site-packages/elastalert/alerts.py?#from jira.client import JIRA #from jira.exceptions import JIRAError JIRAError = KeyErrorThis worked for me
I had not, I ended up using a compatible version of python 3.6 with virtualenv. I'll try this on my lab version I'm creating now. Thanks!