神刀安全网

Getting started with PowerCLI for vRealize Operations (vR OPs)

I recently took some time to explore the PowerCLI module for vRealize Operations Manager (vR Ops). This module was released with PowerCLI 6.0 R2 last year and I can say that after a test drive I am really impressed at the capabilities of this new module. A useful set of cmdlets are provided and the entire vR Ops public API is accessible through this module.

In this blog post, I will cover some of the basics of the module and give some examples of usage including programmatically resolving an alert condition on a virtual machine. In these examples I am using PowerCLI 6.3 Release 1 with vRealize Operations Manager 6.2. I will follow this up with a more in-depth blog post explaining how the vR Ops API can be leveraged via PowerCLI.

To begin, the available cmdlets for the module (which is named “VMware.VimAutomation.vROps”) are shown below.

Getting started with PowerCLI for vRealize Operations (vR OPs)

These are very handy cmdlets and for common use cases like pulling statistics, alerts, resource properties and other information,as well as this there is also a way to access the entire API for vR OPs but we will cover this in a future post.

It’s easy enough to get started, just use the connection cmdlet to begin.

Getting started with PowerCLI for vRealize Operations (vR OPs)

Once connected to the vR Ops server, you can now start exploring. Looking up active alerts may be a great place to start. If you are new to PowerCLI, your best bet is to first run “get-help <cmdlet>” to give you a start on usage. Here is a listing of active critical alerts that are impacting Health .

Getting started with PowerCLI for vRealize Operations (vR OPs)

Notice that there are columns for Type and Subtype which can be used as input parameters for the Get-OMAlert cmdlet, yet there are cmdlets provided for those specific parameters (Get-OMAlertType and Get-OMAlertSubtype). Using those cmdlets without input parameters returns a list of all valid types and subtypes on the server.

Getting started with PowerCLI for vRealize Operations (vR OPs)

In addition to type and subtype, you can retrieve alerts using the –AlertDefinition parameter and the cmdlet Get-OMAlertDefinition can be used to find the available alert definitions in the system. You can filter the output to show alert definitions of a given alert type and subtype, for example below is the output for Network Alerts of the subtype Configuration .

Getting started with PowerCLI for vRealize Operations (vR OPs)

Alert definitions contain a lot of information that may be helpful and here I show the output of the cmdlet using the –name parameter with a wildcard.

Getting started with PowerCLI for vRealize Operations (vR OPs)

Note the values for AdapterKind and ResourceKind properties. These can be used as input parameters as well. For example:

Getting started with PowerCLI for vRealize Operations (vR OPs)

What can you do with the alerts? If I pull a single alert instance into a variable we can explore other details of the alert. Information on the status, event times and control state are available as well as other useful information.

Getting started with PowerCLI for vRealize Operations (vR OPs)

Using the Set-OMAlert cmdlet I can take or release ownership of an alert, suspend an alert for a period of time (in minutes) or cancel the alert. For example, I can take ownership and suspend the alert I stored in $alert above.

Getting started with PowerCLI for vRealize Operations (vR OPs)

A couple of things to note for this cmdlet is that the ownership for the –TakeOwnership property assigns the currently connected user as the owner. Also, the example above shows the optional –Confirm parameter but there is also a –WhatIf parameter to display the changes that would be made but not commit them.

Stay tuned as the next post will discuss more vR Ops Cmdlets and further automation by PowerCLI soon.

Getting started with PowerCLI for vRealize Operations (vR OPs) John Dias is a Staff Systems Engineer on VMware’s Solution Engineering and Technology team specializing in Cloud Management solutions.

John is a veteran IT professional with over 22 years of experience, most of that having been on the customer side running data center operations, data storage, virtual infrastructure and Unix environments for a major financial institution.

He normally blogs at storagegumbo.com and in his spare time he enjoys astronomy and astrophotography.

转载本站任何文章请注明:转载至神刀安全网,谢谢神刀安全网 » Getting started with PowerCLI for vRealize Operations (vR OPs)

分享到:更多 ()

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址