The `probe_success` metric should be providing a boolean result for the probe. For example the default example of http_2xx probe will make a 0 for non-2xx responses.
Then you can simply do `avg_over_time(probe_success[4w])` to find out your availability. On Fri, Sep 29, 2023 at 9:41 AM Alan Miller <[email protected]> wrote: > I'm trying to put together a query to show the average uptime of the sites > my blackbox exporter is polling. > > So there's a metric probe_http_status_code that has the result code (eg. > 200) of the probe. > > Since BB is polling my sites every minute and I see 1440 values per day > and 40320 per 4weeks > count_over_time(probe_http_status_code{instance=" > https://www.mysite.com:443"}[4w]) > > I verified the status code is always 200 > probe_http_status_code{instance="https://www.mysite.com:443"} > > so in theory I should be able to calculate uptime percentage as: > sum_over_time(metric[4w]) / (200 * count_over_time(metric[4w])) > > Why does this query shows uptimes >100% > > 100 * ((sum_over_time(probe_http_status_code{instance=" > https://www.mysite.com:443"}[4w]) / (200 * > (count_over_time(probe_http_status_code{instance=" > https://www.mysite.com:443"}[4w]))))) > > > -- > You received this message because you are subscribed to the Google Groups > "Prometheus Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/prometheus-users/4fa46ea2-6686-40de-9483-902b5d0ee56dn%40googlegroups.com > <https://groups.google.com/d/msgid/prometheus-users/4fa46ea2-6686-40de-9483-902b5d0ee56dn%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Prometheus Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/CABbyFmpP0g28tBVJMeMvFQZeYvu%3DWbfqr3gk7G60FxGpc1%2BSjg%40mail.gmail.com.

