PCA (Prometheus Certified Associate) sample exam question with answer 85
Question:
Let cert_expiry be a gauge metric whose value is a Unix timestamp (epoch time) representing the time a given certificate will expire.
Which of the following queries gives the time in days until certificate expiration?
- cert_expiry - time("d")
- No such query exists
- (cert_expiry – time()) / 86400
- cert_expiry / 86400 – time.now.days()
Answer:
C - is correct. The division by 86400 is necessary to convert from a number of seconds to a number of days (86,400 seconds in a day). Reference:
time
A - is incorrect as the time function does not accept any arguments
B - there is a valid query that computes the desired result
D - is incorrect as there is no such function time.now.days