My guess is: when the plugin queries over a large time range, it is sending 
a large step time to the prometheus API 
<https://prometheus.io/docs/prometheus/latest/querying/api/#range-queries>, 
which is skipping over the times of interest.

Now, you can argue that this is a problem with the way that the panel 
queries Prometheus. However, querying a 1 month range with a 30 second step 
would be extremely inefficient (returning ~86,000 data points).  So really, 
it would be better if you were to have a *counter* of how many times a 502 
status code is returned, and then the plugin can calculate a rate over each 
step.

You can use a recording rule, running at the same interval as your blackbox 
scrapes, to increment a counter for each 502 response from 
blackbox_exporter.

(Incidentally, the query that you've posted is syntactically invalid - it 
has mismatched quotes)

On Monday, 7 March 2022 at 14:20:13 UTC [email protected] wrote:

> Hi Team,
>
> We use a discrete plugin(panel) in Grafana to display the data from 
> blackbox_exporter to track the end-point(URL) availability and prometheus 
> data retention period is 50 days. This panel shows URL available and  
> unavailable time in percentage.
>
> Issue is smaller down time (E.g: 502 return code for 1hr )  is getting  
> ignored when we select a larger time range in Grafana (above 1 month) and 
> the panel is showing 100% URL available.  But if we select a smaller time 
> frame in Grafana, the URL unavailable time is displayed.
>
> Suspecting issue with  below query mentioned in panel. Can somebody please 
> provide a solution for this issue ?
>
>
> *Prom query Used in Grafana discrete plugin *
> probe_httpd_status_code{instance="https://xxxxxxx
> ",job=blackbox-generic-endpoints"}
>
>
> Prometheus Version - 2.31.0
> Blackbox exporter - 0.13.0
> Grafana Version - 6.7.4
> Scrape_interval: 30s
>
> Thanks and regards
> SreeHari 
>

-- 
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/5a281000-2be7-4f9b-8e9d-2062be33d99fn%40googlegroups.com.

Reply via email to