Maintenance tasks (aggressive patching of windows guest os) are throwing out stats in vrops, causing additional risks requesting for adding cpu etc
These guest servers are consistent and understood, but for these spikes.
Now, I've discovered that vrops can handle this by placing objects into maintenance mode, which can be done singularly or on a schedule, neither which really work for us.
Patching is automated and driven from another system.
Options, Powercli or API ?
I found a script at vmware codew by Alan Renouf VRealize Operations Maintenance Mode - Samples - VMware {code} which looks promising, however, it fails to run for me.
When I run the script, it fails on an element, get-omresource
output...
Get-OMResource : Requested value 'NOTEXISTING' was not found.
At C:\Enable-OMMaintenance.ps1:40 char:56
+ $Item = Get-Inventory -Name $Entry | Get-OMResource
+ ~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-OMResource], ArgumentExce
ption
+ FullyQualifiedErrorId : System.ArgumentException,VMware.VimAutomation.vR
Ops.Commands.Cmdlets.GetOMResource
To rule out the script somewhat, if I run the Get-OMResource independently, it starts bringing information back from vrops and then it fails with (example)
objectname Orange VirtualMachine
objectname Green VMFolder
Get-OMResource : 15/06/2017 10:34:54 Get-OMResource Requested value
'NOTEXISTING' was not found.
At line:1 char:1
+ Get-OMResource
+ ~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-OMResource], VimException
+ FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomatio
n.vROps.Commands.Cmdlets.GetOMResource
Which makes me think this is an API issue maybe? some part of the vmware.vimautomation.vrops or because I'm on vrops 6.5?
If anybody has any ideas or alternate suggestions to do what I need, that would be great.
I tried support, who said buy professional services or use the communities, hence, I'm here.
Hello,
So I tested this with the Suite-API and its working fine for me...
Here is an example with AdvancedRestClient where i put the object into maintained for 5 minutes...
This is how it shows up in the GUI...
This is how it shows up in the API..
if you dont want to specify minutes... but instead a date / time... use end instead of duration like this end=497960377000
497960377000 = EPOC time in milliseconds
If you want to put it into maintenance with no duration / date&time... this means you will have to manually take it out of maintenance.. example below.
method = PUT https://yourvRopsAddress/suite-api/api/resources/07695b3d-2592-43b6-ab20-7fa5f1615447/maintained
method = DELETE https://yourvRopsAddress/suite-api/api/resources/07695b3d-2592-43b6-ab20-7fa5f1615447/maintained
I will be automating this process with Powershell when i get some time as I will soon need this myself.
My script will allow to specify the object name instead of the ResourceID + the resourceKind (incase we have objects with duplicate names but of different types). and will convert human readable datetime for the end or allow to specify in minutes... keep and eye out for this on my blog.
I hope the examples will allow you to test this on your own environment in the mean time.
Cheers
vMan
I'm running vRops 6.5 and it works for me.
I copy/pasted the content of the ps1 script into a PowerCli console and then connected to vCenter and vRops.
Connect-VIServer 10.10.10.10.
Connect-OMServer 10.10.10.11
get-vm loginsight | Enable-OMMaintenance -MaintenanceTime 20
Name Health ResourceKind Description
---- ------ ------------ -----------
LogInsight Grey VirtualMachine
If the above does not work? Which version of PowerCli are you using ? I'm on PowerCli 6.0 R3
I have finished the script... i will post it on my blog within the next 2 days... i need to write up a post but have some commitments tonight which will prevent me from doing it sooner.
cheers
vMan
and here is the script vRops – Maintenance Mode for Resources | vMan
If you find this helpful please like the post and / or mark it as answered.
Cheers
vMan
Thanks MichaelRyom
I tried various versions of Powercli, I managed to get it to work in the end with build 5377412
vMan, Thanks for the script, that's amazing work.
This is my first post in these forums, and it feels like forums did when I started in IT some 20 years ago, really helpful.
Thanks for the feedback and your welcome
If you don't mind answering your original question as answered with my post it might give me some "street cred" on the forums.
Cheers
vMan