PCA (Prometheus Certified Associate) sample exam question with answer 265
Question:
Consider the following alerting rule.
alert: node-down
expr: up{job="node"} == 0
for: 5m
labels:
severity: high
annotations:
description: Node INSTANCE is down! Please troubleshoot ASAP!
What update can be made to the rule to ensure the actual value of the instance label associated with the alert replaces the INSTANCE placeholder text in the description annotation?
- Another label must be added to the labels attribute:
instance: {{ $labels.instance }}
- No update needs to be made. Placeholders made in all caps are automatically replaced by corresponding labels with the same name.
- The expression needs to be updated to include the instance label:
up{job="node", instance=~".+"} == 0
- The description annotation must be updated to use the templating syntax:
description: Node {{ $labels.instance }} is down! Please troubleshoot ASAP!
Answer:
D - correct answer
A - is incorrect. Though additional labels can be added using references to labels from the expression, this expression is self-referential. That is, if the instance label does not already exist on the alert from the expression, it will not be able to be templated into this new instance label. Further, explicit templating must be added to replace the placeholder value as desired
B - is incorrect as templating must be done explicitly. There is no automatic/implicit templating mechanism
C - is incorrect as the given expression is functionally equivalent to the original. The instance label will exist on the alert even if there is not a label selector for it. Further, explicit templating must be added to replace the placeholder value as desired