You are using wrong performance data. You want to query a certain performance counter of a given service. In your case the service is CPU utilization and that service has (at least) 6 different performance counters. You can see them either by doing
OMD[stest]:~/var/check_mk/rrd/localhost$ cat CPU_utilization.info
HOST localhost
SERVICE CPU utilization
METRICS wait;guest;user;steal;system;util;cpu_core_util_3;cpu_core_util_2;cpu_core_util_0;cpu_core_util_1
GET services
Filter: host_name = ESX1
Filter: service_description = CPU utilization
Columns: rrddata:m1:util.max,1,*:$(date +%s -d"a month ago"):$(date +%s):1"
Now i’m getting info.
So, can you confirm 4 things?
grep METRICS xxxx.info, and i get the rrd attribute
Values are: max, min and average (not avg)
What’s the difference between:
for i in $(lq “GET services\nFilter: host_name = ESX1\nFilter: service_description ~ CPU utilization\nColumns: rrddata:m1:util.average,1,*:$(date +%s -d"a month ago”):$(date +%s):1" | sed -e ‘s/,/ /g’); do echo $i; done | sort -n | grep “.” |tail -1
And…
GET services
Filter: description = CPU utilization
Filter: host_name = ESX1
Filter: time > $(date +%s -d"a month ago")
Filter: time = $(date +%s)
Stats: sum perf_data
With the first (rrddata column), I’m getting a lot of data, not the maximum value, not the min, not the avg. I guess im getting maximum values, same for min and average. What’s the logic of that? i’m asking for the maximum value in the last 30 days.
What you get with the rrddata query is the raw data and nothing else. Now you parse this many values you get back and take the maximum value.
Please don’t mix the maximum from the rrd query with the maximum value over a specific time period.
The rrd min/max/avg are only the aggregated values over a given number of datapoints and a specific time frame.
In your case i would only use the max function to get my rrd data and then only search the maximum value in the result. If you want to build a sum over the last month then it is better to use the avg to fetch the rrd values and then add all values together.
To understand all this a little bit better, the tutorial about RRDs from Alex van den Bogaerdt. The parts about consolidation and resampling are nice to read. RRDtool - rrdtutorial or http://rrdtool.vandenbogaerdt.nl/