In the previous article (Part 6), we demonstrated how you can easily associate the list of VMDKs to their respective OS partitions within a VCSA or PSC node, which is useful when you need to increase the disk capacity for a specific OS partition. In Part 7, we are now going to drill down a bit further into the underlying filesystem and retrieve both the storage capacity as well as utilization of each partition.
VAMI UI Area of Focus
There is not a granular view of the individual OS partitions within the VAMI UI (https://[VCSA]:5480). However, this information is available as part of the VAMI information when logged into the vSphere Web Client by navigating to System Configuration->Nodes->Monitor->Storage as shown in the screenshot below.
The workflow for retrieving the storage statistics using the VAMI APIs is also applicable for retrieving other statistics such as compute, memory and networking. You first need to retrieve the list of VAMI Statistic IDs that are available from the monitoring API endpoint which is demonstrated with the Get-VAMIStatsList function. From each VAMI Stat ID, you can also drill down further to get more details such as description and the unit of measurement. Once you have the Stat IDs that you are interested in, you can then perform a query based on a specific set of search criteria which can be time range (start and stop time), interval, etc. To demonstrate how the query API works, I have created the Get-VAMIStorageUsed function to demonstrate its usage.
VAMI APIs Used
- GET /appliance/monitoring
- GET /appliance/monitoring/query
PowerCLI Function
Sample Output
The first function Get-VAMIStatsList does exactly as it sounds, it simply lists all VAMI Stat IDs that are available. Most of the Stat ID names are pretty descriptive but you can always retrieve more information by performing a GET on /appliance/monitoring/[VAMI-STAT-ID].
As stated in the beginning, we are interested in the grabbing the storage stats. The Get-VAMIStorageUsed function takes a subset of the VAMI Stats ID, specifically the storage ones that map to the OS partitions and retrieves both the total and used capacity (MB) as shown in the screenshot below.
- 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
Thanks for the comment!