What you are saying doesn't make sense, so you need to provide some
evidence: actual queries, actual data. Pick a specific instance, which
I'll say is "foo".
up{instance="foo"} # show graph over 1 week
up{instance="foo"}[2d] # show console (range vectors can't be graphed)
max_over_time{instance="foo"}[2d]) # show graph over 1 week
I assert that if up{instance="foo"} is a mixture of 0s and 1s for a given
48 hour period, then the value of max_over_time{instance="foo"}[2d]} at the
end of that 48 hour period will be 1.
On Tuesday, 16 August 2022 at 15:08:15 UTC+1 [email protected] wrote:
> hello,
>
> max_over_time(up[2d]) == 0 is giving me the info like ...for the last two
> days if the server goes down for 1 minute also it was displaying in the
> graph which I don't want. I want the information that for the last "X" days
> it should be completely in an unreachable state.
>
> Thanks & regards,
> Bharath Kumar.
>
> On Tuesday, 16 August 2022 at 12:47:03 UTC+5:30 Brian Candler wrote:
>
>> If the metric is 0, 1, 0, 1, 1, 0 ... then max_over_time will be 1, if
>> the time period in question covers those values.
>> If the metric is 0, 0, 0, 0, 0, 0 ... then max_over_time will be 0.
>>
>> If you enter an expression like
>>
>> max_over_time(up{instance=~"some_instance_name"}[2d])
>>
>> and *draw a graph of it*, then you need to understand what that graph
>> represents. On the X axis is time; this is the time the expression was
>> evaluated at. The expression itself looks at the 2 days of data *up to and
>> including that time*: that is, the range vector up[2d] reads all data in
>> the database between T and T-2d.
>>
>> For example, if there's a point on the graph where the X axis is 15 Aug
>> 12:00, and the Y axis is 1, it means that the max_over_time between 13 Aug
>> 12:00 and 15 Aug 12:00 was 1. This in turn implies that there was at least
>> one 1 value in that 2d period. It will only show 0 if *all* the values in
>> that period were 0.
>>
>> If that doesn't do what you want, then you'll have to describe exactly
>> what you see more clearly, with actual concrete queries and responses, and
>> explain why it is different to what you expect. Otherwise, only you can
>> see the data in front of you, so it's up to you to understand why your
>> query isn't doing what you expect.
>>
>> > But I want only unreachable state servers over a period of time?
>>
>> That will be those where max_over_time(...) is zero, and you can filter
>> down to just those servers with an expression like this:
>>
>> max_over_time(up[2d]) == 0
>>
>> If you graph this expression, then all the data points will be zeros, but
>> the points will appear and disappear over time. They will be present at
>> time T only if all the values in the period T-2d to T were 0. If that's
>> not the case, then the point will not be displayed.
>>
>
--
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/6f9c7533-d1dc-431c-9456-337b36e2f667n%40googlegroups.com.