WilliamLam.com

  • About
    • About
    • Privacy
  • VMware Cloud Foundation
  • VKS
  • Homelab
    • Resources
    • Nested Virtualization
  • VMware Nostalgia
  • Apple
You are here: Home / Automation / Exploring new VCSA VAMI API w/PowerCLI: Part 2

Exploring new VCSA VAMI API w/PowerCLI: Part 2

01.25.2017 by William Lam // 14 Comments

In Part 2 of this series, we take a look at how to monitor the health of your vCenter Server Appliance (VCSA) by retrieving some of the health metrics that are exposed by the Virtual Appliance Management Interface (VAMI).

VAMI UI Area of Focus

Regardless if you have an Embedded VCSA, External PSC or External VCSA node, there are four basic health metrics that are shown in the VAMI UI today: overall health of the system, CPU, memory and the last time the health check was performed. If you are running an Embedded VCSA or External VCSA, there is an additional health metric for the vCenter Server Database (VCDB) as shown in the screenshot below. Interestingly, while going through the health APIs, I also found a few more metrics that are currently not displayed in the VAMI UI today. These additional metrics include Swap, Storage and Software packages which can also be useful to monitor, especially on the storage front.

VAMI APIs Used

  • GET /appliance/system/health/system
  • GET /appliance/system/health/system/lastcheck
  • GET /appliance/system/health/load
  • GET /appliance/system/health/mem
  • GET /appliance/system/health/swap
  • GET /appliance/system/health/storage
  • GET /appliance/system/health/databasestorage
  • GET /appliance/system/health/softwarepackages

PowerCLI Function

  • Get-VAMIHealth

Sample Output


Similiar to the output found in the VAMI UI, you now have a quick way of viewing the high level health of the VCSA which includes additional metrics not covered in the UI today. The VAMI APIs also provide more granular statistics if you wish to drill down further such as inspecting the current storage utilization for each partition/volume as an example. We will save that use case for a future blog post.

  • Exploring new VCSA VAMI API w/PowerCLI: Part 1
  • Exploring new VCSA VAMI API w/PowerCLI: Part 2
  • Exploring new VCSA VAMI API w/PowerCLI: Part 3
  • Exploring new VCSA VAMI API w/PowerCLI: Part 4
  • Exploring new VCSA VAMI API w/PowerCLI: Part 5
  • Exploring new VCSA VAMI API w/PowerCLI: Part 6
  • Exploring new VCSA VAMI API w/PowerCLI: Part 7
  • Exploring new VCSA VAMI API w/PowerCLI: Part 8
  • Exploring new VCSA VAMI API w/PowerCLI: Part 9
  • Exploring new VCSA VAMI API w/PowerCLI: Part 10

More from my site

  • Exploring new VCSA VAMI API w/PowerCLI: Part 10
  • Exploring new VCSA VAMI API w/PowerCLI: Part 9
  • Exploring new VCSA VAMI API w/PowerCLI: Part 8
  • Exploring new VCSA VAMI API w/PowerCLI: Part 7
  • Exploring new VCSA VAMI API w/PowerCLI: Part 6

Categories // Automation, PowerCLI, vSphere 6.5 Tags // PowerCLI, vami, vcenter server appliance, vSphere 6.5

