Hello Sir, Actually I wanted find anomaly using Prometheus for time series data of Memory and CPU, so I thought of implementing Z-score. and, Z-score formula is (x-mean)/Standard deviation.
We have already referred the following Links: https://stackoverflow.com/questions/71079726/why-does-stddev-over-time-increase-the-bigger-the-range-vector-is https://stackoverflow.com/questions/72832048/unit-test-for-z-score-with-prometheus but couldn't fetch any positive result. So I wanted Prometheus query which would help me to get anomaly for specified time interval, whether it is Z-score or any other method. On Friday, 9 December 2022 at 14:13:16 UTC+5:30 Brian Candler wrote: > 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 [email protected] 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/22c299a2-e159-42d2-869b-c1479eb228c2n%40googlegroups.com.

