Overview
Two steps are required to start gathering Prometheus data:
an HTTP master item pointing to the appropriate data endpoint, e.g.
dependent items using a Prometheus preprocessing option to query required data from the metrics gathered by the master item
There are two Prometheus data preprocessing options:
Configuration
Providing you have the HTTP master item configured, you need to create a dependent item that uses Prometheus preprocessing step:
enter general dependent item parameters in the configuration form
go to the Preprocessing tab
Prometheus to JSON
Data from Prometheus can be used for low-level discovery. In this case data in JSON format are needed and the Prometheus to JSON preprocessing option will return exactly that.
For more details, see .
Query language comparison
The following table lists differences and similarities between PromQL and Zabbix Prometheus preprocessing query language.
Zabbix Prometheus preprocessing | ||
---|---|---|
Differences | ||
Query target | Prometheus server | Plain text in Prometheus exposition format |
Returns | Instant vector | Metric or label value (Prometheus pattern) Array of metrics for single value in JSON (Prometheus to JSON) |
Label matching operators | =, !=, =~, !~ | =, =~ |
Regular expression used in label or metric name matching | RE2 | PCRE |
Comparison operators | See list | Only == (equal) is supported for value filtering |
Similarities | ||
Selecting by metric name that equals string | <metric name> or {name=”<metric name>”} | <metric name> or {name=”<metric name>”} |
Selecting by metric name that matches regular expression | {name=~”<regex>”} | {name=~”<regex>”} |
Selecting by <label name> value that equals string | {<label name>=”<label value>”,…} | {<label name>=”<label value>”,…} |
Selecting by <label name> value that matches regular expression | {<label name>=~”<regex>”,…} | {<label name>=~”<regex>”,…} |
Selecting by value that equals string | {name=~”.“} == <value> | {name=~”.“} == <value> |