PCA Querying & Visualization 1 — Questions and Answers
Question 1: What is PromQL?
- A query language for Prometheus (Correct answer)
- A configuration language
- A tool for visualization
- A scripting language
Correct answer: A query language for Prometheus
PromQL is Prometheus's functional query language. It selects, filters and aggregates time-series data, and is used in dashboards, alerting rules and recording rules.
Question 2: How can Prometheus query time-series data?
- By using SQL
- By using PromQL to query time-series data (Correct answer)
- By querying logs
- By pushing data to a server
Correct answer: By using PromQL to query time-series data
Prometheus data is queried with PromQL, its own query language, through the expression browser, the HTTP API or tools like Grafana. Prometheus does not use SQL.
Question 3: What is the role of Grafana in Prometheus?
- To collect data
- To visualize data in dashboards (Correct answer)
- To store data
- To write queries
Correct answer: To visualize data in dashboards
Grafana connects to Prometheus as a data source. It runs PromQL queries and shows the results as graphs and dashboards. Prometheus handles scraping, storage, querying and rule evaluation; Grafana handles the visualization.
Question 4: How does Prometheus handle multi-dimensional data?
- By separating metrics into separate files
- By using labels for multi-dimensional data (Correct answer)
- By using multiple databases
- By relying on external systems for analysis
Correct answer: By using labels for multi-dimensional data
Prometheus attaches key-value labels to each metric. Every unique label combination makes a separate time series, so data can be sliced and aggregated by instance, job, region and so on.
Question 5: What is a time-series in Prometheus?
- A data point at a single time
- A series of time-stamped data points representing a metric (Correct answer)
- A collection of logs
- A configuration setting
Correct answer: A series of time-stamped data points representing a metric
A time series is a stream of timestamped values identified by a metric name and a set of labels. It records how one measurement changes over time.
Question 6: What is the purpose of Prometheus alerts?
- To monitor logs
- To notify users when specific conditions are met (Correct answer)
- To store data
- To query databases
Correct answer: To notify users when specific conditions are met
Alerting rules use PromQL expressions. When an expression stays true for the rule's 'for' duration, the alert fires. Prometheus sends firing alerts to Alertmanager, which groups and routes them and notifies people by email, Slack, PagerDuty and so on.
Question 7: What is a dashboard in Grafana?
- A configuration panel
- A visual representation of metrics (Correct answer)
- A tool for storing data
- A query tool
Correct answer: A visual representation of metrics
A Grafana dashboard is a collection of panels, such as graphs and tables, that display metrics from data sources like Prometheus. It gives an at-a-glance view of system health.
Question 8: How can Prometheus alerting rules be defined?
- By writing scripts
- By defining conditions in PromQL (Correct answer)
- By configuring external tools
- By pushing data to Grafana
Correct answer: By defining conditions in PromQL
Prometheus alerting works by continuously evaluating predefined alerting rules, which are PromQL expressions. When a rule's condition evaluates to true (e.g., a metric value crosses a specified threshold for a certain duration), Prometheus generates an alert. This alert is then sent to the Alertmanager, which handles deduplication, grouping, and routing notifications to users via various channels.
Question 9: How can Prometheus data be exported for external analysis?
- By using APIs or exporters
- By exporting to CSV (Correct answer)
- By pushing data to Grafana
- By storing data in external databases
Correct answer: By exporting to CSV
The Prometheus Alertmanager is a separate component that handles alerts sent by the Prometheus server. Its role is to deduplicate, group, and route alerts to the correct receiver (e.g., email, PagerDuty, Slack). It also supports silencing alerts and inhibition, ensuring that users receive meaningful notifications without being overwhelmed by redundant or related alerts, streamlining incident management.