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
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
daburgett says
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.
William Lam says
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?
daburgett says
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
William Lam says
It looks like you need to connect using the SSO Credentials (e.g. *protected email*) rather than root to connect
daburgett says
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
Can you try just pasting the function directly into the console and then run Get-VAMISummary to see if that works?
daburgett says
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
Soylent says
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
William Lam says
No. If you take a look at the "CPU and Memory", it just shows the % of utilization for CPU/Memory, Swap is not included
Martin says
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?
Christian says
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
rim saoud says
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
Ka says
Hello There! Did you ever find the solution to this? I have the same issue. Thank you!
Stewart Harrison says
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.