Comments

  1. *protecteddaburgett says

    01/25/2017 at 12:04 pm

    This may be a VERY rudimentary question for this post, but figured I'd ask...I keep getting errors when trying to run the Connect-CisServer cmdlet. If I use the adminstrator at vpshere dot local creds, it lets me connect, but then I get errors when running either the Get-VAMIHealth or Summary. If I use the vsphere appliance root creds, I get errors just trying to connect. Any help would be appreciated.

    Reply
    • William Lam says

      01/25/2017 at 4:03 pm

      I assume you're running on vSphere 6.5 and PowerCLI 6.5 R1?

      What errors are you seeing when running the either of the VAMI Functions?

      Reply
      • *protecteddaburgett says

        01/26/2017 at 11:13 am

        Yes, PowerCLI 6.5 R1 Build 4624819...I'm running VCSA version 6.5.0.5100. My vSphere is still on version 6.0.2. Does that matter? The errors are see are below when I try to connect-cisserver with the VCSA root creds:

        Connect-CisServer : 1/26/2017 2:11:41 PM Connect-CisServer com.vmware.vapi.std.errors.unauthenticated {'messages':
        [com.vmware.vapi.std.localizable_message {'id': com.vmware.vapi.endpoint.method.authentication.required,
        'default_message': Authentication required., 'args': []}], 'data':}.
        At line:1 char:1
        + Connect-CisServer -****** -User root -Password ****** ...
        + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo : NotSpecified: (:) [Connect-CisServer], CisException
        + FullyQualifiedErrorId : VMware.VimAutomation.Cis.Core.Impl.V1.Service.CisConnectionService.SessionCanNotBeCreate
        d,VMware.VimAutomation.Cis.Core.Commands.Cmdlets.ConnectCisServer

        Reply
        • William Lam says

          01/26/2017 at 4:23 pm

          It looks like you need to connect using the SSO Credentials (e.g. *protected email*) rather than root to connect

          Reply
          • *protecteddaburgett says

            01/27/2017 at 5:03 am

            Yes, the SSO creds allow me to connect. However, after importing the module and running either the get-vamihealth or summary, I get a lot of errors like the ones I pasted below...looks like it's having trouble with the variables defined in the module?

            A server error occurred: 'com.vmware.vapi.std.errors.unauthorized': Unable to authorize user (Server error id:
            'vapi.security.authorization.invalid'). Check $Error[0].Exception.ServerError for more details.
            At C:\Program Files (x86)\VMware\Infrastructure\PowerCLI\Modules\vami.psm1:24 char:5
            + $ts = [timespan]::fromseconds($systemUptimeAPI.get().toString())
            + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            + CategoryInfo : OperationStopped: (:) [], CisServerException
            + FullyQualifiedErrorId : VMware.VimAutomation.Cis.Core.Types.V1.CisServerException

            You cannot call a method on a null-valued expression.
            At C:\Program Files (x86)\VMware\Infrastructure\PowerCLI\Modules\vami.psm1:25 char:5
            + $uptime = $ts.ToString("hh\:mm\:ss\,fff")
            + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            + CategoryInfo : InvalidOperation: (:) [], RuntimeException
            + FullyQualifiedErrorId : InvokeMethodOnNull

          • William Lam says

            01/27/2017 at 8:24 am

            Can you try just pasting the function directly into the console and then run Get-VAMISummary to see if that works?

          • *protecteddaburgett says

            01/27/2017 at 2:23 pm

            New errors below...I was logged in as *protected email*.

            A server error occurred: 'com.vmware.vapi.std.errors.unauthorized': Unable to authorize user (Server error id:
            'vapi.security.authorization.invalid'). Check $Error[0].Exception.ServerError for more details.
            At line:21 char:5
            + $results = $systemVersionAPI.get() | select product, type, versio ...
            + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            + CategoryInfo : OperationStopped: (:) [], CisServerException
            + FullyQualifiedErrorId : VMware.VimAutomation.Cis.Core.Types.V1.CisServerException

            A server error occurred: 'com.vmware.vapi.std.errors.unauthorized': Unable to authorize user (Server error id:
            'vapi.security.authorization.invalid'). Check $Error[0].Exception.ServerError for more details.
            At line:24 char:5
            + $ts = [timespan]::fromseconds($systemUptimeAPI.get().toString())
            + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            + CategoryInfo : OperationStopped: (:) [], CisServerException
            + FullyQualifiedErrorId : VMware.VimAutomation.Cis.Core.Types.V1.CisServerException

            You cannot call a method on a null-valued expression.
            At line:25 char:5
            + $uptime = $ts.ToString("hh\:mm\:ss\,fff")
            + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            + CategoryInfo : InvalidOperation: (:) [], RuntimeException
            + FullyQualifiedErrorId : InvokeMethodOnNull

  2. *protectedSoylent says

    01/26/2017 at 12:55 pm

    Doesn't it show the CPU, memory and swap info for you when you click on "CPU and Memory"? It shows that on my 6.0 appliance on the Monitor tab in Nodes

    Reply
    • William Lam says

      01/26/2017 at 4:21 pm

      No. If you take a look at the "CPU and Memory", it just shows the % of utilization for CPU/Memory, Swap is not included

      Reply
  3. *protectedMartin says

    12/20/2017 at 12:08 am

    Hi, thank you very much for this series of articles!
    I have a problem using /appliance/system/health/softwarepackages - while I get an answer, the answer actually is incorrect.
    Everyday I am running a script to check the health status of our ESXi servers and ever since we moved to vCSA I also needed to include the appliance in these health checks.

    Just recently I found out that even though the VAMI UI displays an update available - in this case build 6.5.0.12000 - the API call returns "green":

    C:\>$healthSoftwareUpdates = (Get-CisService -Name 'com.vmware.appliance.health.softwarepackages').get()
    C:\> echo $healthSoftwareUpdates
    green
    C:\>

    As I could not find an API call to check online for updates prior to get the health status (this was the way I check for updates with the Windows vCenter server) I have scheduled automatic update check in the VAMI UI but this would not to the trick.

    Is this a possible bug?

    Reply
    • *protectedChristian says

      02/15/2018 at 5:24 pm

      Hi, I can confirm this. A "check for Updates" API Call and an Call to get informations about the Update would be really nice.

      regards
      Christian

      Reply
  4. *protectedrim saoud says

    03/16/2018 at 9:14 am

    hey William Lam,
    i have problem to import get-vami to my powercli they say to mee "The term 'Get-VAMIHealth' or get-vami is not recognized as the name of a cmdlet, function, script file, or operable program." i can't imported on my ùachine to get healt of vcsa;
    tanks for responding

    Reply
    • *protectedKa says

      03/10/2021 at 1:29 pm

      Hello There! Did you ever find the solution to this? I have the same issue. Thank you!

      Reply
  5. *protectedStewart Harrison says

    01/04/2019 at 7:34 am

    Is it possible to give another user other than *protected email* rights to login to this interface? I would like to use our normal monitor user account. Thanks.

    Reply

Leave a Reply to daburgettCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Search

Thank Author

Author

William is Distinguished Platform Engineering Architect in the VMware Cloud Foundation (VCF) Division at Broadcom. His primary focus is helping customers and partners build, run and operate a modern Private Cloud using the VMware Cloud Foundation (VCF) platform.

Connect

  • Bluesky
  • Email
  • GitHub
  • LinkedIn
  • Mastodon
  • Reddit
  • RSS
  • Twitter
  • Vimeo

Recent

  • Programmatically accessing the Broadcom Compatibility Guide (BCG) 05/06/2025
  • Quick Tip - Validating Broadcom Download Token  05/01/2025
  • Supported chipsets for the USB Network Native Driver for ESXi Fling 04/23/2025
  • vCenter Identity Federation with Authelia 04/16/2025
  • vCenter Server Identity Federation with Kanidm 04/10/2025

Advertisment

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy

Copyright WilliamLam.com © 2025

 

Loading Comments...