IMPORTANT: No additional bug fixes or documentation updates
will be released for this version. For the latest information, see the
current release documentation.
Prometheus query metricset
editPrometheus query metricset
editThis is the query
metricset to query from querying API of Promtheus.
Configuration
editInstant queries
editThe following configuration performs an instant query for up
metric at a single point in time:
- module: prometheus period: 10s hosts: ["localhost:9090"] metricsets: ["query"] queries: - name: 'up' path: '/api/v1/query' params: query: "up"
More complex PromQL expressions can also be used like the following one which calculates the per-second rate of HTTP requests as measured over the last 5 minutes.
- module: prometheus period: 10s hosts: ["localhost:9090"] metricsets: ["query"] queries: - name: "rate_http_requests_total" path: "/api/v1/query" params: query: "rate(prometheus_http_requests_total[5m])"
Range queries
editThe following example evaluates the expression up
over a 30-second range with a query resolution of 15 seconds:
- module: prometheus period: 10s metricsets: ["query"] hosts: ["node:9100"] queries: - name: "up_master" path: "/api/v1/query_range" params: query: "up{node='master01'}" start: "2019-12-20T23:30:30.000Z" end: "2019-12-21T23:31:00.000Z" step: 15s
Fields
editFor a description of each field in the metricset, see the exported fields section.
Here is an example document generated by this metricset:
{ "@timestamp": "2017-10-12T08:05:34.853Z", "event": { "dataset": "prometheus.query", "duration": 115000, "module": "prometheus" }, "metricset": { "name": "query", "period": 10000 }, "prometheus": { "labels": { "__name__": "go_threads", "instance": "localhost:9090", "job": "prometheus" }, "query": { "go_threads": 18 } }, "service": { "address": "localhost:32769", "type": "prometheus" } }