The DCLI command line utility on the vCenter Server Appliance can be utilized to monitor the resource usage of the vCenter server over time.
vCenter Server Appliance 7x
vCenter Server Appliance 8x
The same data can be extracted from the VCDB, but this can be cumbersome. The DCLI method in this KB can be used to streamline the process.
The dcli monitoring query command has the following functions:
dcli com vmware appliance monitoring query --help
usage: com vmware appliance monitoring query [-h] --end-time END_TIME --function {COUNT,MAX,AVG,MIN} --interval
{MINUTES30,HOURS2,MINUTES5,DAY1,HOURS6} [--names NAMES] --start-time START_TIME
Get monitoring data.
Input Arguments:
-h, --help show this help message and exit
--end-time END_TIME required: End time in UTC (string)
--function {COUNT,MAX,AVG,MIN}
required: aggregation function (string)
--interval {MINUTES30,HOURS2,MINUTES5,DAY1,HOURS6}
required: interval between values in hours, minutes (string)
--names NAMES monitored item IDs Ex: CPU, MEMORY (list of string)
--start-time START_TIME
required: Start time in UTC (string)
* An example for monitoring the average memory usage over the past 5 mins to current time/date, using a 5-minute interval between stat collection:
dcli com vmware appliance monitoring query --name mem.usage --interval MINUTES5 --function AVG --start-time "$(date -u -d "now -5 minutes" +"%Y-%m-%dT%H:%M:%S.000Z")" --end-time "$(date -u +"%Y-%m-%dT%H:%M:%S.000Z")" +username administrator@vsphere.local +password "PASSWORD"
* An example for monitoring the average memory usage from a specific time/date to current time/date, using a 5-minute interval between stat collection:
dcli com vmware appliance monitoring query --name mem.usage --interval MINUTES5 --function AVG --start-time "2025-03-16T09:25:05.000Z" --end-time "$(date -u +"%Y-%m-%dT%H:%M:%S.000Z")" +username administrator@vsphere.local +password "PASSWORD"
* An example for monitoring the average memory usage from a specific time/date to a specific time/date, using a 5-minute interval between stat collection:
dcli com vmware appliance monitoring query --name mem.usage --interval MINUTES5 --function AVG --start-time "2025-03-16T09:25:05.000Z" --end-time "2025-03-18T09:00:00.000Z" +username administrator@vsphere.local +password "PASSWORD"
Example output:
To get a list of all available metrics available to query, run this command and take note of the "id":
dcli com vmware appliance monitoring list +username administrator@vsphere.local +password "PASSWORD" +formatter yaml