PCA practice question 2 of 15
How can you select all the up metrics whose instance label matches the regex fe-.*?
Full set: 60 questionsIn Prometheus Query Language (PromQL), time series are filtered using label selectors. To filter based on a regular expression match, the =~ operator is used. The query up{instance=~"fe-."} correctly selects all time series with the metric name up where the instance label value matches the regular expression fe-.. This expression matches any instance label that starts with the string "fe-".
A. regexp() is not a valid function or operator for label matching within a PromQL selector block.
B. The = operator performs an exact string match, so it would look for a label literally named "fe-.".
C. The ~ operator is not a valid label matching operator in PromQL syntax.
1. Prometheus Official Documentation, "Querying Prometheus - Selectors": This document explicitly defines the label matching operators available in PromQL. It states: "=~: Select labels that regex-match the provided string." This directly supports the use of =~ for the required regular expression matching. The documentation is available at: https://prometheus.io/docs/prometheus/latest/querying/basics/#time-series-selectors (Section: Time series Selectors).
2. University of Washington, CSE 451: Introduction to Operating Systems, "Monitoring" Lecture Slides: Course materials on system monitoring often cover Prometheus. Slide 23 of the "Monitoring" lecture deck details PromQL queries and explicitly lists =~ as the operator for "matches regex". This confirms its use in an academic context. (Reference: https://courses.cs.washington.edu/courses/cse451/21au/lectures/23-monitoring.pdf, Slide 23).
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 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?
- Question 7Which PromQL expression computes the rate of API Server requests across the different clo…
