Home > Blogs > VMware PowerCLI Blog

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.

image

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.

image

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.

image

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.

image

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.

image

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.

image

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

image

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.

image

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.

image

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.


Dias_JohnJohn 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.

This entry was posted in vRealize Operations and tagged on by .
Alan Renouf

About Alan Renouf

Alan Renouf is a Product Line Manager at VMware focusing on API's, SDK's and CLI's, He is responsible for providing the architects and operators of private and public cloud infrastructure with the toolkits/frameworks and command-line interfaces they require to build a fully automated software-defined datacenter. Alan is a frequent blogger at http://blogs.vmware.com/PowerCLI a book author and has a personal blog at http://virtu-al.net. You can follow Alan on twitter as @alanrenouf.



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.

image

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.

image

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.

image

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.

image

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.

image

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.

image

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

image

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.

image

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.

image

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.


Dias_JohnJohn 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.

This entry was posted in vRealize Operations and tagged on by .
Alan Renouf

About Alan Renouf

Alan Renouf is a Product Line Manager at VMware focusing on API's, SDK's and CLI's, He is responsible for providing the architects and operators of private and public cloud infrastructure with the toolkits/frameworks and command-line interfaces they require to build a fully automated software-defined datacenter. Alan is a frequent blogger at http://blogs.vmware.com/PowerCLI a book author and has a personal blog at http://virtu-al.net. You can follow Alan on twitter as @alanrenouf.

11 thoughts on “Getting started with PowerCLI for vRealize Operations (vR OPs)

  1. David Hesse

    I am not able to connect to our vROps installation using the VMware vSphere PowerCLI 6.0 Release 3 build 3205540
    We are using vROps in Version Version 6.1.0.3038036.
    I am able to log on to the vROps Web UI using my Domain User that is also used to connect to our vCenter-Server and I can do everything I want, but I am unable to connect to the vROps installation via the vSphere PowerCLI.
    What kind of user I need to have on the vROps to be able to log on with the PowerCLI ?
    Or is this because I am running an older Version of the PowerCLI?
    I checked if the VMware.VIMAutomation.vROps module is installed. It runs on Version 1.0.0.0.
    Thanks.

    Reply
    1. John Dias

      You can use your domain credentials (provided you have configured the LDAP integration in vR Ops – which it seems you have). The connection cmdlet would look like:

      connect-OMServer -User -Password -AuthSource

      Reply
  2. Pingback: Working with Recommendations and Statistics in vR OPs with PowerCLI - VMware PowerCLI Blog - VMware Blogs

  3. Humpa

    This is great, i look forward to Set-Resource…

    I really like the Suite-API and having PowerCLI support is even better…

    I look forward to Set-Resource!!

    I am currently looking for a way to change the “Display Name” on Resources with the Suite-API…. but couldnt find any reference to it under /api/resources (updateResource)

    Any ideas if it possible?

    Cheers

    Reply
    1. John Dias

      I imagine that this is because the name for a resource is part of the identifier and changing that might break the relationship with the actual object being monitored.

      Reply
  4. Pingback: Working with maintenance mode in vROPs via PowerCLI - Virtu-Al.Net

  5. vikrant

    Great article, I have really enjoyed your blog . you show how the vR Ops API can be leveraged via PowerCLI. I was little bit confused about the Set-OMAlert cmdlet and you have cleared my confusion , with help of Set-OMAlert cmdlet we can take or release ownership of an alert, suspend an alert for a period of time (in minutes) or cancel the alert. Thanks for sharing . It is very helpful .The way you explained each and everything is really great. Thanks once again.

    Reply
  6. Pingback: Performance of vRealize Operations API - VMware Cloud Management

  7. Pingback: Performance of vRealize Operations API – VMpro.at

Leave a Reply

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

*