I would think the best way is:
=================================
MySQL
=================================
Domain || 1 || 2 || 3 || avg
=================================
test.com || 0.01 || 0.08 || 0.03 || 0.04
test2.com || 0.08 || 0.03 || 0.01 || 0.04
=================================
Basically the avg value is the average over 10 minutes which the script could use....
Every 5 minutes you get the cpu usage and do the following
1, 2 and 3 are the 5 minutes intervals - 1 being the most recent 2 being 5 minutes ago and 3 being 10 minutes ago.
Move the current value in 2 to 3
Move the current value in 1 to 2
Get the current CPU usage for this domain and insert that into 1
Basically every 5 minutes you move the previous value to 5 minutes later on.... after 10 minutes it gets overwirriten and removed.
Im getting the average by simply adding the last 3 usage amounts up then dividing it by 3
Chris