In a prometheus alert rule, how do I check for a value to be in a certain range?
for eg., (x > 80 && x <= 100);
when x is a complex expression it feels unnecessary to evaluate it twice. is there another way to represent this expression?
Configuring rules To include rules in Prometheus, create a file containing the necessary rule statements and have Prometheus load the file via the rule_files field in the Prometheus configuration. Rule files use YAML. The rule files can be reloaded at runtime by sending SIGHUP to the Prometheus process.
Let us explore data that Prometheus has collected about itself. To use Prometheus's built-in expression browser, navigate to http://localhost:9090/graph and choose the "Table" view within the "Graph" tab.
Range vector - a set of timeseries where every timestamp maps to a “range” of data points, recorded some duration into the past. Range vector is mostly used for graphs, where you want to show a PromQL expression over a given time range.
The result of an expression can either be shown as a graph, viewed as tabular data in Prometheus’s expression browser, or consumed by external systems via the HTTP API. We first explore a range vector. Range vector — a set of time series containing a range of data points over time for each time series. …
In Prometheus's expression language, an expression or sub-expression can evaluate to one of four types: Instant vector - a set of time series containing a single sample for each time series, all sharing the same timestamp Range vector - a set of time series containing a range of data points over time for each time series
Default is the global evaluation interval. Prometheus supports many binary and aggregation operators. These are described in detail in the expression language operators page. Prometheus supports several functions to operate on data. These are described in detail in the expression language functions page.
Querying Prometheus. Prometheus provides a functional query language called PromQL (Prometheus Query Language) that lets the user select and aggregate time series data in real time. The result of an expression can either be shown as a graph, viewed as tabular data in Prometheus's expression browser, or consumed by external systems via the HTTP API.
You can do x < 100 > 80
to chain them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With