top of page
Brock Peterson

How long has your VM been Powered Off?

If you want to know how long a VM has been powered off, Aria Operations will tell you.

Unfortunately, this is a Calculated Metric, not one that exists on the VM object types. There are times I'd like to use this metric in a View, Dashboard, Alert/Sympton, but can't. So, I started looking around and low and behold, a former VMware TAM published a video on exactly this, here's how you do it.


First, initialize your Super Metric to 0, which is where we'll start.



Assuming we're on a 5m collection cycle, we'll add 5m to this Super Metric if the VM is Powered Off, it looks like this.



Let's discuss the formula in more detail.

{‌This Resource: ‌sys|poweredOn} == 1 ? 0 : {‌This Resource: ‌Super Metrics|VM Down Duration} + 5

This is an if/then/else type Super Metric. If the VM is Powered On then set the Super Metric to 0, else add 5m to the Super Metric itself. A couple things to note:

  • This won't be accurate for VMs that are already down, the Super Metric will only start counting at creation time.

  • The Super Metric assumes the vCenter adapter instance collecting data is on a 5m data collection interval. You'll have to adjust this if you're collecting on a different interval.


Looking at a VM that's already down, you can see the new Super Metric.



Next let's take down a Powered On VM and confirm our Super Metric.



Checking back after several data collections, we now have this. As you can see, our Super Metris is now 25, after 25m minutes, as expected.



Powering the VM back on takes our new Super Metric back to 0.



While it's not perfect, it does give us the ability to track VM Duration Down metrics and use them in Dashboards, Views, and Alerts. This Super Metric (and others) is available on my GitHub repo here.




2 Kommentare


baranaus
07. Okt.

Are you creating two Super Metrics? Do you "zero" out the initial one, then edit it 5m later? At the end, the Super Metric is named 'VM Down Duration (Minute(s))' but the previous steps didn't mention a Super Metric of that name. Can you clarify?

Bearbeitet
Gefällt mir
Brock Peterson
Brock Peterson
07. Okt.
Antwort an

Just one Super Metric, I had the unit on there from a previous screenshot, check now.

Bearbeitet
Gefällt mir
bottom of page