May 2019
Intermediate to advanced
442 pages
11h 36m
English
Similar to the previous subcommand, query range enables the results to be displayed for a specified time range. As such, we must provide the start and end Unix-formatted timestamps, as well as the query and Prometheus server endpoint.
As an example, we'll be using the date command to define the start and end timestamps, generating a Unix-formatted timestamp for five minutes ago and another for now. We may also specify the resolution of our query using the --step flag, which in our example is one minute. Finally, we place the PromQL expression to be executed, ending up with an instruction similar to the following:
vagrant@prometheus:~$ promtool query range --start=$(date -d '5 minutes ago' +'%s') --end=$(date -d 'now' +'%s') --step=1m ...
Read now
Unlock full access