The exporter runs Elasticsearch queries and transforms query results to Prometheus metrics.
Queries are defined in own files similar to how alerts rules are defined in Prometheus.
They are divided by evaluation mode into two types:
- Scheduled queries are evaluated at a certain intervals in background. When Prometheus comes for metrics the last evaluated result retured.
- On-demand queries are evaluated on scrape request.
Also queries are divided by type:
- Raw - contains raw Elasticsearch request with minimal configuration.
- Default - contains only
query
Elasticsearch request part but provides more convenient configuration options.
Query results automatically turn into a series of metrics.
Name | Description | Type | Labels |
---|---|---|---|
elastic_query_hits |
Number of records satisfied by query | Gauge | query |
elastic_query_duration_milliseconds |
Query execution Time in milliseconds | Gauge | query |
elastic_query_exceptions_total |
Total number of exceptions occured on query evaluation | Counter | query |
elastic_query_timeouts_total |
Total number of timeouts occured on query evaluation | Counter | query |
elastic_query_value_aggregation |
Elasticsearch single-value aggregation result | Counter | query, aggregation |
Aggregations partially supported only for raw queries. Supported single-value aggregations:
- Min
- Max
- Sum
- Cardinality
- Average
- ValueCount
- AverageBucket
- Derivative
- SumBucket
- MovingAverage
- CumulativeSum
- CumulativeCardinality
- BucketScript
- SerialDifferencing
- WeightedAverage
- MaxBucket (Limited: keys are not exposed as metric part)
- MinBucket (Limited: keys are not exposed as metric part)
- MedianAbsoluteDeviation
- T-Test
- Create configuration file
appsettings.Release.yaml
and query files. - Run exporter as docker container
Replace:
${CONFIG_PATH}
with path toappsettings.Release.yaml
;${QUERIES_PATH}
with path to queries directory;${HOST_PORT}
with desired host port where you want to run exporter.
docker run --rm --name es-query-exporter \
-v ${CONFIG_PATH}:/app/appsettings.Release.yaml \
-v ${QUERIES_PATH}:/app/queries -p ${HOST_PORT}:80 \
-e ASPNETCORE_ENVIRONMENT=Release \
bitshift/elastic-query-exporter:latest
Note: with the presented startup format, query files will be available at
app/queries
dir, so in configuration file same file path should be specified.
Other launch formats and configuration files are presented in the examples. See documentation for configuration details.
Exporter provides several endpoints:
/metrics
- Prometheus metrics endpoint/scheduler
- Scheduler dashboard./health/live
- Liveness probe./health/ready
- Readiness probe.