Prometheus 基于时间的普罗米修斯查询
普罗米修斯查询中是否有选项可以检查当前时间是白天还是晚上?我的意思是在白天和晚上设置不同的阈值:Prometheus 基于时间的普罗米修斯查询,prometheus,Prometheus,普罗米修斯查询中是否有选项可以检查当前时间是白天还是晚上?我的意思是在白天和晚上设置不同的阈值: sum(irate(haproxy_frontend_http_responses_total{code=~"5xx"}[5m]) > 10) # for night sum(irate(haproxy_frontend_http_responses_total{code=~"5xx"}[5m]) > 100) # for day 您可以使用普罗米修斯内置的time()函数获取UT
sum(irate(haproxy_frontend_http_responses_total{code=~"5xx"}[5m]) > 10) #
for night
sum(irate(haproxy_frontend_http_responses_total{code=~"5xx"}[5m]) > 100) # for day
您可以使用普罗米修斯内置的
time()
函数获取UTC 1970年1月1日以来的秒数
还有另一个名为hour()
的函数也可以派上用场
详细文件: