How to monitor High VM CPU with Aria Operations

I was recently working in my lab environment that is constrained on resources. There were a couple VM’s that had High CPU once in a while and needed to be rebooted. They are just test VM’s but I still wanted to be able to catch when they spike the CPU and automate the reboot. In this guide I will show you how to monitor High CPU in any VM. What is nice is that it uses a hypervisor level monitor so there is no need for in guest agents or even VM tools.

Pre-Reqs

  • A running vSphere environment with some VM’s that you have access to
  • A running Aria Ops installaton that also has the vCenter Agent configured to monitor the above vSphere environment
  • A test VM that you can run a script on to cause the CPU to spike
  • A quite place where you will not be interrupted see my guide here

Login to Aria Operations and Configure the Alert

  1. Click Configure
  2. Click Alerts
  3. Click Alert Definitions
1.png

Now Click Add

1.png

Edit the Alert Definition

  1. Give the Alert a name
  2. Enter a description
  3. Set the Base Object Type as Virtual Machine
  4. Click Next
1.png

Add a Condition

  1. Click Conditions
  2. Click Metrics
  3. Click CPU
  4. Drag and Drop Demand (%)
  5. Configure as shown
  6. Click Next
1.png

Select a recommendation

  1. Drag and drop any recommendations you would apply to fix the VM
  2. Click Next
1.png

Select the Policy you want this applied to.

Policies allow you to choose a subset of the vCenter Inventory. If you want all of vCenter just choose the vSphere Default Policy or you can create a specific one for a group of VM’s

1.png

Now login to either a linux or Windows VM to test this.

I am using a Photon OS 4 VM but you can use any Linux OS. Just make sure it is a test VM that you are ok spiking the CPU on.

You can get Photon OS here for free https://github.com/vmware/photon/wiki/Downloading-Photon-OS

Here is how to create the CPU spike script on Linux https://www.baeldung.com/linux/cpu-spike-bash

Here is how to create the CPU spike script on Windows https://winaero.com/how-to-create-100-cpu-load-in-windows-10/

1.png

Now start the cpu spike script with the following command

sh cpubusy.sh

1.png

Login to vCenter

Select the VM in the inventory and notice the CPU starting to rise

1.png

Go back to Aria Ops

  1. Click Troubleshoot
  2. Click Alerts
  3. Change to Scope
  4. Change to Virtual Machine
  5. Hit refresh until you see the alert for the VM you ran the CPUbusy script in

Note: It may take several minutes for the alarm to trigger

1.png

Go back to the VM you ran the CPUbusy script in and stop it

1.png

Go back to Aria Ops and click refresh until you see the alert disappear

Notice these alerts ar smart enough to go away if the condition is not there anymore

1.png
Remember sharing is caring!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.