vmware.vmware_rest.appliance_monitoring_query module – Query the monitored statistics data of the vCenter Server Appliance.
Note
This module is part of the vmware.vmware_rest collection (version 5.0.0).
You might already have this collection installed if you are using the ansible package.
It is not included in ansible-core.
To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install vmware.vmware_rest.
To use it in a playbook, specify: vmware.vmware_rest.appliance_monitoring_query.
New in vmware.vmware_rest 5.0.0
Synopsis
Retrieve the recorded data points for one or more monitored items on the vCenter Server Appliance, such as CPU, memory, network, or storage usage over a period of time.
The data is returned as a time series aggregated over a chosen interval using a chosen aggregation function (for example, the average CPU utilization sampled every five minutes).
Use vmware.vmware_rest.appliance_monitoring_info to discover which monitored item IDs are available before querying their data with this module.
Parameters
Parameter |
Comments |
|---|---|
The parameters that define the time range and shape of the data to return. Describes the sampling interval, the aggregation function, and the start and end of the period to query. |
|
The end of the time range to query, as an ISO 8601 timestamp in UTC, for example |
|
How the raw samples are aggregated into each returned data point.
Choices:
|
|
The time between each returned data point.
Choices:
|
|
The start of the time range to query, as an ISO 8601 timestamp in UTC, for example |
|
The IDs of the monitored items to query data for, for example The available IDs can be listed with vmware.vmware_rest.appliance_monitoring_info. |
|
Timeout in seconds for the whole operation including connection establishment, request sending, and response. Default: |
|
The hostname or IP address of the vSphere vCenter. If the value is not specified in the task, the value of environment variable |
|
The vSphere vCenter password. If the value is not specified in the task, the value of environment variable |
|
The port number of the vSphere vCenter. If the value is not specified in the task, the value of environment variable |
|
Optional path to a log file for HTTP REST interaction. If the value is not specified in the task, the value of environment variable |
|
The vSphere vCenter username. If the value is not specified in the task, the value of environment variable |
|
Allows connection when SSL certificates are not valid. Set to If the value is not specified in the task, the value of environment variable Choices:
|
Notes
Note
Generated from vSphere API spec 9.1.0.
Compatible with vSphere API 7.0.3.
Compatible with vSphere API 8.0.2.
Examples
- name: Query average CPU utilization over the last day at five minute intervals
vmware.vmware_rest.appliance_monitoring_query:
item:
interval: MINUTES5
function: AVG
start_time: "2026-01-01T00:00:00.000Z"
end_time: "2026-01-02T00:00:00.000Z"
names:
- cpu.util
register: cpu_data
- name: Query maximum CPU and memory usage over a week at thirty minute intervals
vmware.vmware_rest.appliance_monitoring_query:
item:
interval: MINUTES30
function: MAX
start_time: "2026-01-01T00:00:00.000Z"
end_time: "2026-01-08T00:00:00.000Z"
names:
- cpu.util
- mem.util
register: usage_data
- name: Display the data points returned for the first monitored item
ansible.builtin.debug:
var: usage_data.info[0].data
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
|---|---|
A list of the monitored item data returned by the query. Returned: On success Sample: |
|
The queried monitoring data. A single monitored item’s data as a dictionary when only one item was returned, otherwise a list of monitored item data dictionaries. Returned: On success Sample: |