When creating a supermetric to calculate an average, there are two functions, avg() and avgN(). If I want to find an average CPU value for example for a single VM, do I use avg() or avgN()?
Use avg() for a single resource. However, the avg() formula will only have a single datapoint for that single resource, so you're actually only going to get the "actual" CPU value.. meaning there is no reason to have a SM.
Whether to use avg or avgN depends on what you want to do. Your resouce kind and attribute ids will vary.
If you want the average of a metric for all the virtual machines in a tier, you could use this supermetic and apply it to the tier.
avg([$RK15:A680])
avg([Virtual Machine: CPU Usage|Usage (%)])
However, if I wanted the average for all the servers in the application, this supermetric would not work, because the application has no virtual machines directly below it in the hierarchy. Since the VMs are assigned to a tier within the application (2nd level down), a supermetric like this would be required.
avgN($RK15:A680,2)
avgN(Virtual Machine: CPU Usage|Usage (%),2)