PCA PCA Service Discovery & Configuration 2 — Questions and Answers
Question 1: What does the `__address__` label represent in Prometheus target discovery?
- The Prometheus server's own address
- The host:port used to scrape the target (Correct answer)
- The Alertmanager URL
- The remote write endpoint
Correct answer: The host:port used to scrape the target
`__address__` holds the `host:port` that Prometheus uses to construct the scrape URL for a target.
Question 2: Which Prometheus SD config discovers targets by querying DNS SRV records?
- consul_sd_config
- dns_sd_config (Correct answer)
- http_sd_config
- eureka_sd_config
Correct answer: dns_sd_config
`dns_sd_config` resolves DNS A, AAAA, or SRV records on a configurable refresh interval to discover scrape targets.
Question 3: What Prometheus relabeling action copies a source label value into a new label name?
- replace (Correct answer)
- labelmap
- copy
- labelkeep
Correct answer: replace
The `replace` action (the default) copies a matched source label value (optionally transformed by regex) into a target label.
Question 4: Which relabeling action renames all labels matching a regex by applying a replacement pattern to their names?
- replace
- labelmap (Correct answer)
- labeldrop
- labelkeep
Correct answer: labelmap
`labelmap` applies the regex to all label *names* and renames matching labels according to the replacement pattern, useful for promoting meta-labels.
Question 5: What is the role of the `__metrics_path__` label in Prometheus scrape targets?
- Stores the data directory path
- Specifies the HTTP path Prometheus requests to collect metrics (Correct answer)
- Points to the TLS cert file
- Defines the retention path for remote write
Correct answer: Specifies the HTTP path Prometheus requests to collect metrics
`__metrics_path__` overrides the default `/metrics` HTTP path for a specific target, allowing non-standard exposition endpoints.
Question 6: In Prometheus HTTP service discovery (`http_sd_config`), what must the HTTP endpoint return?
- A Prometheus exposition format response
- A JSON array of target groups with labels (Correct answer)
- A YAML list of scrape_configs
- A DNS zone file
Correct answer: A JSON array of target groups with labels
`http_sd_config` expects the endpoint to return a JSON array of target group objects, each with a `targets` list and optional `labels` map.
What does the `__address__` label represent in Prometheus target discovery?