Yelp / elastalert

Easy & Flexible Alerting With ElasticSearch
https://elastalert.readthedocs.org
Apache License 2.0
7.99k stars 1.74k forks source link

Install fails on Windows 2012 #1665

Open callahan22 opened 6 years ago

callahan22 commented 6 years ago

Hi,

I can't find any documentation for a Windows install that works. I've got a working ES cluster. I'm installing onto the first Elastic node in the cluster. I know I need the VC++ 2015.3 v140 toolset for desktop (x86,x64) installed so I've installed it.

Following the installation instructions step by step, I run: pip install elastalert - it fails. The output is as follows:

Installing collected packages: blist, jmespath, docutils, six, python-dateutil, botocore, s3transfer, boto3, configparser, croniter, envparse, exotel,
 requests-toolbelt, pbr, defusedxml, oauthlib, requests-oauthlib, jira, jsonschema, mock, PyStaticConfiguration, simplejson, docopt, stomp.py, texttab
le, pytz, PyJWT, pysocks, twilio, elastalert
  Running setup.py install for blist ... error
    Complete output from command "c:\program files (x86)\python36-32\python.exe" -u -c "import setuptools, tokenize;__file__='C:\\Users\\_ADMNE~1.ARN\
\AppData\\Local\\Temp\\pip-install-62ork27v\\blist\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close(
);exec(compile(code, __file__, 'exec'))" install --record C:\Users\_ADMNE~1.ARN\AppData\Local\Temp\pip-record-u0gr1_pk\install-record.txt --single-ver
sion-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build\lib.win32-3.6
    creating build\lib.win32-3.6\blist
    copying blist\_btuple.py -> build\lib.win32-3.6\blist
    copying blist\_sorteddict.py -> build\lib.win32-3.6\blist
    copying blist\_sortedlist.py -> build\lib.win32-3.6\blist
    copying blist\__init__.py -> build\lib.win32-3.6\blist
    running build_ext
    building 'blist._blist' extension
    creating build\temp.win32-3.6
    creating build\temp.win32-3.6\Release
    creating build\temp.win32-3.6\Release\blist
    cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DBLIST_FLOAT_RADIX_SORT=1 "-Ic:\program files (x86)\python36-32\include" "-Ic:\program files (x86)\pyt
hon36-32\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\shared" "-I
C:\Program Files (x86)\Windows Kits\8.1\include\\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\winrt" "-IC:\Program Files (x86)\Windows Kits
\8.1\include\\cppwinrt" /Tcblist/_blist.c /Fobuild\temp.win32-3.6\Release\blist/_blist.obj
    error: command 'cl.exe' failed: No such file or directory
callahan22 commented 6 years ago

After a day of fiddling with elastalert, I've finally got it installed. Looks like it needs Python 2.7. Unless I've been blind, I didn't see this mentioned anywhere in the documentation. Feel free to link me to somewhere it does that I've missed. While far from complete, hopefully this should be enough to save someone else a full day of head scratching...

Windows 2012

  1. Install Python 2.7
  2. Open a Admin powershell
  3. Enter: cd c:\pyton27\Scripts
  4. Enter: python -m pip install --upgrade pip
  5. Add c:\Python27\Scripts to the environment variables
  6. Install Microsoft Visual C++ Compiler for Python 2.7 as follows (it will not install by double clicking it):
  7. Open admin command prompt
  8. Type: net user administrator /active:yes
  9. In same command prompt, navigate to the VCForPython27.msi and execute it
  10. In an admin Powershell, run .\pip install elastalert
  11. Create a directory called elastalert on C:\ or within your Elastic folder (placement is irrelevant)
  12. Download the zip from the GIT Master (https://github.com/Yelp/elastalert)
  13. Extract the zip file and copy config.yaml.example file to your newly created folder
  14. Copy the example_rules folder from the extracted folder to your new elastalert folder
  15. Rename your example_rules folder to "rules" and rename the config.yaml.example file to config.yaml
  16. Open your config.yaml file and change the entries to match your environment
  17. Open the rules/example_frequency.yaml file and change the following entries:

    **es_host:** _enter your ES server or round robin DNS name for your cluster here
    **es_port:** 9200
    **index:** one_of_your_indexes-*
    **filter:** Use the reference here: http://elastalert.readthedocs.io/en/latest/recipes/writing_filters.html

Once those are saved, you can go back to your Powershell window and run the following to test your filter:

  1. cd c:\Python27\scripts
  2. .\elastalert-test-rule c:\PATH_TO_YOUR_RULES_FOLDER\rules\example_frequency.yaml

That should give you some useful feedback and at least get things moving. This obviously doesn't cover adding the elastalert index into your ES cluster. These steps should bring you up to the "Setting up Elasticsearch" section of the official guide: http://elastalert.readthedocs.io/en/latest/running_elastalert.html#downloading-and-configuring

ormam commented 6 years ago

there are no scripts directory in the python directory and the pip is not out there where did you download your python?

stokedout commented 6 years ago

Hi Orman, take the latest minor release of python 2.7. In my case today it was 2.7.15.

srinivas946 commented 4 years ago

@callahan22 looking at the issue the problem with blist file better to download the appropriate wheel file from this link and run it. blist_wheel