簡體   English   中英

基於一天中的時間的 Prometheus 查詢

[英]Prometheus query based on time of the day

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

您可以使用 prometheus 內置的time()函數來獲取自 UTC 時間 1970 年 1 月 1 日以來的秒數。

還有一個叫做hour()函數也可以派上用場

詳細文檔: https : //prometheus.io/docs/prometheus/latest/querying/functions/#time

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM