A while back I was contacted by someone who knew that PowerCLI now worked with vRealize Operations (vROPS) and knew it covered the entire API but was unsure how to get to the point where they could achieve what they wanted.
Before I go into what they were doing I highly recommend that if you are interested in learning what is available via VROPs and PowerCLI you check out the following awesome posts by John Dias
- Getting started with PowerCLI for vRealize Operations (vR OPs)
- Working with Recommendations and Statistics in vR OPs with PowerCLI
And specifically check out this post which tells you the more advanced feature of being able to access the entire API and create your own functions.
So, the story around this script was that this person was heavily using vROPs in their environment to monitor and troubleshoot their VMware infrastructure, they had it highly tuned but also used PowerCLI to automate some maintenance and updates of the infrastructure, the problem was that every time they performed these tasks they would get automated alerts from vROPs to tell them that things were down or not behaving correctly.
This while expected was clearly a pain as we all know that unwanted email from a monitoring system can get tedious and eventually ignored to the detriment of something important being missed.
So, the script below was written as an example of how to place vSphere items into what vROPs calls “Maintenance Mode” which means I know I am doing maintenance on this object so please don’t send me alerts. Once completed the functions can be used to turn it back on and everything is therefore automated. Viola!
The examples can be seen at the bottom of the script and the script can be downloaded (or added to) by checking it out in the PowerCLI Community Examples here.