Hello sir,

 When *I look at the inner query it was showing the mixture of both 1's and 
0's.*

max_over_time(up{instance=~"instance"}[2d])

It should show 1 for any instance where the server was up over the previous 
48 hours.  Does it not?
Yes it is not showing the value equal to 1. For the last 48 hours, It was 
showing when it was in reachable state and when it was not.

But I want only unreachable state servers over a period of time?

How can we achieve that?

Thanks & regards,
Bharath Kumar

On Tuesday, 9 August 2022 at 20:45:56 UTC+5:30 Brian Candler wrote:

> Use the PromQL query browser (in the Prometheus web interface) to debug 
> it.  I suggest you first need to look at the inner query:
>
> up{instance=~"instance"}
>
> and graph it, setting the "instance" regexp to match one or more instances 
> of interest. What does it look like? Is it a mixture of 0's and 1's, or all 
> 0's, or all 1's, or is it absent entirely?  If it's absent entirely, then 
> that's a different problem you need to investigate - your scrape job is 
> completely broken.
>
> If it's a mixture of 0's and 1's, then try this query:
>
> max_over_time(up{instance=~"instance"}[2d])
>
> It should show 1 for any instant where the server was up at any time over 
> the previous 48 hours.  Does it not?
>
> If it's all 0's for at least 48 hours, then
>
> max_over_time(up{instance=~"instance"}[2d])
>
> should show 0.
>
> Once you've understood why your query wasn't working as you were 
> expecting, then for partially reachable you can try a query like this:
>
> avg_over_time(up{instance=~"instance"}[2d]) > 0 < 0.9
>
> (setting thresholds as appropriate)
>
> On Tuesday, 9 August 2022 at 13:23:33 UTC+1 chembakay...@gmail.com wrote:
>
>> Hi all,
>>
>> *First Query :*
>> I want to find the servers which have not been reachable for the last X 
>> days. It should not be in a reachable state for the last X days. I tried 
>> the following query, but it didn't work out.
>>
>> Query :  max_over_time(up{instance=~"instance"}[Xd]) == 0
>>
>> The above query gives me the info that servers are not reachable at least 
>> for 1 minute. But I want to know the info like it should not be reachable 
>> for the last X days.
>>
>> *Second Query :*
>> I want to find the servers which are partially reachable for the last X 
>> days and it should not include the info that is totally unreachable state 
>> for the X days.
>>
>> Any leads?
>>
>> Thanks & regards,
>> Bharath Kumar.
>>
>>

-- 
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 prometheus-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/52c5a22c-2923-4586-ae51-b0bff3121244n%40googlegroups.com.

Reply via email to