Skip to content

Commit ab7649a

Browse files
Merge branch 'develop' into 'master'
Update master See merge request back-end/elastalert!29
2 parents ac72052 + 2a008d5 commit ab7649a

File tree

4 files changed

+53
-65
lines changed

4 files changed

+53
-65
lines changed

README.md

Lines changed: 50 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# Elastalert Server
22
**A server that runs [ElastAlert](https://github.com/Yelp/elastalert) and exposes REST API's for manipulating rules and alerts. It works great in combination with our [ElastAlert Kibana plugin](https://github.com/bitsensor/elastalert-kibana-plugin).**
33

4-
## Docker installation
5-
The default configuration uses localhost as ES host. You will want to mount the volumes for configuration and rule files to keep them after container updates. In order to do that conviniently, please do a `git clone https://github.com/bitsensor/elastalert.git; cd elastalert`
4+
## Installation
5+
The most convenient way to run the ElastAlert server is by using our Docker container image. The default configuration uses `localhost:9200` as ElasticSearch host, if this is not the case in your setup please edit `es_host` and `es_port` in both the `config.yaml` and `config.json` configuration files.
6+
7+
To run the Docker image you will want to mount the volumes for configuration and rule files to keep them after container updates. In order to do that conveniently, please do: `git clone https://github.com/bitsensor/elastalert.git; cd elastalert`
68

7-
### Bash
89
```bash
910
docker run -d -p 3030:3030 \
1011
-v `pwd`/config/elastalert.yaml:/opt/elastalert/config.yaml \
@@ -15,77 +16,35 @@ docker run -d -p 3030:3030 \
1516
--name elastalert bitsensor/elastalert:latest
1617
```
1718

18-
### Fish
19+
## Building Docker image
20+
21+
Clone the repository
1922
```bash
20-
docker run -d -p 3030:3030 \
21-
-v (pwd)/config/elastalert.yaml:/opt/elastalert/config.yaml \
22-
-v (pwd)/config/config.json:/opt/elastalert-server/config/config.json \
23-
-v (pwd)/rules:/opt/elastalert/rules \
24-
-v (pwd)/rule_templates:/opt/elastalert/rule_templates \
25-
--net="host" \
26-
--name elastalert bitsensor/elastalert:latest
23+
git clone https://github.com/bitsensor/elastalert.git && cd elastalert
2724
```
28-
### Configuration
29-
#### ElastAlert parameters
30-
ElastAlert supports additional arguments, that can be passed in the `config.json` file. An example is given in `config/config-historic-data-example.json`.
31-
32-
## Installation using npm and manual ElastAlert setup
33-
34-
### Requirements
35-
- [ElastAlert v0.0.96](https://github.com/Yelp/elastalert/tree/v0.0.96). We don't support other versions of ElastAlert, use them at your own risk.
36-
- [NodeJS 4.5.0](https://nodejs.org/en/download/) with NPM & NVM.
37-
38-
## Building from source
39-
1. Clone the repository
40-
```bash
41-
git clone https://github.com/bitsensor/elastalert.git elastalert
42-
cd elastalert
43-
```
44-
2. Run `nvm install "$(cat .nvmrc)"` to install & use the required NodeJS version.
45-
3. Run `npm install` to install all the dependencies.
46-
4. Look at the `Config` section to setup the path to your ElastAlert instance.
47-
48-
Now, you can run the server with `npm start`. By default the server runs on http://localhost:3030.
49-
50-
## Building
51-
If you want to build the server and run the build version:
52-
53-
1. Run the installation guide shown above
54-
2. Run `npm run build`
55-
56-
You can then start the build by running `node lib/index.js`.
57-
5825

26+
Build the image
27+
```
28+
make build
29+
```
30+
which is equivalent of
31+
```
32+
docker pull alpine:latest && docker pull node:latest
33+
docker build -t elastalert .
34+
```
5935

60-
## Building Docker image
36+
### Options
6137

62-
1. Clone the repository
63-
```bash
64-
git clone https://github.com/bitsensor/elastalert.git && cd elastalert
65-
```
66-
2. Build the image using
67-
```
68-
make build
69-
```
70-
which is equivalent of:
71-
```
72-
docker pull alpine:latest && docker pull node:latest
73-
docker build -t elastalert .
74-
```
75-
76-
Custom Yelp's Elastalert version (a [release from github](https://github.com/Yelp/elastalert/releases)) e.g. `master` or `v0.1.28`:
38+
Using a custom ElastAlert version (a [release from github](https://github.com/Yelp/elastalert/releases)) e.g. `master` or `v0.1.28`
7739
```bash
7840
make build v=v0.1.28
7941
```
80-
Custom mirror:
42+
Using a custom mirror
8143
```bash
8244
docker build --build-arg ELASTALERT_URL=http://example.mirror.com/master.zip -t elastalert .
8345
```
8446

85-
### Install ElastAlert to /opt/elastalert
86-
And run `pip install -r requirements.txt` or read the installation guide of ElastAlert.
87-
88-
### Config
47+
## Configuration
8948
In `config/config.example.json` you'll find the default config. You can make a `config.json` file in the same folder that overrides the default config. When forking this repository it is recommended to remove `config.json` from the `.gitignore` file. For local testing purposes you can then use a `config.dev.json` file which overrides `config.json`.
9049

9150
You can use the following config options:
@@ -117,6 +76,35 @@ You can use the following config options:
11776
"writeback_index": "elastalert_status" // Writeback index to examine for /metadata endpoint
11877
}
11978
```
79+
80+
ElastAlert also expects a `config.yaml` with at least the following options.
81+
```yaml
82+
# The elasticsearch hostname for metadata writeback
83+
# Note that every rule can have its own elasticsearch host
84+
es_host: localhost
85+
86+
# The elasticsearch port
87+
es_port: 9200
88+
89+
# The index on es_host which is used for metadata storage
90+
# This can be a unmapped index, but it is recommended that you run
91+
# elastalert-create-index to set a mapping
92+
writeback_index: elastalert_status
93+
94+
# This is the folder that contains the rule yaml files
95+
# Any .yaml file will be loaded as a rule
96+
rules_folder: rules
97+
98+
# How often ElastAlert will query elasticsearch
99+
# The unit can be anything from weeks to seconds
100+
run_every:
101+
seconds: 5
102+
103+
# ElastAlert will buffer results from the most recent
104+
# period of time, in case some log sources are not in real time
105+
buffer_time:
106+
minutes: 1
107+
```
120108
121109
## API
122110
This server exposes the following REST API's:

config/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"relative": true,
1414
"path": "/rule_templates"
1515
},
16-
"es_host": "elastalert",
16+
"es_host": "localhost",
1717
"es_port": 9200,
1818
"writeback_index": "elastalert_status"
1919
}

config/elastalert.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# The elasticsearch hostname for metadata writeback
22
# Note that every rule can have its own elasticsearch host
3-
es_host: elasticsearch
3+
es_host: localhost
44

55
# The elasticsearch port
66
es_port: 9200

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@bitsensor/elastalert",
3-
"version": "0.0.13",
3+
"version": "0.0.14",
44
"description": "A server that runs ElastAlert and exposes REST API's for manipulating rules and alerts.",
55
"license": "MIT",
66
"main": "index.js",

0 commit comments

Comments
 (0)