VMware VAMI PowerCLi module

Cover

At the beginning of this year famous VMware guru William Lam wrote excellent series of articles “Exploring new VCSA VAMI API w/PowerCLI”. Together with that he released his VAMI PowerCLi module.

Excellent technology (thanks to VMware), good job (thanks to William) and great start point for community members like me.

I have released my version of VAMI (Virtual Appliance Management Interface) PowerCLi module.

01.VAMI_Get-Command

There were two reasons for the module writing: overall module improvements and new functions.

Overall module improvements

  • All functions support simultaneous connections to multiple vSphere Automation SDK servers within the same PowerCLi session. All returned objects contain Server property.
Connect-CisServer VCSA, PSC1, PSC2
Get-VAMISummary
  • Some functions have been converted to advanced functions to support -Verbose and -Confirm parameters.
Start-VAMIService -Name vsphere-client –Verbose
Remove-VAMIUser lamw -Verbose -Confirm:$false
  • All functions return objects only (no more Write-Host). This allows to format or export an output from any function.
Get-VAMIStorageUsed | Format-Table –AutoSize
Get-VAMIHealth | Export-Csv -NoTypeInformation .\Health.csv
  • Pipeline supported for paired functions.
Get-VAMIService vsphere-client | Stop-VAMIService
Get-Help Get-VAMITime -Online
  • Some minor changes in Param () sections. For example, Get-VAMIService now can accept multiple services in the -Name parameter.
Get-VAMIService rbd,vsphere-client
  • Added some properties to returned objects in some functions. For example, Usage% property in the Get-VAMIStorageUsed and Description in the Get-VAMIService (like you see in the Web Client).
Get-VAMIStorageUsed | Get-Member
Get-VAMIService | Get-Member -MemberType NoteProperty

New functions

  • The Restart-VAMIService function. Well, it was simple Emoj, but if we have Get-VAMIService/Start-VAMIService/Stop-VAMIService – why could not we have Restart-VAMIService? Now we have.
Get-VAMIService rbd,vsphere-client | Restart-VAMIService
  • The Get-VAMIPerformance (CPU and Memory in VAMI UI). I will consider this function in more detail.

Get-VAMIPerformance

02.VAMI_CPU-Memory

Connect-CisServer VCSA
Get-VAMIPerformance

By default, the function returns CPU and Memory metrics for the last day and takes the samples every two hours.

03.VAMI_Get-VAMIPerformance_Default

This can be controlled by -Period and -Interval parameters. The parameters are positional and Intellisense is supported as well.

Get-VAMIPerformance –Period Week –Interval DAY1
Get-VAMIPerformance Day HOURS6

04.VAMI_Get-VAMIPerformance_Period-Interval

Sometimes you will get zero metrics. There two reasons for this: either appliance was powered off awhile or a period, specified by -Period parameter overlaps with a period before the appliance was deployed. The -ExcludeZero switch will filter these metrics out from the report.

Get-VAMIPerformance –Period Quarter -ExcludeZero

05.VAMI_Get-VAMIPerformance_ExcludeZero

And finally you can export a long period (three month) frequent report (get samples every five minutes) and analyze it in Excel later.

Get-VAMIPerformance Quarter MINUTES5 –ExcludeZero | Export-Csv –notype .\Perf.csv

If you are familiar with the Excel, there is no problem to build some graphs.

06.VAMI_Excel

Your manager will like it Emoj.

You may also like:

VMware VSAN PowerCLi module

5 thoughts on “VMware VAMI PowerCLi module

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s