Skip to content

Commit

Permalink
Improve README
Browse files Browse the repository at this point in the history
  • Loading branch information
braedon committed May 17, 2016
1 parent 2fa3543 commit 0960a33
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ Values are parsed out of the Elasticsearch results automatically, with the path
Metrics are only extracted from aggregation results, with the exception of the query doc count. The keys of any buckets are converted to labels, rather than being inserted into the metric name. See `tests/test_parser.py` for all the supported queries/metrics.

# Installation
You will need Python 3 and pip 3 installed to run the exporter.
The exporter requires Python 3 and Pip 3 to be installed.

Run the following in the root project directory to install (i.e. download dependencies, create start script):
To install the latest published version via Pip, run:
```
> pip3 install .
> pip3 install prometheus-es-exporter
```
Note that you may need to add the start script location (see pip output) to your `PATH`.

Expand All @@ -27,22 +27,24 @@ Run with the `-h` flag to see details on all the available options.
See the provided `exporter.cfg` file for query configuration examples and explanation.

# Docker
You can build a docker image using the provided Dockerfile. Run the following in the root project directory:
Docker images for released versions can be found on Docker Hub (note that no `latest` version is provided):
```
> sudo docker build -t prometheus-es-exporter .
> sudo docker pull braedon/prometheus-es-exporter:<version>
```
To run a container successfully, you will need to mount a query config file to `/usr/src/app/exporter.cfg` and map container port 8080 to a port on the host. Any options placed after the image name (`prometheus-es-exporter`) will be passed to the process inside the container. You will also need to use this to configure the elasticsearch node(s) using `-e`.
To run a container successfully, you will need to mount a query config file to `/usr/src/app/exporter.cfg` and map container port 8080 to a port on the host. Any options placed after the image name (`prometheus-es-exporter`) will be passed to the process inside the container. For example, you will need to use this to configure the elasticsearch node(s) using `-e`.
```
> sudo docker run --rm --name exporter \
-v <path to query config file>:/usr/src/app/exporter.cfg \
-p 8080:8080 \
prometheus-es-exporter -e <elasticsearch nodes>
-p <host port>:8080 \
braedon/prometheus-es-exporter:<version> -e <elasticsearch nodes>
```
You can change other options in the same way as `-e`. For example, you could change where the query config file is read from using `-c`.

If you don't want to mount the query config file in at run time, you could modify the Dockerfile to copy it in when building the image.
If you don't want to mount the query config file in at run time, you could extend an existing image with your own Dockerfile that copies the config file in at build time.

# Development
To install directly from the git repo, run the following in the root project directory:
```
> pip3 install .
```
The exporter can be installed in "editable" mode, using pip's `-e` flag. This allows you to test out changes without having to re-install.
```
> pip3 install -e .
Expand All @@ -53,4 +55,8 @@ To run tests (as usual, from the root project directory), use:
```
Note that these tests currently only cover the response parsing functionality - there are no automated system tests as of yet.

To build a docker image directly from the git repo, run the following in the root project directory:
```
> sudo docker build -t <your repository name and tag> .
```
Send me a PR if you have a change you want to contribute!

0 comments on commit 0960a33

Please sign in to comment.