Thanks, Brian. It really helped me. 

I want to find the Downtime of the instance in a similar way to how we will 
find the up time of the instance.

Up time : time() - node_boot_time_seconds{instance=~"$instance"}

Is there any metric in node exporter so that we can find the downtime of 
the instance?

On Wednesday, 24 August 2022 at 16:57:32 UTC+5:30 Brian Candler wrote:

> On Wednesday, 24 August 2022 at 11:43:15 UTC+1 chembakay...@gmail.com 
> wrote:
>
>> (max_over_time(up[60s]) == bool 0) * ((up offset 61s == bool 1) * 
>> count(up[60s]) OR vector(1)) ---> query
>>
>> But the above query threw me an error as below:
>>
>> bad_data: 1:73: parse error: expected type instant vector in aggregation 
>> expression, got range vector
>>
> That expression is junk, and you didn't say where you got it from apart 
> from "some blog".
>
> What I am missing here... How I can achieve this solution like "find the 
>> instances that have been completely in down state for last X days"
>>
>
> Can you explain why the answer I gave before is not usable for you?  I 
> have already told you that:
>
>     max_over_time(up[30d]) == 0
>
> will give you a list all instances which have been down continuously for 
> the last 30 days, and that seems to be what you keep asking for.  I have 
> tested it, it works:
>
> [image: img1.png]
> That is a table of machines which have been down for 30 days continuously.
>
> Note that this is a query that you should run at a single instant (the 
> current time), not one that you make a graph from.  In Grafana, turn the 
> "instant" toggle on to get this behaviour.
>
> [image: img2.png]
>
> You'll just get set of single data points, which is a list of all the 
> machines that have been down continuously from (now - 30 days) to (now).
>
> You probably want to change the visualisation to a table, or some other 
> panel type. Graph isn't want you want here, since it only shows data for a 
> single point in time.  That is: those machines, which *at the current time* 
> have been down for 30 days before *the current time*.  The reference point 
> is the current time only; you don't want to sweep this query over previous 
> times.
>
>

-- 
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/0f8e77ce-faec-4bac-bd0e-94e8453d2c48n%40googlegroups.com.

Reply via email to