PCA practice question 13 of 15
Which PromQL statement returns the average free bytes of the filesystems over the last hour?
Full set: 60 questionsThe PromQL function avgovertime() is specifically designed to calculate the average value of all data points within a specified time interval for each time series. The query avgovertime(nodefilesystemavailbytes[1h]) correctly applies this function to the nodefilesystemavailbytes metric, which is a gauge representing available disk space. The [1h] is a range vector selector that specifies the time duration—one hour—over which the average should be calculated. This directly answers the question of finding the average free bytes over the last hour.
B. avg(nodefilesystemavailbytes[1h]) This syntax is invalid. The avg() aggregation operator works on instant vectors to average across different time series at a single point in time, not on range vectors ([1h]).
C. sum(nodefilesystemavailbytes[1h]) This syntax is also invalid. The sum() aggregation operator, like avg(), is used with instant vectors, not range vectors, to sum values across series at one point in time.
D. sumovertime(nodefilesystemavailbytes[1h]) This function calculates the sum of all data points over the specified time interval, not the average as required by the question.
1. Prometheus Official Documentation, Querying Functions: The documentation for avgovertime(range-vector) states it "calculates the average value of all points in the specified interval." This directly supports the correct answer A.
Source: Prometheus Authors. (n.d.). Querying functions. Prometheus. Retrieved from https://prometheus.io/docs/prometheus/latest/querying/functions/#avgovertime
2. Prometheus Official Documentation, Aggregation Operators: This section explains that operators like sum() and avg() are used to "aggregate the elements of a single instant vector, resulting in a new vector with fewer elements." It clarifies that they cannot be directly applied to a range vector [1h], making options B and C syntactically incorrect.
Source: Prometheus Authors. (n.d.). Aggregation operators. Prometheus. Retrieved from https://prometheus.io/docs/prometheus/latest/querying/operators/#aggregation-operators
3. Prometheus Official Documentation, Range Vector Selectors: This page defines a range vector as a set of time series containing a range of data points over time, denoted by a time duration in square brackets []. Functions like avgovertime operate on these, while aggregation operators like avg do not.
Source: Prometheus Authors. (n.d.). Range Vector Selectors. Prometheus. Retrieved from https://prometheus.io/docs/prometheus/latest/querying/basics/#range-vector-selectors
Keep practicing
Take the free PCA practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other PCA practice questions
- Question 1What function calculates the tp-quantile from a histogram?
- Question 2How can you select all the up metrics whose instance label matches the regex fe-.*?
- Question 3Which exporter would be best suited for basic HTTP probing?
- Question 4What Prometheus component would you use if targets are running behind a Firewall/NAT?
- Question 5What is the name of the official *nix OS kernel metrics exporter?
- Question 6Which function would you use to calculate the 95th percentile latency from histogram data?
