Yes, for Grafana you want use these kinds of queries:

Graph Panel: avg_over_time(up{instance=~"$instance"}[$__interval])
Stat Panel (instant): avg_over_time(up{instance=~"$instance"}[$__range])


On Fri, Jul 29, 2022 at 10:35 AM Brian Candler <[email protected]> wrote:

> If Grafana is calling calling the query_range endpoint rather than query,
> then you are running a *graph* of this query (swept over a time range)
> instead of an *instant* query.  This query will be very expensive: it will
> effectively be repeating the same query from time T1 to time T2, at some
> interval, but each step looks back over 30 days of data.
>
> You need to run this as an *instant* query.  It will then tell you servers
> which have been down between the current instant and whatever offset you
> put in.
>
> I would expect that a grafana *variable* query would be an instant query.
> However you definitely don't want to use an expression like this as
> something to draw a graph of.  In that case, you just want to draw a graph
> of "up".
>
> On Friday, 29 July 2022 at 08:45:05 UTC+1 [email protected] wrote:
>
>> Thanks for your support.. Its working fine foe 7 days. But If I keep 30
>> days in place of 7 days it is throwing following error:
>>
>> post http://1.1.1.1:9090/api/v1/query_range": net/http: timeout awaiting
>> response headers
>>
>> On Friday, July 29, 2022 at 12:12:15 PM UTC+5:30 Brian Candler wrote:
>>
>>> up{instance=~"$instance"} offset 7d == 0             # servers which
>>> were down at a single instant of time exactly 7 days ago
>>> max_over_time(up{instance=~"$instance"}[7d]) == 0    # servers which
>>> have been down *for the whole* of the last 7 days
>>> min_over_time(up{instance=~"$instance"}[7d]) == 0    # servers which
>>> have been down *at any time* over the last 7 days
>>> avg_over_time(up{instance=~"$instance"}[7d]) < 0.9   # servers which
>>> have been down *for at least 10%* of the last 7 days
>>>
>>> On Friday, 29 July 2022 at 04:11:22 UTC+1 [email protected] wrote:
>>>
>>>> Hello all,
>>>>
>>>> I installed node exporter on 10 servers. among those servers few
>>>> servers are down. I want to know which servers are down from last 7 days.
>>>>
>>>> up{instance=~"$instance"} == 0 (this is the query to find which server
>>>> was down) but how can i pass the time like last 7 days which server was
>>>> down and so on
>>>>
>>>> Any leads?
>>>>
>>>> Thanks,
>>>> kumari.
>>>>
>>> --
> 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/3629df5a-5d6a-4924-bd0c-f5766db66aecn%40googlegroups.com
> <https://groups.google.com/d/msgid/prometheus-users/3629df5a-5d6a-4924-bd0c-f5766db66aecn%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/CABbyFmor3KtfaJheizuyVb2xnf7Te2wbPmWLwNVoCiX4ARBxzA%40mail.gmail.com.

Reply via email to