Im trying to calculate uptime in Grafana based on the successful responses from Prometheus blackbox exporter

為{幸葍}努か 提交于 2019-12-10 15:36:33

问题


I've tried counting the number of probe_success and multiplying it by the probe interval trying to get uptime in seconds and setting the value type to the total. the issue is the minimum step changes as the time frame changes not giving us a correct reading and nulling this option. What we are actually trying to do is get the percentage uptime based on successful probes in the time frame set for the dashboard. We are using singlestat to show the percentage

(probe_success{instance="www.google.com:443",job="clienttest"})*15

We tried dividing the value by an exporter its self to try to get a percentage that would also scale to no avail.

sum(probe_success{instance="www.google.com:443",job="clienttest"}) / sum(probe_success{instance="self",job="clienttest"}) *100

回答1:


For a singlestat panel what you want to do is use just probe_success{instance="www.google.com:443",job="clienttest"} as the expression, and under options make sure you are using the Average aggregation.

On the PromQL side you can also do avg_over_time(probe_success[1h]), see this blog post.



来源:https://stackoverflow.com/questions/49156704/im-trying-to-calculate-uptime-in-grafana-based-on-the-successful-responses-from

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!