In my previous post, I explained the cpu addition automation with PowerShell. Now, I got a request to explain the steps from vROPS as well. As I said that who has vROPS then it is better than doing it from PowerShell. vROPS is undoubtedly Enterprise level solution and I would say PS here is a trick to do it.
Here you go...
- CPU hot add must be enable for the VM(s) which you want to automate for. How to do it?
- User account you are using, must have sufficient access rights
1. Login vROPS with admin privilege account.
2. Click on Alerts from top Menu. Which one? See below image-
3. Expand the Alert Settings and Click on "Alert Definition" and then click on Green + icon as shown below.
Name : Give any suitable name. I gave "_increase cpu count".
Base Object : Select Virtual machine under vcenter adapter here. Type virt and it will auto highlight.
Alert Impact :
Impact: Efficiency (Because continuous CPU spike will decrease the efficiency)
Criticality : Critical (You can select any as per your requirement)
Alert type and sub-type : Application:Performance
Wait Cycle : 1
Cancel Cycle : 1
5. Add Symptom definitions
1. Click on + icon to create a new one if you don't have already.
2. Now select CPU|usage% or CPU|Workload% metric as per your requirement. I chose CPU|Workload% as it make more sense in vROPS version 10.1.2.
3. Drag it to right or double click on the metric.
it looks like as -
- 3.1. Give it a name
- 3.2. click on drop down and select "Immediate" or "Critical" as you wish
- 3.3. When metric is greater than, I put here 99. It means that when CPU|Workload% will be higher than 99%, it will trigger the action.
- 3.4. Once done, click on save. You will be back on alert definition page.
- 3.5. Add recommendation if you want.
- 3.5.1. Click on + icon
- Select Adapter type "vCenter Adapter"
- Select Action "Set CPU count for VM"
Once done then click on save. Your new and fresh Alert Definition has been created here.
Let's automate it now-
1. Check your current active policy. How? Check below
2. Now go to "Policy Library" and find active policy name in the list.
3. Select it and click on edit
4. Directly go to "Alert/Symptoms:Definition" and search for your "Alert Definition" which we created in above steps. It will look like below-
5. Click on Automate column and select "Local". You will see green tick icon as shown in above image.
Now what you have done is, You have enabled automated action to add CPU count (it will add +1) whenever any VM's CPU workload% will be more than 99%.
To see automated task's action, you can go to:
Administration → History → Recent Tasks. Below is the example of successful automated task
Above is standard way to automate it and it should work in most of the scenarios.
Caution : If you are targeting few VMs then make sure you are not applying automation on "Current Default Policy" otherwise CPU addition will trigger on all your VMs in vCenter server.
Solution : Create a new policy → Create new Group and add target VMs in this group → Apply new Policy on new Group. In this way, only those VMs will be automated which you will add in the group
Known issues in this Automation:
Problem 1 : Input Parameter 'CpuCount' not in range, positive number range;passed value 0
It means while increasing cpu count, vROPS detected that new cpu value passed was 0. It means let's say current value is 2 and we or vrops asked it to be 0. That is why it is failing.
1. Check the VMware tool version, It should be running and up to date
2. Check the host CPU's core maximum capacity. How many max cores it can assign to any VM
3. Check esxi host's CPU family and other compatibility. Check this guide
Problem2 : Automation is not triggering
Solution : It has only one reason that automation is not enabled in Policy.
If you have any other issues than above ones then feel free to comment out. I will try my best to help you out.