You're averaging across all the CPUs to get a single figure for the instance, instead of a separate figure per CPU. You're not averaging over time.
You're using irate(...) which uses the last two figures available for CPU usage. I'd use rate(...[2m]) instead of irate(...[5m]) but they should give the same results when you have a 1 minute scrape interval. Either of these will take the difference between node_cpu_seconds_total@now and node_cpu_seconds_total@1_minute_ago and use this to calculate the rate of CPU usage. So what exactly is wrong with this query - in other words, what do you want that's different? On Friday, 9 December 2022 at 05:23:04 UTC shivakuma...@gmail.com wrote: > Hello All, > > > > I was scraping data for fetching CPU usage for every minute and the query > i'm using is > ((1 - avg(irate(node_cpu_seconds_total{mode="idle",instance=~"$ip"}[5m])) by > (instance)) * 100), > > i'm getting the average data but i want the last data sample which is > evaluated. > > Could you please help me with a proper query to fetch cpu usage of entire > instance for a particular minute. > > Thanks and Regards, > > Sandesh S > > -- 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/e3b8d987-2d1f-4c78-ada2-b750f8a01330n%40googlegroups.com.