Showing posts with label Resource. Show all posts
Showing posts with label Resource. Show all posts

Friday, February 21, 2020

VMware PowerCLI 101 - part7 - Working with vROps

This article explains how to work with vROps resources using PowerCLI. The following diagram shows the relationship between adapters, resource kinds, and resources. There can be multiple adapters installed on the vROps instance. Each adapter kind will have multiple resource kinds and each resource kind will have multiple resources. And each resource will have its own badges and badge scores.


Note I am using the following versions:
PowerShell: 5.1.14393.3383
VMware PowerCLI: 11.3.0.13990089
vROps: 7.0

Connect to vROps:
Connect-OMServer <IP of vROps>

Get the list of all installed adapters:
Get-OMResource | select AdapterKind -Unique


Get all resource kinds of a specific adapter:
Get-OMResource -AdapterKind VMWARE | select ResourceKind -Unique


Get the list of resources of a specific resource kind:
Get-OMResource -ResourceKind Datacenter


Another example:
Get-OMResource -ResourceKind ClusterComputeResource


Get details of a specific resource:
Get-OMResource -Name Cluster01 | select *



Get badge details of a selected resource:
(Get-OMResource -Name Cluster01).ExtensionData.Badges


List all resources of an adapter kind where health is not green:
Get-OMResource -AdapterKind VMWARE | select AdapterKind,ResourceKind,Name,Health,State,Status | where health -ne Green | ft



Get the list all objects of an adapter kind that have collection issues:
Get-OMResource -AdapterKind VMWARE | select AdapterKind,ResourceKind,Name,Health,State,Status | where {($_.Status -ne "DataReceiving") -or ($_.State -ne "Started")} | ft


Get the list of all active critical alerts from a specific adapter type:
Get-OMResource -AdapterKind VMWARE | Get-OMAlert -Criticality Critical -Status Active


Hope it was helpful. Cheers!

Related posts

VMware PowerCLI 101 Blog Series

Saturday, November 17, 2018

Real time VMware VM resource monitoring using PowerShell

This post is about monitoring resource usage of a list of virtual machines hosted on VMware ESXi clusters using PowerCLI. Output format is given below which gets refreshed automatically every few seconds.

Prerequisites:
  • VMware.PowerCLI module should be installed on the node from which you are running the script
  • You can verify using: Get-Module -Name VMware.PowerCLI -ListAvailable
  • If not installed, you can find the latest version from the PSGallery: Find-Module -Name VMware.PowerCLI
  • Install the module: Install-Module -Name VMware.PowerCLI
Note:
  • I am using PowerCLI Version 11.0.0.10380590

Latest version of the project and code available at: github.com/vineethac/vmware_vm_monitor

    Sample screenshot of output:


    Notes:

    VMware guidance: CPU Ready time and Co-Stop values per core greater than 5% and 3% respectively could  be a performance concern.

    Hope this will be useful for resource monitoring as well as right sizing of VMs. Cheers!

    References:

    Sunday, April 26, 2015

    VM Resource Metering


    'VM Resource Metering' is a feature in Windows Server 2012 R2, which will help us to keep track of the resources consumed by virtual machines. By default this feature is disabled.

    You can enable metering for a particular VM using the PowerShell command : Get-VM <virtual machine name> |  Enable-VMResourceMetering

    If you want to enable it for all VMs, you can use : Get-VM | Enable-VMResourceMetering

    You can view the resource usage list of all virtual machines using : Get_VM | Measure-VM

    You can sort the list using : Get_VM | Measure-VM |sort AvgRAM –descending